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.

What is a Constructor?

A. A function called when an instance of a class is initialized.
B. A function that is called when an instance of a class is deleted.
C. A special function to change the value of dynamically allocated memory.
D. A function that is called in order to change the value of a variable.
Answer» B. A function that is called when an instance of a class is deleted.
2.

What will be the output of the following program ? main() { char *p = “ayqm”; printf (“%c”, ++*(p++));}

A. b
B. z
C. q
D. n
Answer» B. z
3.

Output of the program given below is int i; main() { printf(“%d”, i); }

A. 1
B. 0
C. -1
D. Null
Answer» C. -1
4.

What is the output of the following program segment? main() { int i = ++2; printf(“%d\n”, i); }

A. 3
B. 2
C. 0
D. -1
Answer» B. 2
5.

What is the output of the following program segment? main() { int i = 1; do { printf(“%d..”, i); } while(i--); }

A. 0..1..
B. 1..0..
C. 0
D. -1
Answer» C. 0
6.

What is the output of the following program? main ( ) { extern int x; x = 20; printf(“\n%d”, x); }

A. 0
B. 20
C. error
D. garbage value
Answer» D. garbage value
7.

The conditional expressions are evaluated from .............

A. top down
B. bottom up
C. middle
D. end
Answer» B. bottom up
8.

If and the switch statements are called as ................. statements.

A. iteration
B. jump
C. selection
D. conditional
Answer» D. conditional
9.

Latency time is ...................

A. time taken by read/write head mechanism to position itself over appropriate cylinder
B. time taken to transfer a data from memory
C. time taken by appropriate sector to come under read/write head
D. time taken to retrieve the data
Answer» D. time taken to retrieve the data
10.

Seek time is ...............

A. time taken to retrieve a data
B. ) time taken by read/write head mechanism to position itself over appropriate cylinder
C. time taken by appropriate sector to come under read/write
D. time taken to find out the data
Answer» C. time taken by appropriate sector to come under read/write
11.

Each object has its own copies of the class .................

A. data
B. code
C. function
D. instance variables
Answer» E.
12.

................ operator links the name of the object with the name of the member.

A. ->
B. .(Dot)
C. &
D. *
Answer» C. &
13.

Code is contained in .............. of the class.

A. object
B. template
C. function
D. array
Answer» D. array
14.

The ............. statements are simply a group of related statements that are treated as a single unit.

A. block
B. multiple
C. related
D. logical
Answer» B. multiple
15.

What is the output of the following program? main( ) { int i=4, z=12; if(i=5 || z>50) printf(“hello”); else printf(“hye”); }

A. hello
B. hye
C. syntax error
D. hellohye
Answer» B. hye
16.

Which of the following statement is true about a function?

A. An invoking function must pass arguments to the invoked function.
B. Every function returns a value to the invoker.
C. A function may contain more than one return statement.
D. Every function must be defined in its own separate file.
Answer» B. Every function returns a value to the invoker.
17.

The given FOR loop is for ( ; ; ) { printf(“ ”); }

A. valid
B. indefinite
C. invalid
D. displays runtime errors
Answer» E.
18.

C language was invented by

A. Abacus
B. Charles babage
C. Thomson
D. Dennis Ritchie
Answer» E.
19.

The function that allocates requested size of bytes and returns a pointer to the first byte of the allocated space is:

A. realloc
B. malloc
C. calloc
D. none of the above
Answer» C. calloc
20.

Which of the following is not a valid escape code?

A.
B. v
C. f
D. w
Answer» E.
21.

Which of the following is the proper keyword to deallocate memory?

A. free
B. delete
C. clear
D. remove
Answer» B. delete
22.

Which of the following is the proper keyword to allocate memory?

A. new
B. malloc
C. create
D. value
Answer» C. create
23.

The escape sequence \o represents ................

A. back space
B. new line
C. octal number
D. hexadecimal number
Answer» D. hexadecimal number
24.

Which of the following is not true about constants in c++?

A. It is also called literals
B. It has not compiled place in memory
C. It s value cannot be changed
D. ) The address value cannot be of constant data type
Answer» E.
25.

................ object is used to print wide characters.

A. wout
B. print
C. w_cout
D. cout
Answer» B. print
26.

The ................ is contained in instance variable defined by the class.

A. data
B. code
C. object
D. Function
Answer» B. code
27.

The code and data are called ................ of the class.

A. instances
B. instance variables
C. members
D. object
Answer» D. object
28.

.................... is the data type that can accommodate char that require more than 8-bits

A. char
B. wchar_t
C. w char
D. char_t
Answer» C. w char
29.

What is the output of the following program? main ( ) { int x = 2, y = 5; if (x < y) return (x = x+y); else printf (“z1”); printf(“z2”); }

A. z2
B. z1z2
C. Compilation error
D. None of these
Answer» E.
30.

A .................. is a storage location that contains data value.

A. function
B. structure
C. variable
D. key word
Answer» D. key word
31.

The ................... is predefined identifier that is linked to console output

A. out
B. print
C. cin
D. cout
Answer» E.
32.

Which of the following is one of the international keyword?

A. Int
B. Bitand
C. try
D. While
Answer» C. try
33.

The name of a function variable or class is called ...................

A. libraries
B. stream
C. identifiers
D. keywords
Answer» D. keywords
34.

................. in a program source code, documents the meaning of the code.

A. comment
B. function
C. class
D. main function
Answer» B. function
35.

C++ begins its execution with ................

A. header file
B. main
C. class
D. declaration
Answer» C. class
36.

The commonly used term for a sub routine in c++ is ...............

A. structure
B. class
C. function
D. program
Answer» D. program
37.

A joint ANSI /ISO committee was formed in ................ to define standard C++.

A. 1986
B. 1987
C. 1988
D. 1989
Answer» E.
38.

The ............... is the standard input/ouput library in C++.

A. stdio
B. iostream
C. conio
D. std
Answer» C. conio
39.

C++ was developed by.............

A. Dr. Bjarne stroustrup
B. Dennis Ritc
C. Borland
D. ANSI
Answer» B. Dennis Ritc
40.

To rethrow an exception .................. is specified.

A. throw without a value
B. catch with a value
C. rethrow
D. catch without a value
Answer» B. catch with a value
41.

The .................. is a short function that gets or sets the value of a private instance variable.

A. inline
B. friend
C. accessor
D. void
Answer» D. void
42.

The ............. manipulator skips leading whitespaces.

A. sw
B. ws
C. wy
D. skipws
Answer» C. wy
43.

The second element of the array int zones[5]= { 43,54,56,76,78} can be accessed by .................

A. zones[2]
B. zones[1]
C. zones[3]
D. zones[4]
Answer» C. zones[3]
44.

The elements of an array can be accessed by providing integer expression called ...............

A. superscripts
B. elements
C. values
D. subscripts
Answer» E.
45.

The ............... is the function that detects the end of file.

A. eof()
B. getline()
C. putline()
D. clear()
Answer» B. getline()
46.

The current position of each file pointer using the functions ............... and ...............

A. pos_type tellg(), pos_type tellp()
B. pos_type tellx(), pos_type tellf()
C. pos_type tellx(), pos_type tellp()
D. pos_type tellf(), pos_type tellp()
Answer» B. pos_type tellx(), pos_type tellf()
47.

................... determines the type of an object at the runtime.

A. Static
B. Dynamic
C. Typeid
D. Typedef
Answer» D. Typedef
48.

The ............... keyword brings the members of a namespace into view.

A. view
B. using
C. additive
D. show
Answer» C. additive
49.

If an allocation request is not fulfilled ................... exception is thrown.

A. wrong_alloc
B. re_alloc
C. malloc
D. bad_alloc
Answer» E.
50.

The keyword ................ is used to declare a generic function.

A. generic
B. template
C. virtual
D. friend
Answer» C. virtual