Explore topic-wise MCQs in Computer Science.

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

51.

Object oriented programming employs_________ programming approach.

A. top-down
B. procedural
C. bottom-up
D. all of these.
Answer» D. all of these.
52.

Object based language differs from object oriented language as it does not support features _____ . 1. Encapsulation 2. Inheritance 3. Dynamic Binding 4. Abstraction 5. Polymorphism

A. only 3 ,4
B. only 1,3,5
C. 2,4,5
D. Only 2,3
Answer» E.
53.

Members of the class can be declared with auto, extern or register storage classes.

A. True
B. False
Answer» C.
54.

Logical expressions produce ____________ type results.

A. explicit
B. garbage
C. bool
D. static
Answer» D. static
55.

__________________ is the OOP feature and mechanism that binds together code and the data it manipulates, and keep both safe from outside world.

A. Data Binding
B. Data Encapsulation
C. Data Storing
D. Data Abstraction
Answer» C. Data Storing
56.

__________ is return type of is_open() function.

A. int
B. bool
C. float
D. char *
Answer» C. float
57.

Is it possible to define a constructor with default arguments?

A. Yes
B. No
Answer» B. No
58.

Is it mandatory to invoke/call a constructor for creating an object?

A. Yes
B. No
Answer» B. No
59.

_______________ is a member function that is declared within a base class and redefined by derived class.

A. virtual function
B. static function
C. friend function
D. const member function
Answer» B. static function
60.

Irrespective of exception occurrence, catch handler will always get executed.

A. True
B. False
Answer» C.
61.

Inline functions may not work ______ . 1. If function contain static variables. 2. If function contain global and register variables. 3. If function returning value consists looping construct(i.e. for, while). 4. If inline functions are recursive. 5. If function contains const value.

A. Only 1,4,5
B. Only 2,3,5
C. Only 1,3,4
D. All of these
Answer» D. All of these
62.

In nested try blocks, there is no need to specify catch handler for inner try block. Outer catch handler is sufficient for the program.

A. True
B. False
Answer» C.
63.

In nested try blocks, if both inner and outer catch handlers are not able to handle the exception, then ______________ .

A. Compiler executes only executable statements of main().
B. Compiler issues compile time errors about it.
C. Program will be executed without any interrupt.
D. Program will be terminated abnormally.
Answer» E.
64.

In nested try block, if inner catch handler gets executed, then _____________ .

A. Program execution stops immediately.
B. Outer catch handler will also get executed.
C. Compiler will jump to the outer catch handler and then executes remaining executable statements of main().
D. Compiler will execute remaining executable statements of outer try block and then the main().
Answer» E.
65.

In Multipath inheritance, in order to remove duplicate set of records in child class, we ___________ .

A. Write Virtual function in parent classes
B. Write virtual functions is base class
C. Make base class as virtual base class
D. All of these
Answer» D. All of these
66.

In CPP program, Can we declare and define a user defined function inside a struct as we do in a class ?

A. Yes
B. No
C. Can’t say
Answer» B. No
67.

In CPP, the size of the character array should be one larger than the number of characters in the string.

A. True
B. False
Answer» B. False
68.

In CPP, it is mandatory and must to initialize const variables.

A. True
B. False
Answer» B. False
69.

In CPP, dynamic memory allocation is done using ______________ operator.

A. calloc()
B. malloc()
C. allocate
D. New
Answer» E.
70.

In CPP, cin and cout are the predefined stream __________ .

A. Operator
B. Functions
C. Objects
D. Data types
Answer» D. Data types
71.

In case of operator overloading, operator function must be ______ . 1. Static member functions 2. Non- static member functions 3. Friend Functions

A. Only 2
B. Only 1, 3
C. Only 2 , 3
D. All 1 , 2, 3
Answer» D. All 1 , 2, 3
72.

In case of inheritance where both base and derived class are having constructor and destructor, then which if the following are true ? 1. Constructors are executed in their order of derivation 2. Constructors are executed in reverse order of derivation 3. Destructors are executed in their order of derivation 4. Destructors are executed in reverse order of derivation

A. Only 2 ,4
B. Only 1 , 3
C. Only 1 , 4
D. Only 2, 3
Answer» D. Only 2, 3
73.

In case of inheritance where both base and derived class are having constructors, when an object of derived class is created then___________ .

A. constructor of derived class will be invoked first
B. constructor of base class will be invoked first
C. constructor of derived class will be executed first followed by base class
D. constructor of base class will be executed first followed by derived class
Answer» E.
74.

In case of binary operator overloading with member function, which of following statement should be taken into consideration?

A. Right hand operand must be object.
B. Left hand operand must be object.
C. Both the operands must be objects.
D. All of these should be considered.
Answer» C. Both the operands must be objects.
75.

In any ways, Non-member function cannot have access to the private data of the class.

A. True
B. False
Answer» C.
76.

In a program, If there exists a function template with two parameters and normal function say void add(int , int), so add(3,4) will _____________________ .

A. Invoke function template body as it is generic one
B. Invokes normal function as it exactly matches with its prototype
C. Not be called and Compiler issues warning
D. Not be called and Compiler issues ambiguity in calling add()
Answer» C. Not be called and Compiler issues warning
77.

If we have object from fstream class, then what is the default mode of opening the file?

A. ios::in|ios::out
B. ios::in|ios::out|ios::trunc
C. ios::in|ios::trunc
D. Default mode depends on compiler
Answer» E.
78.

If we have object from ofstream class, then default mode of opening the file is _____ .

A. ios::in
B. ios::out
C. ios::in|ios::trunc
D. ios::out|ios::trunk
Answer» E.
79.

If the derived class is struct, then default visibility mode is _______ .

A. public
B. protected
C. private
D. struct can’t inherit class
Answer» B. protected
80.

If inner catch handler is not able to handle the exception then__________ .

A. Compiler will look for outer try handler
B. Program terminates abnormally
C. Compiler will check for appropriate catch handler of outer try block
D. None of these
Answer» D. None of these
81.

If default constructor is not defined, then how the objects of the class will be created?

A. The compiler will generate error
B. Error will occur at run-time.
C. Compiler provides its default constructor to build the object.
D. None of these
Answer» D. None of these
82.

If base class has constructor with arguments, then it is ________________ for the derived class to have constructor and pass the arguments to base class constructor.

A. Optional
B. Mandatory
C. Compiler dependent
D. Error
Answer» C. Compiler dependent
83.

If an argument to a function is declared as const, then _______ .

A. function can modify the argument.
B. Function can’t modify the argument.
C. const argument to a function is not possible.
D. None of these
Answer» C. const argument to a function is not possible.
84.

If abstract class is inherited by derived class, then_______________ .

A. Derived class should provide definition for all the pure virtual functions
B. Derived class also become abstract if fails to implement pure virtual functions
C. Objects of derived class can’t be created if it fails to implement pure virtual functions
D. All of these
Answer» E.
85.

If a program uses Inline Function, then the function is expanded inline at ___________.

A. Compile time
B. Run time
C. Both a and b
D. None of these
Answer» C. Both a and b
86.

If a class contains pure virtual function, then it is termed as____________________ .

A. Virtual class
B. Sealed class
C. Pure Local class
D. Abstract Class
Answer» E.
87.

If a class contains static variable, then every object of the class has its copy of static variable.

A. True
B. False
Answer» C.
88.

How can we restrict a function to throw certain exceptions?

A. Defining multiple try and catch block inside a function
B. Defining generic function within try block
C. Defining function with throw clause
D. It is not possible in CPP to restrict a function
Answer» D. It is not possible in CPP to restrict a function
89.

___________ header file is used for manipulators.

A. < iomanipulator.h>
B. < stdiomanip.h>
C. < stdmanip.h>
D. < iomanip.h>
Answer» E.
90.

Generic catch handler must be placed at the end of all the catch handlers.

A. True
B. False
Answer» B. False
91.

Generic catch handler is represented by ______________ .

A. catch(..,)
B. catch(---)
C. catch(…)
D. catch( void x)
Answer» D. catch( void x)
92.

Generic pointers can be declared with__________ .

A. auto
B. void
C. asm
D. None of these
Answer» C. asm
93.

Functions called from within a try block may also throw exception.

A. True
B. False
Answer» B. False
94.

Function overloading can also be achieved if two or more functions differ only in their return types.

A. True
B. False
Answer» C.
95.

Find the wrong statement/s about Abstract Class.

A. We can’t create its objects.
B. We can’t create pointers to an abstract class.
C. It contains at least one pure virtual function.
D. We can create references to an abstract class.
Answer» C. It contains at least one pure virtual function.
96.

Exception handlers are declared with ____________ keyword.

A. Try
B. catch
C. throw
D. Finally
Answer» C. throw
97.

During dynamic memory allocation in CPP, new operator returns _________ value if memory allocation is unsuccessful.

A. False
B.
C. Zero
D. None of these
Answer» C. Zero
98.

During a class inheritance in CPP, if the visibility mode or mode of derivation is not provided, then by default visibility mode is ___________.

A. public
B. protected
C. private
D. Friend
Answer» D. Friend
99.

Due to ios::trunc mode, the file is truncated to zero length.

A. True
B. False
Answer» B. False
100.

Default value of static variable is_____ .

A. 0
B. 1
C. Garbage value
D. Compiler dependent
Answer» B. 1