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.

The protected access specifier is needed only when ................ is needed.

A. inline function
B. file
C. friend function
D. inheritance
Answer» E.
2.

What will be the output of the following code segment? main( ) { char s[10]; strcpy(s, “abc”); printf(“%d %d”, strlen(s), sizeof(s)); }

A. 3 10
B. 3 3
C. 10 3
D. 10 10
Answer» B. 3 3
3.

A reference parameter is declared by proceeding with ....................

A. *
B. &
C. &&
D. ~
Answer» C. &&
4.

Size of operator is ................ operator.

A. compile time
B. intrinsic
C. extraction
D. ternary
Answer» B. intrinsic
5.

The output of the following code segment will be char x = ‘B’; switch (x) { case ‘A’: printf(“a”); case ‘B’: printf(“b”); case ‘C’: printf(“c”); }

A. B
B. b
C. BC
D. bc
Answer» E.
6.

Inline is a ................

A. command
B. statement
C. request
D. class
Answer» D. class
7.

C++ programs start their execution at ................

A. start()
B. begin()
C. main()
D. output()
Answer» D. output()
8.

Which of the following for loop is not correct?

A. for(;x<10;)
B. or(; ; ;)
C. for(; ;)
D. for (x=0;x!=123;)
Answer» C. for(; ;)
9.

If the condition in a for loop is false then .................

A. code inside loop may not be executed.
B. program terminates.
C. code inside loop may be executed atleast once.
D. shows error.
Answer» B. program terminates.
10.

The second expression (j – k) in the following expression will be evaluated (i + 5) && (j – k)

A. if expression (i + 5) is true.
B. if expression (i + 5) is false.
C. irrespective of whether (i + 5) is true or false.
D. will not be evaluated in any case.
Answer» B. if expression (i + 5) is false.
11.

The switch expression must be of type .................. or .................

A. char,float
B. float,int
C. int, char
D. char, float
Answer» D. char, float
12.

‘C’ allows a three-way transfer of control with the help of

A. unary operator
B. relational operator
C. ternary operator
D. comparison operator
Answer» D. comparison operator
13.

scanf() can be used for reading

A. double character
B. single character
C. multiple characters
D. no character
Answer» D. no character
14.

A float variable can store any variable within the range of

A. −1.7 ×1038 to 1.7 ×1038
B. − 3.4 ×1038 to 3.4 ×1038
C. − 7.2 ×1038 to 7.2 ×1038
D. −1.2 ×1038 to 1.2 ×1038
Answer» C. − 7.2 ×1038 to 7.2 ×1038
15.

The name of all functions end with a

A. pair of parenthesis
B. semicolon
C. braces
D. colon
Answer» B. semicolon
16.

The .............. storage class is used to declare reference variable.

A. register
B. static
C. extern
D. auto
Answer» D. auto
17.

The content of file will be lost if it is opened in

A. w mode
B. w+ mode
C. a mode
D. a+ mode
Answer» B. w+ mode
18.

The purpose of the code, answer = toupper(ans); is to ensure that ................

A. answer will be rounded to the next larger integer
B. the first letter in answer will be a capital letter
C. answer will contain all capital letters
D. answer will contain no numeric values
Answer» D. answer will contain no numeric values
19.

In a two dimensional array called list with dimensions 4 X 9 the element 2,3 can be accessed by using the expression ................

A. list[3][2]
B. list[2,3]
C. list[2][3]
D. list[3,2]
Answer» D. list[3,2]
20.

The declaration of a two dimensional array called list with dimensions 4 X 9 is represented as ..................

A. int list [4] [9]
B. int list [9][4]
C. int list [4,9]
D. int list[9,4]
Answer» B. int list [9][4]
21.

The variables in an array are called its ...............

A. data
B. index
C. elements
D. subscripts
Answer» D. subscripts
22.

Which header file is used for screen handling function:-

A. IO.H
B. STDLIB.H
C. CONIO.H
D. STDIO.H
Answer» E.
23.

A ............. local variable preserves its variable between function calls.

A. extern
B. static
C. register
D. auto
Answer» C. register
24.

The result of a relational or logical expression is of type ..............

A. integer
B. float
C. Boolean
D. character
Answer» D. character
25.

When local & global variable have same name to refer global variable ............... operator is used.

A. ? :
B. :
C. : :
D. <<
Answer» D. <<
26.

............. is not a type of scope in c++.

A. global
B. local
C. file
D. function
Answer» E.
27.

Which on of the following has the highest precedence?

A. %
B. ( )
C. ||
D. ?:
Answer» C. ||
28.

Which one of the following is the conditional operator?

A. ?:
B. ?: =
C. :?
D. ?=
Answer» B. ?: =
29.

Which of the following is invalid assignment operator?

A. -=
B. &=
C. ^=
D. *=
Answer» D. *=
30.

............... operation inserts zero bits into low order bits of result.

A. shift
B. shifting left
C. shifting right
D. append
Answer» C. shifting right
31.

The ................ operation returns the remains of a divisions operation .

A. . !
B. &&
C. %
D. /
Answer» D. /
32.

>> is called as ............. operator.

A. insertion
B. extraction
C. greater than
D. lesser than
Answer» C. greater than
33.

A variable that receives an assigned value is called an ................

A. l value
B. r value
C. value
D. assignment
Answer» B. r value
34.

What is the name of built-in function for finding square roots?

A. square(x)
B. sqr(x)
C. sqrt(x)
D. No built-in function
Answer» D. No built-in function
35.

Which of the following is not a component of file system?

A. Access method
B. Auxiliary storage management
C. Free integrity mechanism
D. None of the above
Answer» E.
36.

Which of the following is not a file operation?

A. Repositioning
B. Truncating
C. Readable
D. Appending
Answer» D. Appending
37.

The maximum number of dimensions an array can have in C is

A. 3
B. 4
C. 5
D. compiler dependent
Answer» E.
38.

The directive that can be used to test whether an expression evaluates to a nonzero value or not is

A. #if
B. #elif
C. #endif
D. #exit
Answer» B. #elif
39.

main() { long i = 30000; printf(“%d”, i); } the output is

A. 3000
B. 30000
C. 0
D. -1
Answer» C. 0
40.

The *ptr++ is equivalent to ................

A. ptr++
B. *ptr
C. ++*ptr
D. none of the above
Answer» E.
41.

Which of the following is/are advantages of cellular partitioned structure?

A. Simultaneous read operations can be overlapped
B. Search time is reduced
C. Both (A) & (B)
D. Retrieval time is reduced
Answer» D. Retrieval time is reduced
42.

If storage class is missing in the array definition, by default it will be taken to be

A. automatic
B. external
C. static
D. either automatic or external depending on the place of occurrence.
Answer» B. external
43.

Which of the following is true about const member functions?

A. const members can be invoked on both const as well as nonconst objects
B. const members can be invoked only on const objects and not on nonconst objects
C. nonconst members can be invoked on const objects as well as nonconst objects
D. none of the above
Answer» B. const members can be invoked only on const objects and not on nonconst objects
44.

Consider the following declaration int a, *b = &a, **c = &b; The following program fragment a = 4; **c = 5;

A. does not change the value of a
B. assigns address of c to a
C. assigns the value of b to a
D. assigns 5 to a
Answer» E.
45.

How many copies of a class static member are shared between objects of the class?

A. A copy of the static member is shared by all objects of a class
B. A copy is created only when at least one object is created from that class
C. A copy of the static member is created for each instantiation of the class
D. No memory is allocated for static members of a class
Answer» B. A copy is created only when at least one object is created from that class
46.

How do we declare an interface class?

A. By making all the methods pure virtual in a class
B. By making all the methods abstract using the keyword abstract in a class
C. By declaring the class as interface with the keyword interface
D. By declaring the class as interface with the keyword interface
Answer» B. By making all the methods abstract using the keyword abstract in a class
47.

Choose the correct answer

A. enum variable cannot be assigned new values
B. enum variable can be compared
C. enumeration feature increase the power of C
D. None of the above
Answer» D. None of the above
48.

In a for loop, if the condition is missing, then,

A. It is assumed to be present and taken to be false.
B. It is assumed to be present and taken to be true.
C. It results in a syntax error
D. Execution will be terminated abruptly.
Answer» C. It results in a syntax error
49.

Which of the following is not a jump statement in C++?

A. break
B. goto
C. exit
D. switch
Answer» E.
50.

In C++, 14 % 4 = ................

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