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.

A variable is _____

A. an item of data
B. a memory location whose value can change while the program is running
C. a memory location whose value cannot change while the program is running
Answer» C. a memory location whose value cannot change while the program is running
2.

Which of the following numerical value(s) is(are) invalid constant(s)?

A. 0.7
B. 9.3el2
C. 27512
D. 12345678
Answer» D. 12345678
3.

The cout

A. display 22000
B. display 10000 + 12000
C. display sales[0] + sales[l]
D. result in an error
Answer» B. display 10000 + 12000
4.

Classes hold _____

A. data
B. methods
C. both data and methods
D. neither data nor methods
Answer» D. neither data nor methods
5.

The data type listed at the beginning of a value-returning function's header indicates the type of data the function will _____

A. return
B. pass
C. receive
Answer» B. pass
6.

You separate a derived class name from its access specifier with

A. a colon
B. two colons
C. at least one space
D. a semicolon
Answer» D. a semicolon
7.

Which of the following C++ expressions will find the square root of the number 16?

A. pow (16, 2) (b) root (16, 2)
B. sqroot (16)
C. sqrt (16, 2)
D. sqrt (16)
Answer» E.
8.

A do-while loop contains

A. only one statement between the do statement and the while statement
B. several statements between the do statement and the while statement
C. no statement at all between the do statement and the while statement
D. only two statement between the do statement and the while statement
Answer» C. no statement at all between the do statement and the while statement
9.

Which loop always processes its instructions at least once?

A. do-while
B. for
C. while
Answer» B. for
10.

A measure of the strength of the connection between two functions is

A. cohesion
B. coupling
C. dependence
D. subjection
Answer» C. dependence
11.

When you declare a pointer, you must give it a _____

A. type
B. type and name
C. type, name, and value
D. name and value
Answer» C. type, name, and value
12.

Which of the following, if any, are valid names for variables?

A. class
B. friend
C. #OnHand
D. void
Answer» E.
13.

The statement int n[4] = {11, -13, 17, 105};

A. assigns the value -13 to [2]
B. assigns the value 17 to n[2]
C. is wrong; it gives an error message
D. assigns the value 18 to n[2]
Answer» C. is wrong; it gives an error message
14.

A class named Student must have a constructor whose name is

A. Student
B. ~Student
C. constructor
D. any legal C++ name
Answer» B. ~Student
15.

Two access specifiers in C++ are

A. public and private
B. int and double
C. formal and informal
D. void and free
Answer» B. int and double
16.

In a simple 'if' statement with no 'else'. What happens if the condition following the 'if is false?

A. the program searches for the last else in the program
B. nothing
C. control 'falls through' to the statement following 'if
D. the body of the statement is executed
Answer» D. the body of the statement is executed
17.

Assuming the following three operators appear in an expression (without parentheses), which of the operators will be performed first?

A. &&
B. !
C. ||
Answer» C. ||
18.

It is sometimes useful to specify a class from which no objects will ever be created

A. 1
B.
Answer» B.
19.

The comma operator (,) is used to

A. permit two different expressions to appear in situations where only one expression would ordinarily be used
B. terminate loops or to exit from switch
C. alter the normal sequence of program execution by transferring control to some other part of the program
D. carry out a logical test and then take one of two possible actions, depending upon the outcome of the test
Answer» B. terminate loops or to exit from switch
20.

Precedence determines which operator

A. is evaluated first
B. is most important
C. is fastest
D. operates on the largest number
Answer» B. is most important
21.

A function that changes an object's state belongs to the category of

A. inspector functions
B. mutator functions
C. auxiliary functions
D. manager functions
Answer» C. auxiliary functions
22.

The operator that releases previously allocated memory is _____

A. release
B. return
C. delete
D. destroy
Answer» D. destroy
23.

You___________overload function templates

A. may, as long as each version has the same arguments
B. may, as long as each version has different arguments
C. must
D. must not
Answer» C. must
24.

When a class serves as a base class to others, _____

A. all of its members are inherited
B. all of its members are inherited, except for any private members
C. all of its members are inherited, except for any protected members
D. None of its members is inherited unless specifically "listed
Answer» C. all of its members are inherited, except for any protected members
25.

The null character is represented by

A. \n
B. \0
C. \o
D. \r
Answer» C. \o
26.

The >> (extraction) operator stops reading characters from the keyboard as soon as the user _____

A. presses the Enter key
B. types a character that is inappropriate for the variable's data type
C. both (a) and (b)
Answer» D.
27.

When the function void someFunction(int x) throw(char) is executed,_____

A. it will throw nothing
B. it may throw an integer
C. it may throw a character
D. it may not throw anything
Answer» D. it may not throw anything
28.

If you want only one memory location to be reserved for a class variable, no matter how many objects are instantiated, you should declare the variable as________

A. dynamic
B. unary
C. static
D. volatile
Answer» D. volatile
29.

A function that uses variable types is called __________

A. overloaded
B. a template function
C. a variable function
D. a virtual function
Answer» C. a variable function
30.

Which of the following is(are) valid identifier(s)?

A. record_1
B. 1 record
C. return
D. $tax
Answer» B. 1 record
31.

Whis is true?

A. A derived class may have more than one base class
B. A base class may have more than one derived class
C. both (a) and (b)
D. neither (a) nor (b)
Answer» D. neither (a) nor (b)
32.

An object is _____

A. a category of classes
B. a name given to a class
C. an instance of a class
D. the same as a class
Answer» D. the same as a class
33.

6.5 is a _____ constant

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

Reserving memory during program execution is known as reserving it

A. dynamically
B. statically
C. functionally
D. powerfully
Answer» B. statically
35.

_____ variables remain in memory until the statement block ends

A. Area
B. Global
C. Local
D. Reference
Answer» D. Reference
36.

The operator that allocates new memory is _____

A. allocate
B. mem
C. new
D. next
Answer» D. next
37.

The body of a C++ function is surrounded by _____

A. parentheses
B. angle brackets
C. curly brackets
D. square brackets
Answer» D. square brackets
38.

The declaration section holds

A. data members
B. data members and function prototypes
C. data members, function prototypes, and the functions themselves
D. None of the above
Answer» C. data members, function prototypes, and the functions themselves
39.

In object-oriented terms, an exception may be considered a(n) _____

A. child
B. encapsulation
C. message
D. scalar type
Answer» D. scalar type
40.

One of the logical operators in the C language is represented by the symbol

A. AND
B. &&
C. >=
D. <=
Answer» C. >=
41.

In a template function, _____ argument is generic, or parameterized

A. no
B. exactly one
C. at least one
D. more than one
Answer» D. more than one
42.

Code that has already been tested is said to be _____

A. inherited
B. reusable
C. reliable
D. polymorphic
Answer» D. polymorphic
43.

The int type of constants are whole numbers in the range

A. - 23677 to 23678
B. - 32768 to 32767
C. - 32767 to 32768
D. - 32864 to 32865
Answer» C. - 32767 to 32768
44.

A file pointer always contains the address of the file

A. 1
B.
Answer» C.
45.

External documentation includes

A. a printout of the program's code
B. flowcharts
C. IPO charts
D. pseudocode
Answer» B. flowcharts
46.

Which of the following tells C++ to display numbers in fixed notation?

A. setiosflags(fixed)
B. setiosflags(fixed: :is)
C. setiosflags(ios, fixed)
D. setiosflags(ios::fixed)
Answer» E.
47.

Which of the following is a C++ object?

A. >>
B. read()
C. cin
D. iostream
Answer» D. iostream
48.

The #include instruction is called a

A. direction
B. directive
C. merge instruction
D. statement.
Answer» C. merge instruction
49.

You can throw _____

A. a scalar variable
B. a constant
C. a programmer-defined class object
D. any of these
Answer» E.
50.

One way in which a structure differs from an array is that

A. a structure may have members of more than one type
B. a structure must have members that are all the same type
C. an array may have members of more than one type
D. there is no difference between a structure and an array
Answer» B. a structure must have members that are all the same type