wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++

Total questions: 25

Worksheet time: 22mins

Name
Class
Date
1.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
2.

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

a)

start()

b)

system()

c)

main()

d)

program()

3.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

4.

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

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

5.

When a class is derived from a base class it gets access to:

a)

Private

b)

Protected

c)

Private and Protected

d)

Protected and Public

e)

Private, Protected and Public

6.

In a class the access specifiers are _______ by default:

a)

Private

b)

Protected

c)

Public

7.

When a class becomes a friend of another class they are additionally getting access to:

a)

Private

b)

Protected

c)

Public

d)

None of the above

8.

There can only be one catch block in a program

a)

True

b)

False

9.
a)

I only

b)

II only

c)

III only

d)

I and II only

e)

II and II only

10.

When class B is inherited from class A, what is the order in which the destructors are called.

a)

Class A first Class B next

b)

Class B first Class A next

c)

Class B's only as it is the child class

d)

Class A's only as it is the parent class

11.

The compiler creates an instance of a function template in memory as soon as it encounters the template.

a)

True

b)

False

12.

There can only be one catch block in a program

a)

True

b)

False

13.
What punctuation is used to indicate the beginning and end of code blocks?
a)
{ }
b)
-> <-
c)
BEGIN and END
d)
( and )
14.

Reg No in full

4 lines
15.

C programs are converted into machine language with the help of

a)

An Editor

b)

A compiler

c)

An operating system

d)

None of these.

16.

The continue statment cannot be used with

a)

for

b)

while

c)

do while

d)

switch

17.

In the following loop construct, which one is executed only once always.

for(exp1; exp2; exp3)

a)

exp1

b)

exp3

c)

exp1 and exp3

d)

exp1,exp2 and exp3

18.

Choose a correct C do while syntax.

a)

dowhile(condition) { //statements }

b)

do while(condition) { //statements }

c)

do { //statements }while(condition)

d)

do { //statements }while(condition);

19.

What is the way to suddenly come out of or Quit any Loop in C Language.?

a)

continue; statement

b)

break; statement

c)

leave; statement

d)

quit; statement

20.

Loops in C Language are implemented using.?

a)

While Block

b)

For Block

c)

Do While Block

d)

All the above

21.

Choose a right C Statement.

a)

Loops or Repetition block executes a group of statements repeatedly.

b)

Loop is usually executed as long as a condition is met.

c)

Loops usually take advantage of Loop Counter

d)

All the above.

22.
Integer, float, boolean and char are ...
a)
types of operators
b)
types of functions
c)
types of variables
d)
types of programming languages
23.
a)

Inside try

Exception Caught

After throw

After catch

b)

Inside try

Exception Caught

After catch

c)

Inside try

Exception Caught

d)

Inside try

After throw

After catch

24.
a)

Compile Error

b)

Inside Fun1()

c)

Inside Fun2()

d)

Inside Fun1() Inside Fun2()

e)

Inside Fun2() Inside Fun1()

25.
a)

0

b)

1

c)

2

d)

3

e)

There are two count variables. Not enough info