MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which type of statement is an example of a selection programming structure?
A
If/else
B
while
C
do while
D
for
Explanation: 

Detailed explanation-1: -In selection control structures, conditional statements are features of a programming language which perform different computations or actions depending on whether a programmer-specified Boolean condition evaluates to true or false.

Detailed explanation-2: -– Selection statements: if and switch – Iteration statements: while, do, and for – Jump statements: break, continue, and goto. (return also belongs in this category.) Several of C’s statements must test the value of an expression to see if it is “true” or “false ” expression to see if it is true or false.

Detailed explanation-3: -In if-else structures, a specific action will be performed if the boolean condition is true and another action, if the condition is false. For example, if we wanted to know the number of days from a data set where the daily high temperature was above and below 80 degrees, a programmer could use an if-else statement.

Detailed explanation-4: -An if statement is a selection statement that allows more than one possible flow of control. An if statement lets you conditionally process a statement when the specified test expression, implicitly converted to bool, evaluates to true . If the implicit conversion to bool fails the program is ill-formed.

There is 1 question to complete.