Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

cpp-1

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

What statement to you use to print something to the screen?

a)

cin

b)

cout

c)

if

d)

return

2.

Of the following, which one is a valid variable name?

a)

return

b)

2020ichc

c)

ichc2_020

d)

ichb 2020

3.

Which of the following prompts the user to enter a price?

a)

cin >> "What is the price? ";

b)

cin << "What is the price? ";

c)

cout << "What is the price? ";

d)

cout >> "What is the price? ";

4.

Which one indicates a single-line comment?

a)

**

b)

//

c)

##

d)

?

5.

Comments are required in a program to add explanation about your code without compiling.

a)

True

b)

False

6.

What punctuation character signals the end of each statement?

a)

??

b)

**

c)

;

d)

\\

7.

All variables must be declared before they can be used.

a)

True

b)

False

8.

Which of the following is correct in C ++ for main function?

a)

int main()

{


}

b)

int Main()

{


}

c)

int main

{


}

d)

int MAIN()

{


}

9.

Which of the following statements advances the cursor to the next line on the computer screen?

a)

cout << endl;

b)

cout << endline;

c)

cout << newline;

d)

cout << (\n);

10.

Which is the smallest unit of computer storage?

a)

Byte

b)

Bit

c)

Kilobyte

d)

Megabyte