Explore topic-wise MCQs in Technical Programming.

This section includes 1331 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.

901.

Pure virtual functions

A. have to be redefined in the inherited class.
B. cannot have public access specification.
C. are mandatory for a virtual class.
D. None of the above.
Answer» B. cannot have public access specification.
902.

A struct is the same as a class except that

A. there are no member functions.
B. all members are public.
C. cannot be used in inheritance hierarchy.
D. it does have a this pointer.
Answer» D. it does have a this pointer.
903.

The operator that cannot be overloaded is

A. ++
B. ::
C. ()
D. ~
Answer» C. ()
904.

A friend function to a class, C cannot access

A. private data members and member functions.
B. public data members and member functions.
C. protected data members and member functions.
D. the data members of the derived class of C.
Answer» E.
905.

A variable defined within a block is visible

A. from the point of definition onward in the program.
B. from the point of definition onward in the function.
C. from the point of definition onward in the block.
D. throughout the function.
Answer» D. throughout the function.
906.

If we create a file by ‘ifstream’, then the default mode of the file is ...............

A. ios :: out
B. ios :: in
C. ios :: app
D. ios :: binary
Answer» C. ios :: app
907.

The process of building new classes from existing one is called

A. Structure.
B. Inheritance.
C. Polymorphism.
D. Template.
Answer» C. Polymorphism.
908.

The keyword friend does not appear in

A. the class allowing access to another class.
B. the class desiring access to another class.
C. the private section of a class.
D. the public section of a class.
Answer» D. the public section of a class.
909.

You can read input that consists of multiple lines of text using

A. the normal cout << combination.
B. the cin.get( ) function with one argument.
C. the cin.get( ) function with two arguments.
D. the cin.get( ) function with three arguments.
Answer» D. the cin.get( ) function with three arguments.
910.

A property which is not true for classes is that they

A. are removed from memory when not in use.
B. permit data to be hidden from other classes.
C. bring together all aspects of an entity in one place.
D. Can closely model objects in the real world.
Answer» D. Can closely model objects in the real world.
911.

Which of the following cannot be legitimately passed to a function

A. A constant.
B. A variable.
C. A structure.
D. A header file.
Answer» E.
912.

Overloading the function operator

A. requires a class with an overloaded operator.
B. requires a class with an overloaded [ ] operator.
C. allows you to create objects that act syntactically like functions.
D. usually make use of a constructor that takes arguments.
Answer» B. requires a class with an overloaded [ ] operator.
913.

To perform stream I/O with disk files in C++, you should

A. open and close files as in procedural languages.
B. use classes derived from ios.
C. use C language library functions to read and write data.
D. include the IOSTREAM.H header file.
Answer» C. use C language library functions to read and write data.
914.

In access control in a protected derivation, visibility modes will change as follows:

A. private, public and protected become protected
B. only public becomes protected.
C. public and protected become protected.
D. only private becomes protected.
Answer» D. only private becomes protected.
915.

Maximum number of template arguments in a function template is

A. one
B. two
C. three
D. many
Answer» E.
916.

If a base class destructor is not virtual, then

A. It can not have a function body.
B. It can not be called.
C. It can not be called when accessed from pointer.
D. Destructor in derived class can not be called when accessed through a pointer to the base class.
Answer» E.
917.

Mechanism of deriving a class from another derived class is known as .............

A. Polymorphism
B. Single Inheritance
C. Multilevel Inheritance
D. Message Passing
Answer» D. Message Passing
918.

If an array is declared as int a[4] = {3, 0, 1, 2}, then values assigned to a[0] & a[4] will be ..................

A. 3, 2
B. 0, 2
C. 3, 0
D. 0, 4
Answer» D. 0, 4
919.

If x = 5, y = 2 then x ᴧ y equals ...............

A. 00000111
B. 10000010
C. 10100000
D. 11001000
Answer» B. 10000010
920.

The ................... statement causes immediate exit from the loop overriding the condition test

A. Exit
B. Break
C. Goto
D. None of the above
Answer» C. Goto
921.

Usually a pure virtual function

A. has complete function body.
B. will never be called.
C. will be called only to delete an object.
D. is defined only in derived class.
Answer» E.
922.

If the variable count exceeds 100, a single statement that prints “Too many” is

A. if (count<100) cout << “Too many”;
B. if (count>100) cout >> “Too many”;
C. if (count>100) cout << “Too many”;
D. None of these.
Answer» D. None of these.
923.

If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access

A. protected and public data only in C and B.
B. protected and public data only in C.
C. private data in A and B.
D. protected data in A and B.
Answer» E.
924.

The process of building new classes from existing one is called .............

A. Polymorphism
B. Structure
C. Inheritance
D. Cascading
Answer» D. Cascading
925.

What is the output of the following code char symbol[3]={‘a’,‘b’,‘c’}; for (int index=0; index

A. a b c
B. “abc”
C. abc
D. ‘abc’
Answer» D. ‘abc’
926.

The address of a variable temp of type float is

A. *temp
B. &temp
C. float& temp
D. float temp&
Answer» C. float& temp
927.

int **ptr; is

A. Invalid declaration
B. Pointer to pointer
C. Pointer to integer
D. none of the above
Answer» C. Pointer to integer
928.

A possible output of the following program fragment is for (i=getchar();; i=get.char()) if (i==‘x’) break; else putchar(i);

A. mi
B. mix
C. mixx
D. none of the above
Answer» E.
929.

Given a class named Book, which of the following is not a valid constructor?

A. Book ( ) { }
B. Book ( Book b) { }
C. Book ( Book &b) { }
D. Book (char* author, char* title) { }
Answer» C. Book ( Book &b) { }
930.

The members of a class, by default, are

A. public
B. protected
C. private
D. mandatory to specify
Answer» D. mandatory to specify
931.

In which case is it mandatory to provide a destructor in a class?

A. Almost in every class
B. Class for which two or more than two objects will be created
C. Class for which copy constructor is defined
D. Class whose objects will be created dynamically
Answer» E.
932.

What is the output of the following code int n = 0, m=1; do { printf(“%d”, m); m++; } while(m

A. 0
B. 2
C. 1
D. 4
Answer» D. 4
933.

A C program contains the following declaration int i=8, j=5 what would be the value of following expression ? abs(i-2*j)

A. 2
B. 4
C. 6
D. 8
Answer» B. 4
934.

Which of the following numerical value is invalid constant

A. .75
B. 9.3e2
C. 27,512
D. 123456
Answer» D. 123456
935.

The operators > are

A. assignment operator
B. relational operator
C. logical operator
D. bitwise shift operator
Answer» E.
936.

Unsigned integer occupies ..................

A. Two bytes
B. Four bytes
C. One byte
D. Eight bytes
Answer» C. One byte
937.

Which of the following is true for the statement: NurseryLand.Nursery.Students = 10;

A. The structure Students is nested within the structure Nursery.
B. The structure NurseryLand is nested within the structure Nursery.
C. The structure Nursery is nested within the structure NurseryLand.
D. The structure Nursery is nested within the structure Students.
Answer» D. The structure Nursery is nested within the structure Students.
938.

Which of the following statements are true in c++?

A. Classes can not have data as public members.
B. Structures can not have functions as members.
C. Class members are public by default.
D. None of these.
Answer» C. Class members are public by default.
939.

Which of the following is the odd one out?

A. j = j + 1;
B. j =+ 1;
C. j++;
D. j += 1;
Answer» C. j++;
940.

‘C’ is often called a

A. Object oriented language
B. High level language
C. Assembly language
D. Machine level language
Answer» C. Assembly language
941.

The .............. operator is a technique to forcefully convert one data type to the others

A. Cast
B. Conversion
C. Type
D. Uniary
Answer» B. Conversion
942.

The following code displays main( ) { int *p; p = (int*) malloc(sizeof(int)); *p = 10; printf(“p = %d\n”, *p); }

A. 10
B. 1542 (address of p)
C. 20
D. None of the above
Answer» B. 1542 (address of p)
943.

The expression P >> 6 shifts all bits of P six places to right. What is the value of P >> 6 if P = 0×6db7 ?

A. 0×1234
B. 0×0001
C. 0×0000
D. 0×1B6
Answer» E.
944.

If a = 5 and b = 7 then the statement p = (a > b) : a ? b

A. assigns a value 5 to p
B. assigns a value 7 to p
C. assigns a value 8 to p
D. gives an error message
Answer» E.
945.

Which amongst the following is not a keyword ?

A. external
B. Int
C. float
D. double
Answer» B. Int
946.

Given the statement, maruti.engine.bolts=25; which of the following is true ?

A. Structure bolts is nested within structure engine
B. Structure engine is nested within structure maruti
C. Structure maruti is nested within structure engine
D. Structure maruti nested within structure bolts
Answer» C. Structure maruti is nested within structure engine
947.

What would be output of the following program, if the array begins at 65486 ? main() { int arr[ ] = {12, 14, 15, 23, 45}; printf(“%u%u”, arr+1, &arr+1); }

A. 65486, 65486
B. 65488, 65488
C. 65488, 65496
D. None of the above
Answer» D. None of the above
948.

What would be output of the following program ? #include "stdio.h" main() { printf(“%d%d”, size of (NULL!), size of (“ “)); }

A. 2 1
B. 1 2
C. 2 2
D. 1 1
Answer» D. 1 1
949.

What would be output of the following program ? # define SQR(X) (X*X) main() { int a, b=3; a = SQR(b+2); printf(“\n%d”, a); }

A. 25
B. 11
C. Error
D. Garbage value
Answer» C. Error
950.

How many times the following program would print (“abc”) ? main() { printf(“\nabc”); main(); }

A. Infinite number of times
B. 32767 times
C. 65535 times
D. Till the stack does not overflow
Answer» B. 32767 times