wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++ quiz

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Who invinted C++?

a)

Dennis Ritchie

b)

Ken Thompson

c)

Brian Kernighan

d)

Bjarne Stroustrup

2.

Which of the following type is provided by C++ but not C?

a)

double

b)

float

c)

int

d)

bool

3.

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

cout<<"Hello world";

getch();

}

What would be the output for the above program?

a)

Hello World

b)

hello world

c)

Hello world

d)

HELLO WORLD

4.

Which of the following is used to terminate the function declaration in C++?

a)

;

b)

]

c)

)

d)

:

5.

Which of the following is used for comments in C++?

a)

// comment

b)

/* comment */

c)

both // comment or /* comment */

d)

// comment */

6.

What are the actual parameters in C++?

a)

Parameters with which functions are called

b)

Parameters which are used in the definition of a function

c)

Variables other than passed parameters in a function

d)

Variables that are never used in the function

7.

Which of the following is called insertion/put to operator?

a)

<<

b)

>>

c)

>

d)

<

8.

Identify the correct extension of the user-defined header file in C++.

a)

.cpp

b)

.hg

c)

.h

d)

.hf

9.

Which of the following loops is best when we know the number of iterations?

a)

while loop

b)

do while

c)

for loop

d)

all of the above

10.

Identify the scope resolution operator.

a)

!

b)

::

c)

?

d)

none

11.

By which of the following can the if-else statement be replaced?

a)

Bitwise operator

b)

Logical operator

c)

Conditional operator

d)

Arithmetic operator

12.

Identify the correct function from which the execution of C++ program starts?

a)

new()

b)

start()

c)

pow()

d)

main()

13.

 

Identify the size of int datatype in C++.

a)

1 byte

b)

2 bytes

c)

4 bytes

d)

Depends on compiler

14.

Identify the logical AND operator.

a)

||

b)

&&

c)

&

d)

!

15.

 

Data members and member functions of a class are private by.default. True or False?

a)

true

b)

false

c)

depends on code

d)

none