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.

C++: A collection of generic class and function is called as

A. Standard Template Library (STL)
B. Header file
C. Function template.
D. None of the above.
Answer» B. Header file
2.

Which of the following is the correct way of declaring an array?

A. array(5)
B. int array[10]
C. int array{5}
D. array{10}
Answer» C. int array{5}
3.

By using what from the following can we define member function outside the class?

A. Using structures
B. Using pointers
C. Using union
D. Using scope resolution
Answer» E.
4.

What does operator overloading mean?

A. making new c++ operators
B. giving new meaning to existing c++ operators
C. giving c++ more than what they can handle
D. making c++ work with objects
Answer» C. giving c++ more than what they can handle
5.

Explain the concept of data hiding

A. It is related with the data types
B. It is related to the classes
C. It is related with hiding internal object details
D. It is related with showing internal object details
Answer» D. It is related with showing internal object details
6.

Predict the output for the following program#include< iostream>using namesp std; class B1 { public: B1() { cout

A. B1's constructor called,B2's constructor called
B. B2's constructor called,Derived constructor called
C. B1's constructor called,B2's constructor called,Derived constructor called
D. Compiler error
Answer» D. Compiler error
7.

Which of the following are essential features of an object oriented programming language?1. Abstraction and encapsulation.2. Strictly-typed3. Type-safe property coupled with sub-type rule.4. Polymorphism in the presence of inheritance.

A. 1 and 2
B. 1 and 4
C. 1, 2, and 4
D. 1, 3 and 4
Answer» C. 1, 2, and 4
8.

Match the following List-1 with List-2List-1 - - - - - - - - - - - - - - - - - - - - - - - - List-2P. Functional - - - - - - - - - - - - - - - - - - 1.Command-based, procedural.Q. Logic - - - - - - - - - - - - - - - - - - - - - - 2.Imperative, abstract data types.R. Object oriented - - - - - - - - - - - - - - - 3.Side effect free, declarative, expression evaluation.S. Imperative - - - - - - - - - - - - - - - - - - -4.Declarative, clausal representation, theorem proving.

A. P-2, Q-3, R-4, S-1
B. P-4, Q-3, R-2, S-1
C. P-3, Q-4, R-1, S-2
D. P-3, Q-4, R-2, S-1
Answer» E.
9.

Trace the output.#include< iostream.h># define SQUARE(x) x*x inline float square(float y) { return y*y; } int main( ){float a = 0.5, b = 0.5, c, d; c = SQUARE(++a);d = square(++b);cout

A. 6.25, 2.25
B. 2.25, 2.25
C. Compile time error.
D. None of the above.
Answer» B. 2.25, 2.25
10.

C++ : Which of the following statement is correct?

A. Constructor has same name as its class name.
B. A constructor is called at the time of object creation.
C. Default constructor has no parameter.
D. All of the above.
Answer» E.
11.

Which is the implementation of the swap function?1.void swap (int a, int b) { int temp; temp = a; a = b; b = temp; } int main () { int i = 0, j = 1; swap (i, j); } 2.void swap (int&a, int&b) { int temp; temp = a; a = b; b = temp; } int main () { int i = 0, j = 1; swap (i, j); } 3.void swap (int *a, int *b) { int *temp; temp = a; a = b; b = temp; } int main () { int i = 0, j = 1; swap (&i, &j); }

A. 3 Only
B. 2 Only
C. 2 and 3 only
D. None of the above.
Answer» C. 2 and 3 only
12.

Trace the outputenumcolour {green, red, blue=10, white, yellow, pink};int main(){cout

A. 10, 11, 12, 13
B. 8, 9, 10, 11, 12, 13
C. 0, 1, 10, 11, 12, 13
D. None of the above
Answer» D. None of the above
13.

In C++, dynamic memory allocation is achieved with the operator

A. new
B. this
C. malloc( )
D. calloc()
Answer» B. this
14.

C++ : There is two types of polymorphism, Compile time and Runtime polymorphism. Runtime polymorphism can be achieved through.

A. function overloading
B. virtual function
C. operator overloading
D. None of the above.
Answer» C. operator overloading
15.

How many arguments are in copy constructor?

A. No argument
B. Any number of arguments.
C. One argument
D. None of the above.
Answer» D. None of the above.
16.

C++ : Trace the output.class base { private: int x;protected: int y; public:base(){x=10;y=20;}}; class derived : public base { protected: int a, b; void change( ) { a=x; b=y; cout

A. 10 20
B. Run time error.
C. Compile time error.
D. None of the above
Answer» D. None of the above
17.

void main() { float x=5,y=2; int result; result=x % y; cout

A. 1
B. 2.5
C. 1.0
D. Error
Answer» E.
18.

C++: What will be the result of the expression 13 & 25?

A. 12
B. 25
C. 9
D. 0
Answer» D. 0
19.

If a process supposes that Pi is executing in its critical section, then no other processes can be executing in their critical sections. This situation is called as

A. race condition.
B. mutual exclusion
C. Critical section
D. None of the above.
Answer» C. Critical section
20.

C++: Which of the following can not be used as identifiers?

A. Lettersscope resolution operator in c++
B. Digits
C. Underscores
D. Spaces
Answer» E.
21.

C++: Overloading the function operator

A. Requires a class with an overloaded operator.
B. Requires a class with an overloaded [ ] operator.
C. Allows you to create objects that act syntactically like functions.
D. Usually make use of a constructor that takes arguments.
Answer» B. Requires a class with an overloaded [ ] operator.
22.

C++: What does C++ append to the end of a string literal constant?

A. a space
B. a number sign (#)
C. an asterisk (*)
D. a null character
Answer» E.
23.

C++: RunTime Polymorphism is achieved by ______

A. Friend function
B. Virtual function
C. Operator overloading
D. Function overloading
Answer» C. Operator overloading
24.

C++: Scope resolution operator is used______

A. To resolve the scope of global variables only
B. To resolve the scope of functions of the classes only
C. To resolve scope of global variables as well as functions of the classes
D. None of these
Answer» D. None of these
25.

C++: Choose the correct statement.

A. Constructor cannot be inherited.
B. Destructor cannot be inherited.
C. Constructor cannot be called explicitly.
D. All of the above.
Answer» E.
26.

C++: Which of the following is not post increment?

A. x++
B. ++x
C. x=x+1;
D. x+=1
Answer» C. x=x+1;
27.

C++: Which of the following keywords allows the method resolution at run time?

A. abstract
B. override
C. virtual
D. None of the above.
Answer» E.
28.

In C++ which operator cannot be overloaded?

A. :: (Scope resolution operator)
B. = (Assignment operator)
C. == (equality operator)
D. -> (arrow operator)
Answer» B. = (Assignment operator)
29.

C++: If you have declared a static member in a class, then how many copies of static member are shared between objects?

A. Separate copy of the static member is created for all objects of the class.
B. Single copy of the static member is shared by all objects of the class.
C. Only static function are shared between objects not variable.
D. None of the above.
Answer» C. Only static function are shared between objects not variable.
30.

What is namespace in C++?

A. It provides space between names.
B. namespace reserve the memory of variable at run time.
C. Namespaces provide a method for preventing name conflicts or name clashes
D. None of the above.
Answer» D. None of the above.
31.

C++: During a class inheritance in CPP, if the visibility mode or mode of derivation is not provided, then by default visibility mode is___________.

A. public
B. protected
C. private
D. friend
Answer» D. friend
32.

C++: The Standard Template Library (STL) consists of three main components. What are those components?

A. ADT, Structure,class.
B. Containers, Algorithms, and statements.
C. Containers, Algorithms, and Iterators.
D. None of the above.
Answer» D. None of the above.
33.

C++: The derivation of Child class from Base class is indicated by ____ symbol.

A. ::
B. :
C. ;
D. |
Answer» C. ;
34.

Java: Generic pointers can be declared with__________

A. auto
B. void
C. asm
D. None of these
Answer» C. asm
35.

Java: Predict the output:int x = 786;cout

A. 786***
B. **786
C. ***786
D. ******
Answer» D. ******
36.

______________are used to format the data display in CPP?

A. Iterators
B. Punctuators
C. Manipulators
D. Allocators
Answer» D. Allocators
37.

C++: Which of the following is are correct statements about inline function and macros.

A. Inline functions are parsed by the compiler but Macros are expanded by the C++ preprocessor.
B. Inline functions follow strict parameter type checking.
C. Macros do not follow parameter type checking.
D. All of the above.
Answer» E.
38.

C++: What is RTTI?

A. Run-Time Type Identification (RTTI) is a technique that is used to know the type of any object at run time.
B. RTTI is a technique that is used to know the type of any object at compile time.
C. RTTI reserve memory of function at run time.
D. None of the above.
Answer» B. RTTI is a technique that is used to know the type of any object at compile time.
39.

C++: Which of the following is are true about virtual function?

A. Function call is resolved at run-time
B. It is member function of a class.
C. Generally has a different functionality in the derived class.
D. All of the above.
Answer» E.
Previous Next