Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following concepts means waiting until runtime to determine which function to call?

A. Data hiding
B. Dynamic casting
C. Dynamic binding
D. Dynamic loading
Answer» D. Dynamic loading
2.

How "Late binding" is implemented in C++?

A. Using C++ tables
B. Using Virtual tables
C. Using Indexed virtual tables
D. Using polymorphic tables
Answer» C. Using Indexed virtual tables
3.

Which of the following correctly describes overloading of functions?

A. Virtual polymorphism
B. Transient polymorphism
C. Ad-hoc polymorphism
D. Pseudo polymorphism
Answer» D. Pseudo polymorphism
4.

Which of the following approach is adapted by C++?

A. Top-down
B. Bottom-up
C. Right-left
D. Left-right
Answer» C. Right-left
5.

Which of the following is correct about function overloading?

A. The types of arguments are different.
B. The order of argument is different.
C. The number of argument is same.
D. Both A and B.
Answer» E.
6.

Why reference is not same as a pointer?

A. A reference can never be null.
B. A reference once established cannot be changed.
C. Reference doesn't need an explicit dereferencing mechanism.
D. All of the above.
Answer» E.
7.

cout is a/an __________ .

A. operator
B. function
C. object
D. macro
Answer» D. macro
8.

Which of the following concepts provides facility of using object of one class inside another class?

A. Encapsulation
B. Abstraction
C. Composition
D. Inheritance
Answer» D. Inheritance
9.

How many types of polymorphisms are supported by C++?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
10.

Which of the following term is used for a function defined inside a class?

A. Member Variable
B. Member function
C. Class function
D. Classic function
Answer» C. Class function
11.

Which of the following cannot be friend?

A. Function
B. Class
C. Object
D. Operator function
Answer» D. Operator function
12.

Which of the following concepts of OOPS means exposing only necessary information to client?

A. Encapsulation
B. Abstraction
C. Data hiding
D. Data binding
Answer» D. Data binding
13.

Which of the following gets called when an object is being created?

A. constructor
B. virtual function
C. destructor
D. main
Answer» B. virtual function
14.

To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ .

A. destructor
B. delete
C. delete[]
D. kill[]
E. free[]
Answer» D. kill[]
15.

Which of the following statement is correct about constructors?

A. A constructor has a return type.
B. A constructor cannot contain a function call.
C. A constructor has no return type.
D. A constructor has a void return type.
Answer» D. A constructor has a void return type.
16.

How many instances of an abstract class can be created?

A. 1
B. 5
C. 13
D. 0
Answer» E.
17.

Which of the following concept of oops allows compiler to insert arguments in a function call if it is not specified?

A. Call by value
B. Call by reference
C. Default arguments
D. Call by pointer
Answer» D. Call by pointer
18.

Which of the following statement is correct whenever an object goes out of scope?

A. The default constructor of the object is called.
B. The parameterized destructor is called.
C. The default destructor of the object is called.
D. None of the above.
Answer» D. None of the above.
19.

If the programmer does not explicitly provide a destructor, then which of the following creates an empty destructor?

A. Preprocessor
B. Compiler
C. Linker
D. <i class="cpp-code">main()</i>
E. function
Answer» C. Linker
20.

It is a __________ error to pass arguments to a destructor.

A. logical
B. virtual
C. syntax
D. linker
Answer» D. linker
21.

A class's __________ is called when an object is destroyed.

A. constructor
B. destructor
C. assignment function
D. copy constructor
Answer» C. assignment function
22.

Destructors __________ for automatic objects if the program terminates with a call to function exit or function abort.

A. are called
B. are inherited
C. are not called
D. are created
Answer» D. are created
23.

How many times a constructor is called in the life-time of an object?

A. Only once
B. Twice
C. Thrice
D. Depends on the way of creation of object
Answer» B. Twice
24.

Which of the following is an abstract data type?

A. int
B. double
C. string
D. Class
Answer» E.
25.

A __________ is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.

A. default constructor
B. copy constructor
C. Both A and B
D. None of these
Answer» B. copy constructor
26.

Constructors __________ to allow different approaches of object construction.

A. cannot overloaded
B. can be overloaded
C. can be called
D. can be nested
Answer» C. can be called
27.

How many default constructors per class are possible?

A. Only one
B. Two
C. Three
D. Unlimited
Answer» B. Two
28.

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().
Answer» D. A destructors return type is always same as that of main().
29.

Which of the following cannot be declared as virtual?

A. Constructor
B. Destructor
C. Data Members
D. Both A and C
Answer» E.
30.

If the copy constructor receives its arguments by value, the copy constructor would

A. call one-argument constructor of the class
B. work without any problem
C. call itself recursively
D. call zero-argument constructor
Answer» D. call zero-argument constructor
31.

Which of the following are NOT provided by the compiler by default?

A. Zero-argument Constructor
B. Destructor
C. Copy Constructor
D. Copy Destructor
Answer» E.
32.

A function with the same name as the class, but preceded with a tilde character (~) is called __________ of that class.

A. constructor
B. destructor
C. function
D. object
Answer» C. function
33.

A union that has no constructor can be initialized with another union of __________ type.

A. different
B. same
C. virtual
D. class
Answer» C. virtual
34.

Which of the following gets called when an object goes out of scope?

A. constructor
B. destructor
C. main
D. virtual function
Answer» C. main
35.

Where the default value of parameter have to be specified?

A. Function call
B. Function definition
C. Function prototype
D. Both B or C
Answer» D. Both B or C
36.

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
Answer» D. Both B and C
37.

Which of the following function declaration is/are incorrect?

A. <i class="cpp-code">int Sum(int a, int b = 2, int c = 3);</i>
B. <i class="cpp-code">int Sum(int a = 5, int b);</i>
C. <i class="cpp-code">int Sum(int a = 0, int b, int c = 3);</i>
D. Both B and C are incorrect.
E. All are correct.
Answer» E. All are correct.
38.

Which of the following can be overloaded?

A. Object
B. Functions
C. Operators
D. Both B and C
Answer» E.
39.

How many objects can be created from an abstract class?

A. Zero
B. One
C. Two
D. As many as we want
Answer» B. One
40.

What does the class definitions in following code represent? class Bike { Engine objEng; }; class Engine { float CC; };

A. kind of relationship
B. has a relationship
C. Inheritance
D. Both A and B
Answer» C. Inheritance
41.

Which of the following statements is correct when a class is inherited privately?

A. Public members of the base class become protected members of derived class.
B. Public members of the base class become private members of derived class.
C. Private members of the base class become private members of derived class.
D. Public members of the base class become public members of derived class.
Answer» C. Private members of the base class become private members of derived class.
42.

What does a class hierarchy depict?

A. It shows the relationships between the classes in the form of an organization chart.
B. It describes "has a" relationships.
C. It describes "kind of" relationships.
D. It shows the same relationship as a family tree.
Answer» D. It shows the same relationship as a family tree.
43.

__________ used to make a copy of one class object from another class object of the same class type.

A. constructor
B. copy constructor
C. destructor
D. default constructor
Answer» C. destructor
44.

Which of the following statements are correct for a static member function? It can access only other static members of its class. It can be called using the class name, instead of objects.

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

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
Answer» D. Abstraction
46.

Which of the following is the only technical difference between structures and classes in C++?

A. Member function and data are by default protected in structures but private in classes.
B. Member function and data are by default private in structures but public in classes.
C. Member function and data are by default public in structures but private in classes.
D. Member function and data are by default public in structures but protected in classes.
Answer» D. Member function and data are by default public in structures but protected in classes.
47.

Which of the following statements is correct about the program given below? class Bix { public: static void MyFunction(); }; int main() { void(*ptr)() = &amp;Bix::MyFunction; return 0; }

A. The program reports an error as pointer to member function cannot be defined outside the definition of class.
B. The program reports an error as pointer to static member function cannot be defined.
C. The program reports an error as pointer to member function cannot be defined without object.
D. The program reports linker error.
Answer» E.
48.

Which of the following function / types of function cannot have default parameters?

A. Member function of class
B. <i class="cpp-code">main()</i>
C. Member function of structure
D. Both B and C
Answer» C. Member function of structure
49.

Which of the following implicitly creates a default constructor when the programmer does not explicitly define at least one constructor for a class?

A. Preprocessor
B. Linker
C. Loader
D. Compiler
Answer» E.
50.

A destructor takes __________ arguments.

A. one
B. two
C. three
D. no
Answer» E.