wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming C++

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

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.

2.

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

a)

A.start()

b)

B.system()

c)

C.main()

d)

D.program()

3.

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

a)

A. { }

b)

B. -> and <-

c)

C. BEGIN and END

d)

D. (and)

4.

What punctuation ends most lines of C++ code?

a)

A. .

b)

B. ;

c)

C. :

d)

D. '

5.

Which of the following is a correct comment?

a)

A. */ Comments */

b)

B. ** Comments **

c)

C./* Comments */

d)

D. { Comment }

6.

Which of the following are false about Comments used in C++?

a)

A. Used to documents programs

b)

B. Improve the readability and understanding of programmer

c)

C. Causes action to be performed when the program is executed

d)

D. None of the above

7.

Which of the following is not a correct variable type?

a)

A. float

b)

B. real

c)

C. int

d)

D. double

8.

Which if the following is the correct operator to compare two variables?

a)

A.:=

b)

B: =

c)

C. equal

d)

D.==

9.

The following naming conventions are valid for C++, except:

a)

A. hello123

b)

B. _123hello

c)

C. _

d)

D. 123 hello

10.

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