COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Why is selection important?
A
Selection allows a number of steps to be repeated
B
Selection allows multiple paths through a program
C
Selection determines the order in which instructions are carried out
D
None of the above
Explanation: 

Detailed explanation-1: -Many solutions feature several choices or decisions. These decisions lead to different paths through the program. These paths represent the result of making a choice. Without selection it would not be possible to include different paths in programs, and the solutions we create would not be realistic.

Detailed explanation-2: -Sequence is the order in which instructions occur and are processed. Selection determines which path a program takes when it is running. Iteration is the repeated execution of a section of code when a program is running.

Detailed explanation-3: -The case control structure is a multi-way selection. Case control structures compare a given value with specified constants and take action according to the first expression to match.

Detailed explanation-4: -– 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-5: -Selection Sort in C is a sorting algorithm that is used to sort a list of elements in either an ascending order or a descending order. This algorithm chooses the minimum element from the list of elements and swaps it with the first element of the list.

There is 1 question to complete.