wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++ Mini Quiz

Total questions: 22

Worksheet time: 14mins

Name
Class
Date
1.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
2.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

3.

What is the only function all C++ programs must contain?

a)

start()

b)

system()

c)

main()

d)

program()

4.

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

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

5.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

6.
A list of instructions that enable a computer to perform a specific task is a...
a)
Computer Program
b)
Algorithm
c)
Machine Code
d)
Binary Code
7.
Which command moves the shown text to the next line?
a)
\t
b)
\n
c)
\r
d)
\s
8.
After running the following code, what will be the value of x?
y = 3;
x = 5 * y;
a)
3
b)
5
c)
15
d)
0
9.
A programmer is:
a)
person who writes code and communicates instructions to a computer
b)
person who types
c)
person who studies computers
d)
error or mistake in your code
10.
What is the output of this program?
Program
int main()
{
cout<<"Hi everybody";
return 0;
}
a)
"Hi everybody"
b)
Hi everybody"
c)
Hi everybody
d)
"Hi everybody
11.
... variables store whole numbers (-4, 3, 51, etc). 
a)
Float
b)
Logical
c)
Character
d)
Integer
12.
... point variables store decimal numbers (3.5, -5,123, 4.0, etc). 
a)
Float
b)
Integer
c)
Logical
d)
Character
13.

I have a variable int a = 2;


then a variable int& b = a;


What happens if I change the value of b

a)

Nothing

b)

a changes as well

c)

b gets bigger

d)

a disappears

14.

True or False. This code will output 0


cout<< 23 % 2 <<endl;

a)

True

b)

False

15.

True or False. This code will output 1


cout<< 55 % 2 <<endl;

a)

True

b)

False

16.

Fill in the blank to get 0 outputted from this code:


int main() {


cout<< 12 ___ 12 <<endl;


}

a)

-

b)

+

c)

==

d)

%

17.

Fill in the blank to get 0 outputted from this code:


int main() {


cout<< 12 ___ 3 <<endl;


}

a)

-

b)

+

c)

==

d)

%

18.

Fill in the blank to get 0 outputted from this code:


int main() {


cout<< 0 ___ 3 <<endl;


}

a)

-

b)

/

c)

==

d)

+

19.

What is the correct value to return to the operating system upon the successful completion of a program?

a)

A. -1

b)

B. 1

c)

C. 0

d)

D. Program do not return a value.

20.

What punctuation ends most lines of C++ code?

a)

A. .

b)

B. ;

c)

C. :

d)

D. '

21.

The escape sequence \n when output with cost, causes the cursor to position

a)

A. Next blank space on the same line

b)

B. Beginning of the same line on the screen

c)

C. End of the same line on the screen

d)

D. Beginning of the next line on the screen

22.

Fill in the blank to get 0 outputted from this code:


int main() {


cout<< 12 ___ 3 <<endl;


}

a)

-

b)

+

c)

==

d)

%