wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CPP-3

Total questions: 20

Worksheet time: 30mins

Name
Class
Date
1.

iostream

a)

Displays output from the screen and input from the keyboard

b)

Has all the math equations

c)

Counts the time

d)

Checks if the code has a function

2.

cmath

a)

Simple math

b)

Stands for complicated math

c)

Add, subtract, divide, multiply

d)

Timming

3.

What punctuation is used to signal the beginning and end of code blocks?

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

4.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
5.

Which of the following is NOT a comparison operator in C++ language?

a)

>

b)

<=

c)

=

d)

==

6.

Evaluate the following expressions to true or false


5 >= (1+6)-4

a)

True

b)

False

7.

Evaluate the following expressions to true or false

5+1==6 || 8-1>4

a)

True

b)

False

8.

Assume the following code:

int x=5, y=10;

if (x>y){ cout << "ok";}

else {cout << "not ok";}

What is the output?

a)

ok

b)

not ok

c)

x>y

d)

no output at all

9.

What is the output?

a)

not ok

b)

ok

c)

ok

not ok

10.

What is the output?

a)

Congrats, you got an A+

b)

check in With ME.

c)

You got an A-

d)

Check in with me.

11.

What would be the output of the following code:

a)

Spell it out

b)

Comp Prog

c)

Abbreviate both words!

d)

Why would you abbreviate only one of the words?

12.

What is output here:

a)

Big Number

b)

It's a small big number

c)

Big Number

It's a small big number.

d)

What kind of number?

13.

What is the output:

a)

What is wrong with this program?

b)

Nothing.

c)

Everything.

14.

What is the maximum number of else-if statements

a)

As Many as You Need

b)

One

c)

Two

d)

Zero

15.

If originally x=2,y=0, and z=1, what is the value of x, y, and z after executing the following code?


if (x>y)


y=x;

else

z=x;

a)

x=2 y=2 z=1

b)

x=0 y=2 z=0

c)

x=2 y=1 z=1

d)

x=2 y=0 z=1

16.
... point variables store decimal numbers (3.5, -5,123, 4.0, etc). 
a)
Float
b)
Integer
c)
Logical
d)
Character
17.
... variables store whole numbers (-4, 3, 51, etc). 
a)
Float
b)
Logical
c)
Character
d)
Integer
18.

an AND operation with the mask 10101010 is applied to the binary number 01010101.

show the result.

a)

01010101

b)

1111

c)

00000000

d)

11110000

19.

What is the output when the following code fragment is executed?

a)

danger

count = 5

b)

count=5

c)

danger

count=4

d)

count = 4

20.

What is the output when the following code fragment is executed?

a)

Error

b)

n = 3.8

c)

3

d)

n = 3