wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CSNP-04103 - Chapter 4 - Selection

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Select all the flow control structures in C++

a)

selection

b)

retrospection

c)

forward

d)

repetition

e)

sequential

2.

What set of characters do you use to create a compound statement (block of code) in C++?

a)

[ ]

b)

( )

c)

{ }

d)

< >

3.

In C++ the else statement part of the if, is it required or optional?.

a)

Required

b)

Optional

4.

Please select from the list below the relational operators.

a)

+ , - , * , /

b)

{ }, [ ], ( )

c)

< , >, <=, >=, ==, !=

d)

?, &, %, $

5.

Please select from the list below the logical operators.

a)

&&, ||, !

b)

==, <=, >= , !=, <, >

c)

{ }, [ ], < >, ( )

d)

None of the above

6.

Is the expression below true or false?.


bool character = ('a' < 'z');

a)

False

b)

True

c)

It is not valid.

7.

Which one is the correct syntax for C++?.

a)

if [ gross > 100000 ] then

net = gross - tax;

b)

if ( gross > 100000 )

net = gross - tax;

c)

if { gross > 100000 } then

net = gross - tax;

d)

if < gross > 100000 > then

net = gross - tax;

8.

If I want to execute multiple statements as part of an if condition, I enclose those statements between:

a)

( )

b)

[ ]

c)

{ }

d)

< >

9.

In C++, Is it possible to have an if statement inside an if statement?.

a)

Yes.

b)

No.

c)

It depends.

10.

In C++ the switch statement is more useful when:

a)

You are using a single variable or simply expression

b)

When you have multiple variables or selection expressions

c)

When you have multiple selection expressions but one variable

d)

When you have multiple variables but one simply expression.