wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++ Assesment 1

Total questions: 20

Worksheet time: 12mins

Name
Class
Date
1.

A protected member of the class in accessible in

a)

Only same class

b)

Same class and derived class

c)

Outside the class

2.

A virtual function is declared by placing the key word ___ in front of the return type in the base class’s function declaration

a)

virtual

b)

private

c)

public

d)

class

3.

What is the syntax of inheritance of class?

a)

class name

b)

class name : access specifer

c)

class name : access specifer class name

4.

What are mandatory parts in function declaration?

a)

return type,function name

b)

return type,function name,parameters

c)

both a and b

5.
a)

10

b)

20

c)

10,10

6.

When will we use the function overloading?

a)

different function name but same number of arguments

b)

same function name but different number of arguments

c)

same function name but same number of arguments

d)

different function name but different number of arguments

7.

Which of the following explains Polymorphism?

a)

int func(int, int);

float func1(float, float);

b)

int func(int);

int func(int);

c)

int func(float);

float func(int, int, char);

8.
a)

5

b)

55

c)

10

9.

Which of the following operator cannot be overloaded?

a)

+

b)

? :

c)

-

d)

%

10.

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

11.

Which of the following is called address operator?

a)

*

b)

&

c)

>>

d)

( )

12.

Destructor are automatically called by the compiler when the object goes out of scope.

a)

True

b)

False

13.

Which of the following provides a reusable mechanism?

a)

Abstraction

b)

Dynamic binding

c)

Inheritance

d)

Encapsulation

14.

Which feature allows you to create a Derived class that inherits properties from more than one Base class?

a)

Multilevel Inheritance

b)

Multiple Inheritance

c)

Hierarchical Inheritance

d)

Hybrid Inheritance

15.

What will be the output of following code ?

a)

error

b)

10

c)

20

16.

________is defined as user defined data type and it also contains functions in it ?

a)

Object

b)

Class

c)

Data members

17.

What is the output ?

firstStr - Programming is fun

a)

Programming is fun

b)

Programming

c)

Programmingisfun

18.

What will be the output?

a)

Value of a:100

Value of b:200

b)

Value of a:200

Value of b:100

c)

Value of a:200

Value of b:200

19.

The constant variable can be declared using (a)   keyword.

20.

What are the two Methods of calling functions in C++ program.

(a)