The document contains a C++ quiz with multiple choice questions about control flow statements like break, continue, switch, goto and loops. The questions test knowledge about which statements the control statements can be used with and their functions. Specifically, it covers that break exits from loops and switch statements, continue skips to the next iteration of loops, switch allows different code for multiple conditions, and an infinite loop can be created with for(;;).
The document contains a C++ quiz with multiple choice questions about control flow statements like break, continue, switch, goto and loops. The questions test knowledge about which statements the control statements can be used with and their functions. Specifically, it covers that break exits from loops and switch statements, continue skips to the next iteration of loops, switch allows different code for multiple conditions, and an infinite loop can be created with for(;;).
The document contains a C++ quiz with multiple choice questions about control flow statements like break, continue, switch, goto and loops. The questions test knowledge about which statements the control statements can be used with and their functions. Specifically, it covers that break exits from loops and switch statements, continue skips to the next iteration of loops, switch allows different code for multiple conditions, and an infinite loop can be created with for(;;).
The document contains a C++ quiz with multiple choice questions about control flow statements like break, continue, switch, goto and loops. The questions test knowledge about which statements the control statements can be used with and their functions. Specifically, it covers that break exits from loops and switch statements, continue skips to the next iteration of loops, switch allows different code for multiple conditions, and an infinite loop can be created with for(;;).
Download as PPTX, PDF, TXT or read online from Scribd
Download as pptx, pdf, or txt
You are on page 1of 17
C++ Quiz
The break statement is used to exit
from a. a DO loop b. a FOR loop c. a SWITCH statement d. all of above e. none of above The break statement is used to exit from a. a DO loop b. a FOR loop c. a SWITCH statement d. all of above e. none of above In which statements, does a CONTINUE statement cause the control to go directly to the test condition and then continue the looping process? a. FOR and WHILE b. WHILE and IF-ELSE c. DO-WHILE and IF-ELSE d. While and DO-WHILE e. None of above In which statements, does a CONTINUE statement cause the control to go directly to the test condition and then continue the looping process? a. FOR and WHILE b. WHILE and IF-ELSE c. DO-WHILE and IF-ELSE d. While and DO-WHILE e. None of above The advantage of a SWITCH statement over an ELSE-IF statement a. A default condition can be used in the SWITCH b. The SWITCH is easier to understand. c. Several different condition can cause one set of statements to be executed in a SWITCH d. Several different statements can be executed in a SWITCH e. None of above The advantage of a SWITCH statement over an ELSE-IF statement a. A default condition can be used in the SWITCH b. The SWITCH is easier to understand. c. Several different condition can cause one set of statements to be executed in a SWITCH d. Several different statements can be executed in a SWITCH e. None of above The comma operator (,) is primarily used in conjunction with a.FOR statement b.IF-ELSE statement c.DO-While statement d. All of above e. None of above The comma operator (,) is primarily used in conjunction with a.FOR statement b.IF-ELSE statement c.DO-While statement d. All of above e. None of above The GOTO statement is used to a. Permit two different expressions to appear in situation where only one expression would ordinarily used b. Terminate loops or to exit from a switch c. Alter the normal sequence or program execution by transferring control to some other part of the program d. Carry out a logical test and then take one of two possible actions, depending upon the outcome of a test e. None of above The GOTO statement is used to a. Permit two different expressions to appear in situation where only one expression would ordinarily used b. Terminate loops or to exit from a switch c. Alter the normal sequence or program execution by transferring control to some other part of the program d. Carry out a logical test and then take one of two possible actions, depending upon the outcome of a test e. None of above The CONTINUE statement is used to a. Permit two different expressions to appear in situation where only one expression would ordinarily be used b. Terminate loops or exit from a switch c. Alter the normal sequence of program execution by transforming control to some other part of the program d. All of above e. None of above The CONTINUE statement is used to a. Permit two different expressions to appear in situation where only one expression would ordinarily be used b. Terminate loops or exit from a switch c. Alter the normal sequence of program execution by transforming control to some other part of the program d. All of above e. None of above The traditional way to create an infinite loop in C is a. FOR ( ; ; )… b. IF (=) BREAK; c. WHILE ()… d. All of above e. None of above The traditional way to create an infinite loop in C is a. FOR ( ; ; )… b. IF (=) BREAK; c. WHILE ()… d. All of above e. None of above