wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

X-Tech Riot (2)

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following symbol is used to declare the preprocessor directives in C++?

a)

$

b)

^

c)

#

d)

*

2.

What is meant by a polymorphism in C++?

a)

class having only single form

b)

class having four forms

c)

class having many forms

d)

class having two forms

3.

Which keyword is used to define the macros in c++?

a)

#macro

b)

#define

c)

macro

d)

define

4.

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

a)

:

b)

;

c)

//

d)

/>

5.

What will be the output of the following C code snippet?

a)

returns 1

b)

returns 2

c)

Varies

d)

Compile time error

6.

How many times i value is checked in the following C program?

a)

1

b)

3

c)

4

d)

5

7.

What are the elements present in the array of the following C code?

int array[5] = {5};

a)

5, (garbage), (garbage), (garbage), (garbage)

b)

5,5,5,5,5

c)

0,0,0,0,5

d)

5,0,0,0,0

8.

Comment on the output of following C code.

a)

It will print a

b)

It will print 0

c)

Compile time error

d)

Run time error

9.

What will be the output of the following C++ code?

a)

Hello

b)

World

c)

Error

d)

Hello World

10.

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

a)

array{10};

b)

array array[10];

c)

int array;

d)

int array[10];

11.

What will be the output of the following C++ code?

a)

Segmentation fault

b)

Nothing is printed

c)

Error

d)

cin: garbage value

12.

What is abstract class in C++?

a)

Any Class in C++ is an abstract class

b)

Class from which any class is derived

c)

Class specifically used as a base class with atleast one virtual functions

d)

Class specifically used as a base class with atleast one pure virtual functions

13.

Which concept allows you to reuse the written code in C++?

a)

Inheritance

b)

Polymorphism

c)

Abstraction

d)

Encapsulation

14.

What is the benefit of c++ input and output over c input and output?

a)

Both Type safety & Exception

b)

Sequence container

c)

Exception

d)

Type safety

15.

What will be the output of the following C++ code snippet?

a)

21

b)

27

c)

25

d)

26

16.

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

a)

Error in both C and C++

b)

Successful run in both C and C++

c)

Error in C and successful execution in C++

d)

Error in C++ and successful execution in C

17.

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

a)

Error in both C and C++

b)

Outputs Hello twice in both C and C++

c)

Error in C and Outputs Hello twice in C++

d)

Error in C++ and Outputs Hello twice in C

18.

Which of the following feature is not provided by C?

a)

Pointers

b)

Structures

c)

References

d)

Functions

19.

what will be the output of he following c++ code

a)

2035645065

b)

2035655065

c)

2035655035

d)

2035635065

20.

what will be the output of the following c++ code?

a)

10

b)

30

c)

compile time error

d)

20