Online C++ Programming Test - C++ Programming Test 3



Loading...  Loading Test...

Instruction:

  • This is a FREE online test. DO NOT pay money to anyone to attend this test.
  • Total number of questions : 20.
  • Time alloted : 30 minutes.
  • Each question carry 1 mark, no negative marks.
  • DO NOT refresh the page.
  • All the best :-).


1.

Which of the following factors supports the statement that reusability is a desirable feature of a language?

A.
It decreases the testing time.
B.
It lowers the maintenance cost.
C.
It reduces the compilation time.
D.
Both A and B.

Your Answer: Option (Not Answered)

Correct Answer: Option D

Learn more problems on : OOPS Concepts

Discuss about this problem : Discuss in Forum


2.

Which of the following is a mechanism of static polymorphism?

A.
Operator overloading
B.
Function overloading
C.
Templates
D.
All of the above

Your Answer: Option (Not Answered)

Correct Answer: Option D

Learn more problems on : OOPS Concepts

Discuss about this problem : Discuss in Forum


3.

What happens if the base and derived class contains definition of a function with same prototype?

A.
Compiler reports an error on compilation.
B.
Only base class function will get called irrespective of object.
C.
Only derived class function will get called irrespective of object.
D.
Base class object will call base class function and derived class object will call derived class function.

Your Answer: Option (Not Answered)

Correct Answer: Option D

Learn more problems on : OOPS Concepts

Discuss about this problem : Discuss in Forum


4.

Which of the following is not a type of inheritance?

A.
Multiple
B.
Multilevel
C.
Distributive
D.
Hierarchical

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : OOPS Concepts

Discuss about this problem : Discuss in Forum


5.

Which of the following keyword is used to overload an operator?

A.
overload
B.
operator
C.
friend
D.
override

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : OOPS Concepts

Discuss about this problem : Discuss in Forum


6.

Which of the following statement is correct?

A.
Class is an instance of object.
B.
Object is an instance of a class.
C.
Class is an instance of data type.
D.
Object is an instance of data type.

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : OOPS Concepts

Discuss about this problem : Discuss in Forum


7.

Which of the following function / type of function cannot be overloaded?

A.
Member function
B.
Static function
C.
Virtual function
D.
Both B and C

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Functions

Discuss about this problem : Discuss in Forum


8.

Which of the following statement is incorrect?

A.
The default value for an argument can be a global constant.
B.
The default arguments are given in the function prototype.
C.
Compiler uses the prototype information to build a call, not the function definition.
D.
The default arguments are given in the function prototype and should be repeated in the function definition.

Your Answer: Option (Not Answered)

Correct Answer: Option D

Learn more problems on : Functions

Discuss about this problem : Discuss in Forum


9.

What will be the output of the following program?

#include<iostream.h>
int BixFunction(int a, int b = 3, int c = 3)
{
    cout<< ++a * ++b * --c ; 
    return 0;
}
int main()
{
    BixFunction(5, 0, 0); 
    return 0;
}

A.
8
B.
6
C.
-6
D.
-8

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Functions

Discuss about this problem : Discuss in Forum


10.

What will be the output of the following program?

#include<iostream.h> 
struct MyData
{
    public:
    int Addition(int a, int b = 10)
    {
        return (a *= b + 2);
    }
    float Addition(int a, float b);
};
int main()
{
    MyData data;
    cout<<data.Addition(1)<<" ";
    cout<<data.Addition(3, 4);
    return 0; 
}

A.
12 12
B.
12 18
C.
3 14
D.
18 12
E.
Compilation fails.

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Functions

Discuss about this problem : Discuss in Forum


11.

Which of the following statements is correct?

  1. Once the variable and the reference are linked they are tied together.
  2. Once the reference of a variable is declared another reference of that variable is not allowed.

A.
Only 1 is correct.
B.
Only 2 is correct.
C.
Both 1 and 2 are correct.
D.
Both 1 and 2 are incorrect.

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : References

Discuss about this problem : Discuss in Forum


12.

Which of the following statement is correct?

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

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : References

Discuss about this problem : Discuss in Forum


13.

Which of the following statement is correct?

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

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : References

Discuss about this problem : Discuss in Forum


14.

Which of the following statement is correct with respect to the use of friend keyword inside a class?

A.
A private data member can be declared as a friend.
B.
A class may be declared as a friend.
C.
An object may be declared as a friend.
D.
We can use friend keyword as a class name.

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Objects and Classes

Discuss about this problem : Discuss in Forum


15.

Which of the following statements is correct?

A.
Data items in a class must be private.
B.
Both data and functions can be either private or public.
C.
Member functions of a class must be private.
D.
Constructor of a class cannot be private.

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Objects and Classes

Discuss about this problem : Discuss in Forum


16.

Which of the following means "The use of an object of one class in definition of another class"?

A.
Encapsulation
B.
Inheritance
C.
Composition
D.
Abstraction

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Objects and Classes

Discuss about this problem : Discuss in Forum


17.

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

A.
!
B.
?
C.
~
D.
$

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Constructors and Destructors

Discuss about this problem : Discuss in Forum


18.

When are the Global objects destroyed?

A.
When the control comes out of the block in which they are being used.
B.
When the program terminates.
C.
When the control comes out of the function in which they are being used.
D.
As soon as local objects die.

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Constructors and Destructors

Discuss about this problem : Discuss in Forum


19.

How many default constructors per class are possible?

A.
Only one
B.
Two
C.
Three
D.
Unlimited

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Constructors and Destructors

Discuss about this problem : Discuss in Forum


20.

Which of the following statement is correct about destructors?

A.
A destructor has void return type.
B.
A destructor has integer return type.
C.
A destructor has no return type.
D.
A destructors return type is always same as that of main().

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Constructors and Destructors

Discuss about this problem : Discuss in Forum


Submit your test now to view the Results and Statistics with answer explanation.