0% found this document useful (0 votes)
54 views2 pages

C++ Online Test 3

This document contains a quiz on C++ concepts with multiple choice questions. There are questions about C++ concepts like constructors, inheritance, polymorphism, abstract classes, operator precedence, and more. The user is asked to select the correct answer for each question.

Uploaded by

jitesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views2 pages

C++ Online Test 3

This document contains a quiz on C++ concepts with multiple choice questions. There are questions about C++ concepts like constructors, inheritance, polymorphism, abstract classes, operator precedence, and more. The user is asked to select the correct answer for each question.

Uploaded by

jitesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

C++ Online Test 

[email protected] Switch accounts

Draft saved

*Required

 MCQ Question  

All the question are compulsory

 Which of the following is not a type of *


Constructor in C++?

a) Default constructor

b) Parameterized constructor

c) Copy constructor

d) Friend constructor

Predict the output ? *

1) 5 10

2) 5

3) 10

4) Error

What will be the output? *

#include<iostream>
usingnamespacestd;
classtest{
public:
staticintn;
test()f--n;}
~test(){}
};
intmain()
{
testm,n,o,p,9;
cout‹‹test::n;
return0;
}
inttest::n=4;

1. 4

2. 1

3. -1

4. 0

What will be the output? *

1. Default constructor Parametirized


constructor

2.Parametirized constructor Default


constructor

3. Default constructor

4. Error

Which concept allows you to reuse the


written code in C++?

a) Inheritance

b) Polymorphism

c) Abstraction

d) Encapsulation

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 speciIcally used as a base


class with atleast one virtual functions

d) Class speciIcally used as a base


class with atleast one pure virtual
functions

What will be the output? *

1. 500

2. 505

3. 504

4. 501

What will be the output? *

1. 1

2. 0

3. Error

4. 6

What will be the output? *

1.Hello World

2.Hello worlD

3.Complie time error

4.HELLO WORLD

Which of the following approach is used *


by C++?

a) Left-right

b) Right-left

c) Bottom-up

d) Top-down

Operator which is having the Highest *


precedence  is?

1. =

2. ^

3. ()

4. ? :

What will be the output of the following *


C++ program?

a) Outer Catch

b)Inner Catch Outer Catch

c) Error

d) Inner Catch

If the value entered from the keyboard is *


'a' then what will be the output?

1. Your age is: a

2. Complie Time Error

3. Your age is: 65

4.Your age is: 97

By default, all the files in C++ are opened *


in _________ mode.

a) Binary

b) VTC

c) Text

d) ISCII

 Which of the following type is provided *


by C++ but not C ?

1. double

2. ^oat

3. int

4. bool

 What is the difference between delete *


and delete[] in C++?

a) delete is syntactically correct but


delete[] is wrong and hence will give an
error if used in any case

b) delete is used to delete normal


objects whereas delete[] is used to
pointer objects

c) delete is a keyword whereas delete[]


is an identiIer

d) delete is used to delete single object


whereas delete[] is used to
multiple(array/pointer of) objects

What will be the output? *

1. Error

2. 0 2 4 5

3. 0 2 4

4. 1 3 5

What will be the output? *

1. 500

2. 505

3. 504

4. 501

 What is Inheritance in C++ ? *

1. Deriving new classes from existing


classes

2. Overloading of classes

3. Classes with same names

4. Wrapping of data into a single class

What will be the output ? *

1. 1

2. 0

3. True

4. False

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

What will be the output ? *

1. Value of y is :True

2. Value of y is : False

3. Value of y is : 1

4. Value of y is : 0

Which one is False  about variable *


declaration in C++.

1. variable can have alphabets, digits


and underscore.

2. White space is allowed within


variable name.

3. A variable name can start with


alphabet and underscore only. It can't
start with digit.

4. No white space is allowed within


variable name.

Which is more effective while calling the *


C++ functions?

a) call by object

b) call by pointer

c) call by value

d) call by reference

What is the correct output? *

Happy Learning

Learning

earning

Error

Which of the following is not a Keyword *


in C++?

1. continue

2. virtual

3. wchar_t

4. typename

What will be the output of the following *


C++ program?

a) 5

b) 6

c) compile time error

d) runtime error

What will be the output? *

1.Hello World

2.Hello worlD

3.Complie time error

4.HELLO WORLD

What happens if the following C++ *


statement is compiled and executed?      
                                                           int *ptr
= NULL;delete ptr;

a) The program is not semantically


correct

b) The program is compiled and


executed successfully

c) The program gives a compile-time


error

d) The program compiled successfully


but throws an error during run-time

The C++ code which causes abnormal *


termination/behaviour of a program
should be written under _________ block.

a) catch

b) throw

c) try

d) Inally

What will be the output? *

1. 4

2. 1

3. -1

4. 0

 Which of the following is a correct *


identifier in C++?

a) VAR_1234

b) $var_name

c) 7VARNAME

d) 7var_name

What will be the output? *

1. Error

2. 0 2 4 5

3. 0 2 4

4. 1 3 5

What is the correct output? *

Happy Learning

Learning

earning

Error

Predict the output? *


215

512

152

251

 What is virtual inheritance in C++? *

a) C++ technique to enhance multiple


inheritance

b) C++ technique to ensure that a


private member of the base class can
be accessed somehow

c) C++ technique to avoid multiple


inheritances of classes

d) C++ technique to avoid multiple


copies of the base class into
children/derived class

What will be the output? *

Base 1 Base 2 Derived

Derived

Base 2 Derived

Error

What is Inheritance in C++?

a) Deriving new classes from existing


classes

b) Overloading of classes

c) Classes with same names

d) Wrapping of data into a single class

Which of the following is not a Keyword *


in C++?

1. continue

2. virtual

3. wchar_t

4. typename

Which one is False  about variable *


declaration in C++.

1. variable can have alphabets, digits


and underscore.

2. White space is allowed within


variable name.

3. A variable name can start with


alphabet and underscore only. It can't
start with digit.

4. No white space is allowed within


variable name.

Operator which is having the Highest *


precedence  is?

1. =

2. ^

3. ()

4. ? :

If the value entered from the keyboard is *


'a' then what will be the output?

1. Your age is: a

2. Complie Time Error

3. Your age is: 65

4.Your age is: 97

What will be the output ? *

1. 1 object destroyed 2 object


destroyed

2. 2 object destroyed 1 object


destroyed

3. 2 object destroyed 2 object


destroyed

4. 1 object destroyed 1 object


destroyed

Predict the output? *

1. 5

2. 4

3. 6

4. 3

What will be the output ? *

1. via fb

2. via duo

3. Error due to same method name

4. via fb via duo

What will be the output? *

Base 1 Base 2 Derived

Derived

Base 2 Derived

Error

What happens if the following program *


is executed in C and C++?                          
                                     
              int new = 5; printf("%d", new);

a) Error in C and successful execution


in C++

b) Error in both C and C++

c) Error in C++ and successful


execution in C

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

What will be the output of the following


C++ code snippet?

a) 21

b) 27

c) 26

d) 25

What will be the output ? *

1. Width of box : 10

2. Width of box : 10.0

3. Width of box : 20

4. Width of box : 20.0

 What happens if the following program *


is executed in C and C++?

a) Outputs Hello twice in both C and


C++

b) Error in C and successful execution


in C++

c) Error in C++ and successful


execution in C

d) Error in both C and C++

Page 2 of 2

Back Submit Clear form

Never submit passwords through Google Forms.

This content is neither created nor endorsed by Google.


Report Abuse - Terms of Service - Privacy Policy

 Forms

You might also like