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.

With a template class, _____ type is generic

A. no
B. exactly one
C. at least one
D. at most one
Answer» D. at most one
2.

When you create a derived class and instantiate an object _____

A. the parent class object must be constructed first
B. the child class object must be constructed first
C. the parent class object must not be constructed
D. the child class object must not be constructed
Answer» B. the child class object must be constructed first
3.

Which of the following statements will assign the address of the age variable to the agePtr pointer?

A. agePtr = &age;
B. agePtr = *age;
C. &agePtr = age;
D. *agePtr = age;
Answer» B. agePtr = *age;
4.

Private data can be accessed by

A. class member functions
B. functions in derived classes
C. both (a) and (b)
D. neither (a) nor (b)
Answer» B. functions in derived classes
5.

The purpose of a conditional operator is to

A. select one of the two values
B. select the highest of the two values
C. select one of the two values depending on a condition
D. select the more equal of the two values
Answer» D. select the more equal of the two values
6.

When accessing a structure member, the identifier to the left of the dot operator is the name of

A. a structure member
B. a structure tag
C. a structure variable
D. the keyword struct
Answer» D. the keyword struct
7.

"C++" is a _____ constant

A. character literal
B. named literal
C. numeric literal
D. string literal
Answer» E.
8.

A constructor may be _____

A. provided automatically by C++
B. written by you
C. either (a) or (b).
D. neither (a) nor (b).
Answer» D. neither (a) nor (b).
9.

Which of the following are valid characters constants?

A. '\n'
B. '\\'
C. '\0'
D. All of the above
Answer» E.
10.

Which of the following is the fourth problem-solving step?

A. analyze the problem
B. evaluate and modify (if necessary) the program
C. code the algorithm
D. plan the algorithm
Answer» D. plan the algorithm
11.

Access specifiers are followed by

A. a comma
B. a semicolon
C. a colon
D. two colons
Answer» D. two colons
12.

The extraction operator >> is a(n)

A. overloaded function
B. C++ class
C. C++ object
D. static reference variable
Answer» B. C++ class
13.

When variables refer to attributes of an entity (such as name, address, and phone number of a person), those attributes form a _____

A. file
B. record
C. field
D. program
Answer» C. field
14.

Which of the following flowchart symbols represents the if selection structure?

A. diamond
B. hexagon
C. oval
D. parallelogram
Answer» B. hexagon
15.

A 'C function does not contain

A. a function header
B. argument declarations
C. other 'C' functions
D. function body
Answer» D. function body
16.

If a derived class uses the public access specifier, then _____

A. public base class members remain public in the derived class
B. protected base class members become public in the derived class
C. both (a) and (b)
D. neither (a) nor (b)
Answer» B. protected base class members become public in the derived class
17.

Assume a program contains a void function named displayName, which requires no formal parameters. Which of the following is a correct function prototype for this function?

A. displayName;
B. displayName(void);
C. void displayName;
D. void displayName();
Answer» E.
18.

Which of the following while clause will stop the loop when the value in the age variable is less than the number 0?

A. while age < 0
B. while (age < 0)
C. while age >= 0;
D. while (age >= 0);
Answer» E.
19.

Variables that hold memory addresses are called _____

A. subscripts
B. holders
C. pointers
D. indicators
Answer» D. indicators
20.

Element doubleArray[7] is which element of the array?

A. the sixth
B. the seventh
C. the eighth
D. impossible to tell
Answer» D. impossible to tell
21.

The return type for all destructors is

A. the class
B. void
C. the same as the first data in the class
D. None
Answer» E.
22.

Which of the following is an access specifier?

A. particular
B. shielded
C. protected
D. safe
Answer» D. safe
23.

Modules in C++ programs are

A. functions
B. procedures
C. subroutines
D. miniprograms
Answer» B. procedures
24.

Variable names known only to the procedure in which they are declared are ________

A. local
B. global
C. recent
D. internal
Answer» B. global
25.

Assume a class Derv that is privately derived from class Base. An object of class Derv located in main() can access

A. public members of Base
B. protected members of Base
C. private members of Base
D. public members of Derv
Answer» B. protected members of Base
26.

In which statements, does a 'continue' statements cause the control to go directly to the test condition and then continue the looping process?

A. 'for' and 'while'
B. 'while' and 'if-else'
C. 'do-while' and 'if-else'
D. 'while' and 'do-while'
Answer» E.
27.

The contents of two pointers that point to adjacent of type float differ by

A. one bytes
B. two bytes
C. three bytes
D. four bytes
Answer» E.
28.

The feature in object-oriented programming that allows the same operation to be carried out differently, depending on the object, is_____

A. inheritance
B. polymorphism
C. overfunctioning
D. overriding
Answer» C. overfunctioning
29.

A normal C++ operator that acts in special ways on newly defined data types is said to be

A. glorified
B. encapsulated
C. classified
D. overloaded
Answer» E.
30.

The end of string is recognized by

A. the null character
B. the newline character
C. the $ sign
D. the / sign
Answer» B. the newline character
31.

Reference variables and const class member

A. must be assigned values in any derived class
B. must never be initialized in a base class
C. must be initialized, rather than assigned values
D. must not exit if a class is to be a base class
Answer» D. must not exit if a class is to be a base class
32.

The letter V is a _____

A. character literal constant
B. numeric literal constant
C. string literal constant
D. variable
Answer» B. numeric literal constant
33.

An identifier in C

A. is a name of a thing such as variable and function
B. is made up of letters, numerals, and the underscore
C. can contain both uppercase and lowercase letters
D. All of the above
Answer» E.
34.

A(n) _____ is always incremented by a constant amount, whereas a(n) _____ is incremented by an amount that varies

A. accumulator, counter
B. counter, accumulator
Answer» C.
35.

The code class Descendant : virtual public Ancestor indicates that

A. the members of Ancestor will be included more than once in Descendant
B. the members of Ancestor will be included only once in Descendant
C. the members of Descendant will be included more than once in Ancestor
D. the members of Descendant will be included only once in Ancestor
Answer» C. the members of Descendant will be included more than once in Ancestor
36.

Which of the following C++ expressions is equivalent to the mathematical expression 53 ?

A. 5 ^ 3
B. cube(5)
C. pow (3, 5)
D. pow(5, 3)
Answer» E.
37.

Storing a class definition in a separate file is an example of

A. polymorphism
B. name mangling
C. implementation hiding
D. inheritance
Answer» D. inheritance
38.

The number of structures than can be declared in a single statement is

A. one
B. two
C. three
D. unlimited
Answer» E.
39.

The major advantage of data hiding is that _____

A. your programs can include more data
B. you no longer need functions
C. no one can ever use your data
D. your data will be used correctly
Answer» E.
40.

One of the relational operators in the C language is

A. !=
B. &&
C. !
D. #
Answer» B. &&
41.

When the compiler cannot differentiate between two overloaded constructors, they are called______

A. overloaded
B. destructed
C. ambiguous
D. dubious
Answer» D. dubious
42.

Programmers prefer to declare almost all variables _____

A. at the beginning of each function
B. globally
C. on one line
D. with cryptic names
Answer» B. globally
43.

Which of the following statements declares a variable that can contain a decimal number?

A. dec payRate;
B. dec hourlyPay
C. float payRate
D. float hourlyPay;
Answer» E.
44.

In the statement template,

A. T is a class
B. T is a scalar variable
C. either (a) or (b)
D. neither (a) nor (b)
Answer» D. neither (a) nor (b)
45.

The most efficient data type for a variable that stores the letter C is the _____ data type

A. Character
B. Double
C. Float
D. Long Integer
Answer» B. Double
46.

To write data that contains variables of type float, to an object of type ofstream, you should use

A. the insertion operator
B. seekg()
C. writeQ
D. put()
Answer» D. put()
47.

Which of the following is not a programming control structure?

A. repetition
B. selection
C. sequency
D. sorting
Answer» E.
48.

To use a template class member function, use the ________ with the instantiation

A. scope resolution operator
B. dot operator
C. class definition
D. keword template
Answer» C. class definition
49.

To use one of the C++ built-in mathematical functions, you must include the _____ header file in your program

A. calculation.h
B. compute.h
C. expression.h
D. math.h
Answer» E.
50.

The difference between a return and a throw is that _____

A. with a throw, no value can be sent
B. with a return, no value can be sent
C. with a throw, execution takes place at the location from which the function was called
D. with a return, execution takes place at the location from which the function was called
Answer» E.