ADVANCED TOPICS IN COMPILER DESIGN
CODE GENERATION FOR OBJECT ORIENTED LANGUAGES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
IF-OTHERWISE
|
|
IF-ELSE
|
|
DO-ELSE
|
|
DO-FOR
|
Detailed explanation-1: -In programming, selection is implemented using IF statements . Using IF and ELSE gives two possible choices (paths) that a program can follow. However, sometimes more than two choices are wanted. To do this, the statement ELSE IF is used.
Detailed explanation-2: -Selection is implemented in programming using IF statements. Programs consist of a set of instructions that are carried out one after another. Sometimes there may be more than one path (or set of steps) that can be followed. At this point, a decision needs to be made.
Detailed explanation-3: -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.
Detailed explanation-4: -Selection allows us to include more than one path through an algorithm. Without selection, different paths would not be included in algorithms. This means that the solutions created would not be realistic.
Detailed explanation-5: -– 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.