Font size
WorksheetsCSNP-04103 - Chapter 4 - Selection
Total questions: 10
Worksheet time: 5mins
Select all the flow control structures in C++
selection
retrospection
forward
repetition
sequential
What set of characters do you use to create a compound statement (block of code) in C++?
[ ]
( )
{ }
< >
In C++ the else statement part of the if, is it required or optional?.
Required
Optional
Please select from the list below the relational operators.
+ , - , * , /
{ }, [ ], ( )
< , >, <=, >=, ==, !=
?, &, %, $
Please select from the list below the logical operators.
&&, ||, !
==, <=, >= , !=, <, >
{ }, [ ], < >, ( )
None of the above
Is the expression below true or false?.
bool character = ('a' < 'z');
False
True
It is not valid.
Which one is the correct syntax for C++?.
if [ gross > 100000 ] then
net = gross - tax;
if ( gross > 100000 )
net = gross - tax;
if { gross > 100000 } then
net = gross - tax;
if < gross > 100000 > then
net = gross - tax;
If I want to execute multiple statements as part of an if condition, I enclose those statements between:
( )
[ ]
{ }
< >
In C++, Is it possible to have an if statement inside an if statement?.
Yes.
No.
It depends.
In C++ the switch statement is more useful when:
You are using a single variable or simply expression
When you have multiple variables or selection expressions
When you have multiple selection expressions but one variable
When you have multiple variables but one simply expression.
