Friday, 1 September 2017

C++ Question

Download C++ Questions




Which of the following type of class allows only one object of it to be created?


Virtual class
Abstract class
Singleton class
Friend class


3


```````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is not a type of constructor?


Copy constructor
Copy constructor
Default constructor
Parameterized constructor


2


````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct?


Base class pointer cannot point to derived class.
Derived class pointer cannot point to base class.
Pointer to derived class cannot be created.
Pointer to base class cannot be created.


2


``````````````````````````````````````````````````````````````````````````````````````````````````````````````


Which of the following is not the member of class?


Static function
Friend function
Const function
Virtual function


2
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following concepts means determining at runtime what method to invoke?


Data hiding
Dynamic Typing
Dynamic binding
Dynamic loading


3
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is incorrect?


Friend keyword can be used in the class to allow access to another class.
Friend keyword can be used for a function in the public section of a class.
Friend keyword can be used for a function in the private section of a class.
Friend keyword can be used on main().


4
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statement is correct regarding destructor of base class?   


Destructor of base class should always be static.
Destructor of base class should always be virtual.
Destructor of base class should not be virtual.
Destructor of base class should always be private.


2
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following two entities (reading from Left to Right) can be connected by the dot operator?


A class member and a class object.
A class object and a class.
A class and a member of that class.
A class object and a member of that class.


4
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
How can we make a class abstract?


By making all member functions constant.
By making at least one member function as pure virtual function.
By declaring it abstract using the static keyword.
By declaring it abstract using the virtual keyword.


4


````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````


Which of the following statement is correct?


C++ enables to define functions that take constants as an argument.
We cannot change the argument of the function that that are declared as constant.
Both A and B.
We cannot use the constant while defining the function.


3


``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statement is correct?


Overloaded functions can have at most one default argument.
An overloaded function cannot have default argument.
Overloaded function must have default arguments starting from the left of argument list.
A function if overloaded more than once cannot have default argument


3


````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````


Which of the following statement is correct?


Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument.
Overloaded function must have default arguments.
Overloaded function must have default arguments starting from the left of argument list.
A function can be overloaded more than once.


4
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statement will be correct if the function has three arguments passed to it?


The trailing argument will be the default argument.
The first argument will be the default argument.
The middle argument will be the default argument.
All the argument will be the default argument.


1
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
A constructor that accepts __________ parameters is called the default constructor.


one
two
no
three


`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?


Compile-time error.
Runtime error.
Runtime error.
Preprocessing error.


1
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Destructor has the same name as the constructor and it is preceded by ______


!
?
`
$


3
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
For automatic objects, constructors and destructors are called each time the objects


enter and leave scope
inherit parent class
are constructed
are destroyed


1
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````


Which of the following statement is correct?


A reference is stored on heap
A reference is stored on stack
A reference is stored in a queue.
A reference is stored in a binary tree.


2
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````


Which of the following statement is correct about the references?


A reference must always be initialized within functions.
A reference must always be initialized outside all functions.
A reference must always be initialized.
Both A and C


3


``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````


A reference is declared using the _____ symbol.




&&
&
||
!


2


``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````


Which of the following statement is correct?


Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
A reference is indicated by using && operator.
Once a reference variable has been defined to refer to a particular variable it cannot refer to any other variable.
A reference can be declared beforehand and initialized later.


3


```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statement is correct?


A referenced has to be de-referenced to access a value
A referenced does not need to be de-referenced to access a value
A referenced has to be double de-referenced to access a value
Whether a reference should be de-referenced or not depends on the type of the reference


2


```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````


Reference is like a _____.


Pointer
Structure
Macro
Enum


1


```````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statement is correct?


A reference is a constant pointer.
A reference is not a constant pointer.
An array of references is acceptable.
It is possible to create a reference to a reference.


1


````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statement is correct?


A reference is declared using * operator.
Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
A reference must always be initialized within classes.
A variable can have multiple references.


4


````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````


Which of the following statement is correct?


An array of references is acceptable.
Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
An array of references is not acceptable.
Reference is like a structure.


3

No comments:

Post a Comment

Code

<html> <head> <title>Implimentation</title> <script type="text/javascript"> fu...