100+ CPP MCQ
100+ CPP MCQ
Sr.No
Project Name YouTube Link
11 Tour and Travel System Project version 3.0 https://youtu.be/Dm7nOdpasWg?si=P_Lh2gcOFhlyudug
12 Gym Management system Project https://youtu.be/J8_7Zrkg7ag?si=LcxV51ynfUB7OptX
13 Online Driving License system Project https://youtu.be/3yRzsMs8TLE?si=JRI_z4FDx4Gmt7fn
14 Online Flight Booking system Project https://youtu.be/m755rOwdk8U?si=HURvAY2VnizIyJlh
15 Employee management system project https://youtu.be/lD1iE3W_GRw?si=Y_jv1xV_BljhrD0H
16 Online student school or college portal https://youtu.be/4A25aEKfei0?si=RoVgZtxMk9TPdQvD
17 Online movie booking system project https://youtu.be/Lfjv_U74SC4?si=fiDvrhhrjb4KSlSm
18 Online Pizza Delivery system project https://youtu.be/Tp3izreZ458?si=8eWAOzA8SVdNwlyM
19 Online Crime Reporting system Project https://youtu.be/0UlzReSk9tQ?si=6vN0e70TVY1GOwPO
20 Online Children Adoption Project https://youtu.be/3T5HC2HKyT4?si=bntP78niYH802I7N
pg. 4 contact us on 8007592194 / 9284926333 www.codewitharrays.in
1. Which of the followings is/are automatically added to every class, if we do not write our own?
A. Copy Constructor
B. Assignment Operator
A. void
B. char
C. int
D. no
Answer» D. no
discuss
A. All 1, 2, and 3
B. Only 1 and 3
C. Only 1 and 2
D. Only 2 and 3
A. Compiler Error
B. Runtime Error
C. Constructor called
7. #include<iostream>
using namespace std;
class Point {
public:
Point() { cout << "Constructor called"; }
};
int main()
{
Point t1, *t2;
return 0;
}
A. Compiler Error
C. Constructor called
A. postfix
B. unary
C. shift
D. equality
Answer» D. equality
discuss
C. Once a reference is created, it cannot be later made to reference another object; it cannot be reset.
B. Copy Constructor
C. Destructor
D. Parameterized constructor
A. x = 20; ref = 30
B. x = 20; ref = 20
C. x = 10; ref = 30
D. x = 30; ref = 30
A. All members of a structure are public and structures don’t have constructors and destructors
Members of a class are private by default and members of struct are public by default. When deriving a struct from a
B. class/struct, default access-specifier for a base class/struct is public and when deriving a class, default access specifier is
private.
C. All members of a structure are public and structures don’t have virtual functions
Answer» B. Members of a class are private by default and members of struct are public by default. When deriving a struct from a
class/struct, default access-specifier for a base class/struct is public and when deriving a class, default access specifier is private.
discuss
A. A non-zero value
B. 0
C. Compiler Error
D. Runtime Error
A. 0
B. Garbage Value
C. Compiler Error
D. None
B. Objects of a class do not share non-static members. Every object has its own copy.
C. Objects of a class do not share codes of non-static methods, they have their own copy
Answer» B. Objects of a class do not share non-static members. Every object has its own copy.
discuss
16. A member function can always access the data in __________, (in C++).
17. Which of the following is not correct for virtual function in C++?
A. (1)
B. (2), (4)
D. (4)
A. Constant
B. Structure
C. Array
D. Header file
A. Constructor
B. Destructor
C. Data members
D. Virtual methods
A. Composition is a strong type of association between two classes with full ownership.
B. Composition is a strong type of association between two classes with partial ownership.
C. Composition is a weak type of association between two classes with partial ownership.
D. Composition is a weak type of association between two classes with strong ownership.
Answer» A. Composition is a strong type of association between two classes with full ownership.
discuss
23. When a method in a subclass has the same name and type signatures as a method in the superclass, then
the method in the subclass _____ the method in the superclass.
A. Overloads
Answer» D. Overrides
23. When a method in a subclass has the same name and type signatures as a method in the superclass, then
the method in the subclass _____ the method in the superclass.
B. Friendships
C. Inherits
D. Overrides
Answer» D. Overrides
discuss
24. It is possible to define a class within a class termed as nested class. There are _____ types of nested classes.
A. 2
B. 3
C. 4
D. 5
Answer» A. 2
discuss
25. When one object reference variable is assigned to another object reference variable then
D. it is illegal to assign one object reference variable to another object reference variable.
A. Static function
B. Friend function
C. Const function
D. Virtual function
27. How can we restrict dynamic allocation of objects of a class using new?
29. Which of the following operators are overloaded by default by the compiler in every user defined classes
even if user has not written? 1) Comparison Operator (==) 2) Assignment Operator (=)
A. Both 1 and 2
B. Only 1
C. Only 2
Answer» C. Only 2
discuss
30. Which of the following operators should be preferred to overload as a global function rather than a
member method?
A. Postfix ++
B. Comparison Operator
D. Prefix++
31. How C++ compiler does differ between overloaded postfix and prefix operators?
A. new
B. delete
C. Conversion Operator
A. When local variable’s name is same as member’s name, we can access member using this pointer.
A. Inheritance
B. Polymorphism
C. Encapsulation
Answer» B. Polymorphism
discuss
A. 10
B. 0
C. 20
D. Compiler Error
A. Compiler Error
Answer» B. 5
B. 5
C. 0
D. 10
Answer» B. 5
discuss
D. Static methods can only access static members (data and methods)
Answer» D. Static methods can only access static members (data and methods)
discuss
B. Friend functions are not members of a class, they are associated with it.
D. It can have access to all members of the class, even private ones.
40. Which one of the following is correct, when a class grants friend status to another class?
A. The member functions of the class generating friendship can access the members of the friend class.
All member functions of the class granted friendship have unrestricted access to the members of the class granting the
B.
friendship.
Answer» B. All member functions of the class granted friendship have unrestricted access to the members of the class granting
the friendship.
40. Which one of the following is correct, when a class grants friend status to another class?
Answer» B. All member functions of the class granted friendship have unrestricted access to the members of the class granting
the friendship.
discuss
A. Only 1, 2 and 3
B. Only 1, 2 and 4
C. All
D. Only 1, 3 and 4
Answer» C. All
discuss
42. How to create a dynamic array of pointers (to integers) of size 10 using new in C++? Hint: We can create a
non-dynamic array using int *arr[10]
D. Not Possible
43. Which of the following is true about new when compared with malloc:
1) new is an operator, malloc is a function
2) new calls constructor, malloc doesn’t
3) new returns appropriate pointer, malloc returns void * and pointer needs to typecast to appropriate type.
A. 1 and 3
B. 2 and 3
C. 1 and 2
D. All 1, 2 and 3
A. Compiler Error
B. 5
C. Garbage Value
D. 0
A. Yes
B. No
C. none
D. all
Answer» B. No
discuss
46. When the inheritance is private, the private methods in base class are __________ in the derived class (in
C++).
A. inaccessible
B. accessible
C. protected
D. public
Answer» A. inaccessible
discuss
A. Compiler Error
B. Run-time Crash
C. No Error
D. None
Answer» C. No Error
discuss
A. Virtual functions are functions that can be overridden in derived class with the same signature.
If a function is ‘virtual’ in the base class, the most-derived class implementation of the function is called according to the
C. actual type of the object referred to, regardless of the declared type of the pointer or reference. In non-virtual functions, the
functions are called according to the type of reference or pointer.
A. Both 1 and 2
B. Only 1
C. Only 2
D. Neither 1 nor 2
Answer» C. Only 2
discuss
50. What is the size of wchar_t in C++?
A. 2
B. 4
C. 2 or 4
A. 1 and 2
B. 1, 2 and 3
C. 1, 2 and 4
D. 1, 2, 3 and 4
Answer» D. 1, 2, 3 and 4
discuss
A. array type
B. character type
C. Boolean type
D. integer type
A. int
B. short
Answer» C. void
54. Which data type is used to represent the absence of parameters?
C. void
D. float
Answer» C. void
discuss
A. alert
B. backslash
C. tab
D. form feed
Answer» A. alert
discuss
A. integer
B. Boolean
C. character
Answer» B. Boolean
discuss
A. enumeration
B. classes
D. int
A. f is a function taking an argument of type int and returning a floating point number
A. double
B. void
C. int
D. bool
Answer» A. double
discuss
60. When a language has the capability to produce new data type mean, it can be called as …...
A. overloaded
B. extensible
C. encapsulated
D. reprehensible
Answer» B. extensible
discuss
A. /
B. ( )
C. ::
D. %
Answer» C. ::
discuss
A. _
B. _ _
C. ++ (postfix version)
D. =
Answer» D. =
discuss
63. Class function which is called automatically as soon as the object is created is called as __
A. Constructor
B. Destructor
Answer» A. Constructor
63. Class function which is called automatically as soon as the object is created is called as __
C. Friend function
D. Inline function.
Answer» A. Constructor
discuss
C. Binary file
A. string_cmp()
B. strcmp()
C. equals()
D. str_compare()
Answer» B. strcmp()
discuss
66. 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» A. Only 1, 3, 4
discuss
A. ->*
B. .*
C. ::*
D. both A and B
Answer» C. ::*
discuss
68. Assigning one or more function body to the same name is called ____________.
A. Function Overriding
B. Function Overloading
C. Both A and B
A. Function is defined
B. Function is declared
C. Both a and b
D. None of these
70. Which of the following best defines the syntax for template function?
A. Template
C. Both a and b
D. None of these
A. int
B. bool
C. char *
D. double
Answer» B. bool
discuss
72. If inner catch handler is not able to handle the exception then__________.
Answer» C. Compiler will check for appropriate catch handler of outer try block
72. If inner catch handler is not able to handle the exception then__________.
C. Compiler will check for appropriate catch handler of outer try block
D. None
Answer» C. Compiler will check for appropriate catch handler of outer try block
discuss
73. Attempting to throw an exception that is not supported by a function call results in calling _____________
library function.
A. indeterminate ()
B. unutilized()
C. unexpected()
D. unpredicted()
Answer» C. unexpected()
discuss
74. 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» A. Try
discuss
A. Overloading
B. Overriding
C. Rewriting
D. All of these
Answer» B. Overriding
discuss
76. While overloading binary operators using member function, it requires ___ argument/s.
A. Zero
B. One
C. Two
Answer» B. One
76. While overloading binary operators using member function, it requires ___ argument/s.
D. Three
Answer» B. One
discuss
A. Function call
B. Function definition
C. Function prototype
D. Both B or C
78. For automatic objects, constructors and destructors are called each time the objects
C. are constructed
D. are destroyed
A. Operator-&
B. Operator-
C. Operator-&&
D. Operator +
Answer» C. Operator-&&
discuss
80. When an ADT is implemented as a C++ class, which of the following should normally be true?
A. Actual parameter
B. Declared parameter
C. Passed parameter
D. None
82. What kind of error can arise when there is a problem with memory?
A. Segmentation fault
B. Produce an error
B. Resource cleanup
A. Memory management
B. Allocator interface
C. Memory interface
A. Iterator
B. Indirect
Answer» A. Iterator
discuss
87. In which type of storage location are the vector members stored?
A. Restricted interface
B. More interface
C. No interface
D. None
A. Insertion
B. Deletion
D. None
A. dynamic_cast()
B. typeid
D. None
A. Compile-time construct
B. Runtime construct
D. None
92. Which function is used to position back from the end of file object?
A. seekg
B. seekp
D. None
Answer» A. seekg
discuss
A. const
B. volatile
C. const or volatile
D. int
95. Which is the pointer which denotes the object calling the member function?
A. Variable pointer
B. This pointer
C. Null pointer
D. Zero pointer
A. Code reusability
B. Code efficiency
D. Encapsulation
98. When are the pointer types known for upcasting the objects?
A. Compile time
B. Runtime
A. vector
B. deque
C. sort
https://www.instagram.com/codewitharrays/
https://codewitharrays.in/project