MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In JavaScript you would implement code SELECTION by:(CHOOSE ALL CORRECT ANSWERS)
A
writing a for-loop
B
writing a while loop
C
making a list
D
writing an if statement
E
writing an if-else statement
Explanation: 

Detailed explanation-1: -We can also write multiple conditions inside a single if statement with the help of the logical operators && and | | . The && operators will evaluate if one condition AND another is true. Both must be true before the code in the code block will execute.

Detailed explanation-2: -Javascript offers a ternary operator which acts like a one-line if / else statement with a single condition. It works really well for conditionally assigning a value to a variable.

Detailed explanation-3: -1) if statement if statement is the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not. If a certain condition is true then a block of statement is executed otherwise not.

There is 1 question to complete.