MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Code executed based on a condition being true
A
Sequence
B
Selection
C
Iteration
D
Variable
Explanation: 

Detailed explanation-1: -The If statement is the most fundamental decision-making statement, in which the code is executed based on whether it meets the specified condition. It has a code body that only executes if the condition in the if statement is true. The statement can be a single line or a block of code.

Detailed explanation-2: -Use if to specify a block of code to be executed, if a specified condition is true. Use else to specify a block of code to be executed, if the same condition is false. Use else if to specify a new condition to test, if the first condition is false.

Detailed explanation-3: -The if-else statement is used to execute both the true part and the false part of a given condition. If the condition is true, the if block code is executed and if the condition is false, the else block code is executed.

Detailed explanation-4: -The if-else statement in C language is used to execute the code if the condition is true or false. It is also called a two-way selection statement.

There is 1 question to complete.