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.

If a, b and c are integer variables with the values a=8, b=3 and c=-5. Then what is the value of the arithmetic expression: 2 * b + 3 * (a-c)

A. 45
B. 6
C. -16
D. -1
Answer» B. 6
2.

What is the output of the following C program? # include main ( ) { int a, b=0; static int c [10]={1,2,3,4,5,6,7,8,9,0}; for (a=0; a

A. 20
B. 25
C. 45
D. 90
Answer» B. 25
3.

................ function converts an object of the class in which you define the function to an object of different data type.

A. conversion function
B. member function
C. class conversion
D. conversion constructors
Answer» D. conversion constructors
4.

A ................. converts from an object of the type of the constructor parameter to an object of the class.

A. conversion function
B. member function
C. class conversion
D. conversion constructors
Answer» E.
5.

The .................. functions are implementation independent.

A. inline
B. accessor
C. member
D. recursive
Answer» B. accessor
6.

The size of operator returns the size of variable or type in ...............

A. bits
B. nibble
C. bytes
D. char
Answer» D. char
7.

Every statement in C++ program should end with a ................

A. full stop (.)
B. comma (,)
C. semicolon (;)
D. colon (:)
Answer» D. colon (:)
8.

Which of the following is false?

A. cout represents the standard output stream in c++
B. cout is declared in the iostream standard file
C. cout is declared within the std namespace
D. none of above
Answer» C. cout is declared within the std namespace
9.

Every function in C++ is followed by ...................

A. parameters
B. parenthesis
C. curly braces
D. none of these
Answer» C. curly braces
10.

Consider the following statements: int x = 6, y=8, z, w; y = x++; z = ++x; The value of x,y,z by calculating the above expressions are:-

A. y=8, z=8, x=6
B. y=6, x=8, z=8
C. y=9, z=7, x=8
D. y=7, x=8, z=7
Answer» C. y=9, z=7, x=8
11.

The variable that are declared outside all the functions are called ............

A. Local variable
B. Global variable
C. Auto variable
D. None of the above
Answer» C. Auto variable
12.

The size of following variable is not 4 bytes in 32 bit systems is ...............

A. int
B. long int
C. short int
D. float
Answer» D. float
13.

Which of the following is not a reserve keyword in C++?

A. mutable
B. default
C. readable
D. volatile
Answer» E.
14.

If you use same variable for two getline statements ..................

A. both the inputs are stored in that variable.
B. the second input overwrites the first one.
C. the second input attempt fails since the variable already got its value.
D. you can not use same variable for two getline statements.
Answer» C. the second input attempt fails since the variable already got its value.
15.

Which of the following header file does not exist?

A. <iostream>
B. <string>
C. <sstring>
D. <sstream>
Answer» D. <sstream>
16.

Which of the header file must be included to use stringstream?

A. <iostream>
B. <string>
C. <sstring>
D. <sstream>
Answer» E.
17.

Which of the following is not a valid statement regarding stringstream?

A. Stringstream is defined in the header file <sstream>.
B. It allows string based objects treated as stream.
C. It is especially useful to convert strings to numerical values and vice versa.
D. None of these
Answer» E.
18.

The difference between while structure and do structure for looping is .................

A. in while statement the condition is tested at the end of first iteration
B. in do structure the condition is tested at the beginning of first iteration
C. the do structure decides whether to start the loop code or not whereas while statement decides whether to repeat the code or not
D. in while structure condition is tested before executing statements inside loop where as in do structure condition is tested before repeating the statements inside loop
Answer» E.
19.

Find out the error in following code. If (x = 100)

A. 100 should be enclosed in quotations.
B. There is no semicolon at the end of first line.
C. Equals to operator mistake.
D. Variable x should not be inside quotation.
Answer» D. Variable x should not be inside quotation.
20.

A variable P is called pointer if ....................

A. P contains the address of an element in DATA.
B. P points to the address of first element in DATA
C. P can store only memory addresses
D. P contain the DATA and the address of DATA
Answer» B. P points to the address of first element in DATA
21.

The memory address of the first element of an array is called ..................

A. floor addres
B. foundation address
C. first address
D. base address
Answer» E.
22.

Set precision requires the ................ header file.

A. stdlib.h
B. iomanip.h
C. console.h
D. conio.h
Answer» C. console.h
23.

If a function is declared as void fn(int *p), then which of the following statements is valid to call function fn?

A. fn(x) where x is defined as int x;
B. fn(x) where x is defined as int *x;
C. fn(&x) where x is defined as int *x;
D. fn(*x) where x is defined as int *x;
Answer» C. fn(&x) where x is defined as int *x;
24.

What will be the output of the following code segment, if any? myfunc ( struct test t) { strcpy(t.s, “world”); } main( ) { struct test { char s[10]; } t; strcpy(t.s, “Hello”); printf(“%s”, t.s); myfunc(t); printf(“%s”, t.s); }

A. Hello Hello
B. world world
C. Hello world
D. the program will not compile
Answer» E.
25.

Regarding #define which of the following statement is false?

A. it is not C++ statement but the directive for the pre-processor.
B. this does not require a semicolon at the end of line.
C. it is a C++ statement that declares a constant in C++.
D. none of the above.
Answer» D. none of the above.
26.

Each pass through a loop is called a/an ...............

A. enumeration
B. iteration
C. culmination
D. pass through
Answer» C. culmination
27.

A continue statement causes execution to skip to ...................

A. the return 0; statement.
B. the first statement after the loop.
C. the statement following the continue statement.
D. the next iteration of the loop.
Answer» E.
28.

The directives for the pre-processors begin with ...................

A. ampersand symbol (&)
B. b. two Slashes (//)
C. number Sign (#)
D. less than symbol (<)
Answer» D. less than symbol (<)
29.

Which of the following is the boolean operator for logical-and?

A. &
B. &&
C. |
D. |&
Answer» C. |
30.

Which of the following is the correct operator to compare two variables?

A. :=
B. v
C. equal
D. = =
Answer» E.
31.

Which of the following is not a correct variable type?

A. float
B. real.
C. switch
D. double
Answer» D. double
32.

The pure virtual function represents the ..................

A. inheritance
B. overloading
C. overriding
D. interface
Answer» E.
33.

A class that is inherited is called as .............. class.

A. derived
B. child
C. base
D. abstract
Answer» D. abstract
34.

The specific version of the generic function created by the compiler is called as ...............

A. specialization
B. generalization
C. general function
D. template function
Answer» B. generalization
35.

One of the methods to stop the execution of the function is by calling the standard .................. function.

A. goto
B. jump
C. stop
D. exit
Answer» E.
36.

A ................ function is a function that has no body inside its base class.

A. inline
B. friend
C. constructor
D. pure virtual
Answer» E.
37.

For a binary member operator function, the left operand is passed through ...............

A. pointer
B. reference
C. this
D. parameter
Answer» D. parameter
38.

The data members of ................. share the same memory.

A. union
B. structure
C. function
D. class
Answer» B. structure
39.

The .................. is a relationship.

A. polymorphism
B. inheritance
C. overloading
D. overriding
Answer» C. overloading
40.

A derived class ....................

A. inherits data members and member functions from base class.
B. inherits constructors and destructor.
C. object can access protected members with the dot operator.
D. inherits data members and member functions from base class as well as Inherits constructors and destructor.
Answer» E.
41.

Which of the following gives the value stored at the address pointed to by the pointer a?

A. a;
B. val(a);
C. *a;
D. &a;
Answer» D. &a;
42.

Which of the following gives the memory address of a variable pointed to a pointer a?

A. *a;
B. a;
C. &a;
D. address(a);
Answer» B. a;
43.

Which of the following gives the memory address of integer variable a?

A. *a;
B. a;
C. &a;
D. address(a);
Answer» D. address(a);
44.

Which of the following is the proper declaration of a pointer?

A. int x;
B. int &x;
C. ptr x;
D. int *x;
Answer» E.
45.

Find the invalid identifiers from the following:- (i) nA (ii) 2nd (iii) ROLL NO (iv) case

A. (i), (ii) and (iv)
B. (i) and (iii)
C. (ii), (iii) and (iv)
D. (ii), (i) and (iii)
Answer» D. (ii), (i) and (iii)
46.

A generic function is also called as ..............

A. friend function
B. template function
C. virtual function
D. special function
Answer» C. virtual function
47.

A generic function is created using the keyword ..................

A. template
B. generic
C. friend
D. class
Answer» B. generic
48.

How many times the following code prints the string “hello”. for(i=1; i

A. 1
B. 1000
C. Zero
D. Syntax error
Answer» B. 1000
49.

A structure defines a .................. type.

A. class
B. pointer
C. arrays
D. variables
Answer» B. pointer
50.

The ................... member variable cannot have an initializer.

A. static
B. non-static
C. auto
D. register
Answer» C. auto