Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++ Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

1.Who invented C++?

a)

a) Dennis Ritchie

b)

b) Ken Thompson

c)

c) Brian Kernighan

d)

d) Bjarne Stroustrup

2.

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

a)

a) /* comment /

b)

b) // comment /

c)

c) // comment

d)

d) both // comment or /* comment */

3.

3.Which of the following is a correct identifier in C++

a)

a) VAR_1234

b)

b) $var_name

c)

c) 7VARNAME

d)

d) 7var_name

4.

4.What happens if the following program is executed in C and C++?

#include <stdio.h>

int main(void){

int new = 5;

printf("%d", new); }

a)

a) Error in C and successful execution in C++

b)

b) Error in both C and C++

c)

c) Error in C++ and successful execution in C

d)

d) A successful run in both C and C++

5.

5.Which of the following correctly declares an array in C++?

a)

a) array{10};

b)

b) array array[10];

c)

c) int array;

d)

d) int array[10];

6.

6.What is the size of wchar_t in C++?

a)

a) Based on the number of bits in the system

b)

b) 2 or 4

c)

c) 4

d)

d) 2

7.

7. Which is more effective while calling the C++ functions?

a)

a) call by object

b)

b) call by pointer

c)

c) call by value

d)

d) call by reference

8.

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

a)

a) ;

b)

b) ]

c)

c) )

d)

d) :

9.

9. Which keyword is used to define the macros in c+

a)

a) #macro

b)

b) #define

c)

c) macro

d)

d) define

10.

10. What is Inheritance in C++?

a)

a) Deriving new classes from existing classes

b)

b) Overloading of classes

c)

c) Classes with same names

d)

d) Wrapping of data into a single class