Explore topic-wise MCQs in Computer Science Mcqs.

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

51.

Which of the following operator is used to release the dynamically allocated memory in CPP?

A. remove
B. free
C. delete
D. both b and c
Answer» D. both b and c
52.

Static variable declared in a class are also called_________ .

A. instance variable
B. named constant
C. global variable
D. class variable
Answer» E.
53.

Which of the following is not a false statement about new operator?

A. It can’t be overloaded.
B. It returns garbage value when memory allocation fails.
C. It automatically computes the size of the data object.
D. All of these
Answer» D. All of these
54.

C structure differs from CPP class in regards that by default all the members of the structure are __________ in nature.

A. private
B. protected
C. public
D. None of these
Answer» D. None of these
55.

To create an output stream, we must declare the stream to be of class ___________ .

A. ofstream
B. ifstream
C. iostream
D. None of these
Answer» B. ifstream
56.

Run time polymorphism can be achieved with______ .

A. Virtual Base class
B. Container class
C. Virtual function
D. Both a and c
Answer» D. Both a and c
57.

Generic pointers can be declared with__________ .

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

Which of the following best defines the syntax for template function ?

A. Template
B. Template return_type Function_Name(Parameters)
C. Both a and b
D. None of these
Answer» D. None of these
59.

Catch handler can have multiple parameters.

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

Which of the followings are true about constructors? 1. A class can have more than one constructor. 2. They can be inherited. 3. Their address can be referred. 4. Constructors cannot be declared in protected section of the class. 5. Constructors cannot return values.

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

Which of the following are true about static member function? 1. They can access non-static data members. 2. They can call only other static member functions. 3. They can access global functions and data. 4. They can have this pointer. 5. They cannot be declared as const or volatile.

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

Static variable must be declared in public section of the class.

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

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
64.

Can constructors be overloaded?

A. Yes
B. No
Answer» B. No
65.

Default values for a function are need to be specified from left to right only.

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

Which of the followings is/are not false about friend function ? 1. It can be called / invoked with class object. 2. It has objects as arguments. 3. It can have built-in types as arguments. 4. It must declared only in public part of a class. 5. It does not have this pointer as an argument.

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

Default return type of functions in CPP is ____ .

A. void
B. long
C. char
D. Int
Answer» E.
68.

The derivation of Child class from Base class is indicated by ____ symbol.

A. ::
B. :
C. ;
D. |
Answer» C. ;
69.

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.
70.

Throwing an unhandled exception causes standard library function then _________ to be invoked.

A. stop()
B. aborted()
C. terminate()
D. Abandon()
Answer» D. Abandon()
71.

class X, class Y and class Z are derived from class BASE. This is ______ inheritance.

A. Multiple
B. Multilevel
C. Hierarchical
D. Single
Answer» D. Single
72.

A Constructor that does not have any parameters is called____________ Constructor.

A. Custom
B. Dynamic
C. Static
D. Default
Answer» E.
73.

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.
74.

_______________ 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
75.

Syntax for Pure Virtual Function is ______________ .

A. virtual void show()==0
B. void virtual show()==0
C. virtual void show()=0
D. void virtual show()=0
Answer» D. void virtual show()=0
76.

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

A. True
B. False
Answer» B. False
77.

When a class is defined inside any function or block, it is called ___________ .

A. Nested class
B. Block class
C. Local class
D. It is not possible
Answer» D. It is not possible
78.

A const object of a class can call non-const member function of the class.

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

Which of the followings are false statements about Local class? 1. A local class type name can only be used in the enclosing function 2. All the methods of Local classes must be defined inside the class only 3. A Local class can contain static data members. 4. A Local class may contain static functions. 5. Non-static variables of the enclosing function are not accessible inside local classes. 6. Local classes cannot access global types, variables and functions.

A. Only 1,3
B. Only 3, 6
C. Only 2 , 4 , 6
D. None of these
Answer» C. Only 2 , 4 , 6
80.

Can member functions of one class be friend functions of another class?

A. Yes
B. No
Answer» B. No
81.

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.
82.

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

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

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.
84.

When overloading unary operators using Friend function,it requires_____ argument/s.

A. Zero
B. One
C. Two
D. None of these.
Answer» C. Two
85.

Assume class TEST. Which of the following statements is/are responsible to invoke copy constructor?

A. TEST T2(T1)
B. TEST T4 = T1
C. T2 = T1
D. both a and b
E. All of these
Answer» E. All of these
86.

Which of the following statements are not true about destructor? 1. It is invoked when object goes out of the scope 2. Like constructor, it can also have parameters 3. It can be virtual 4. It can be declared in private section 5. It bears same name as that of the class and precedes Lambda sign.

A. Only 2, 3, 5
B. Only 2, 3, 4
C. Only 2, 4, 5
D. Only 3, 4, 5
Answer» D. Only 3, 4, 5
87.

A function can be declared as friend maximum only in two classes.

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

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
89.

____________ refers to the act of representing only essential features without including the background details.

A. Data Hiding
B. Data Encapsulation
C. Data Abstraction
D. All of these
Answer» D. All of these
90.

When a child class inherits traits from more than one parent class, this type of inheritance is called _______________ inheritance.

A. Hierarchical
B. Hybrid
C. Multilevel
D. Multiple
Answer» E.
91.

The code of statements which may cause abnormal termination of the program should be written under_________ block.

A. Try
B. catch
C. Finally
D. None of these
Answer» B. catch
92.

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

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

Which of the following are member dereferencing operators in CPP? 1. * 2. :: 3. ->* 4. ::* 5. ->

A. Only 1, 3, 4
B. Only 1 and 5
C. Only 3 and 4
D. Only 3,4,5
Answer» B. Only 1 and 5
94.

We can create objects of the abstract class.

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

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
96.

Classes in CPP are________ .

A. derived data types
B. User defined data types
C. built-in data types
D. All of these
Answer» C. built-in data types
97.

Using friend operator function, following perfect set of operators may not be overloaded.

A. = , ( ) , [ ] , ->
B. <>
C. ?, = , ( ) , ++
D. None of these
Answer» B. <>
98.

An operator function is created using _____________ keyword.

A. iterator
B. allocator
C. constructor
D. operator
Answer» E.
99.

Can we define our exceptions in CPP?

A. Yes
B. No
Answer» B. No
100.

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.