MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Writing an if-else statement in Javascript is an example of what coding principle?
A
sequencing
B
sorting
C
iteration
D
selection
E
rotation
Explanation: 

Detailed explanation-1: -The if/else statement is a part of JavaScript’s “Conditional” Statements, which are used to perform different actions based on different conditions. In JavaScript we have the following conditional statements: Use if to specify a block of code to be executed, if a specified condition is true.

Detailed explanation-2: -An if else statement in programming is a conditional statement that runs a different set of statements depending on whether an expression is true or false.

Detailed explanation-3: -An if statement lets your program know whether or not it should execute a block of code. Comparison-based branching is a core component of programming. The concept of an if-else or switch block exists in almost every programming language.

Detailed explanation-4: -JavaScript. JavaScript uses if-else statements similar to those in C languages or similar. A boolean value is accepted within parentheses between the reserved if keyword and a left curly bracket.

There is 1 question to complete.