Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++ Basics

Total questions: 12

Worksheet time: 10mins

Name
Class
Date
1.

What is the type of the temp variable?

var temp = 14.55;

a)

Double

b)

Boolean

c)

Integer

d)

String

2.

Fill in the blank to make the variable num a constant.


_______int num=2;

a)

con

b)

constant

c)

const

d)

constans

3.

What is the output of this code?

int x = 16;

int y = 5;

cout<<(x/y);

a)

3.2

b)

3

c)

error

d)

4

4.

Which operator is used to determine the remainder?

a)

*

b)

%

c)

+

d)

-

5.

What is the alternative for x = x + 5?

a)

x += 5;

b)

x -= 4;

c)

x = y + 5;

d)

x=+5

6.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

7.

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

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

8.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

9.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
10.
Which command moves the shown text to the next line?
a)
\t
b)
\n
c)
\r
d)
\s
11.

Evaluate the following expressions to true or false


3!=4-1

a)

true

b)

False

12.

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