Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Author Archive MANOJ AGARWAL

Multiple Choice Questions in C++ (Set-XIV)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-XIV) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

131. When an object of a derived class is created
a) derived class constructor is called followed by base class constructor
b) base class constructor is called followed by derived class constructor
c) base class constructor is not called at all
d) none of the above

132. The derived class constructor
a) never passes any values to base class constructor
b) is responsible for passing the entire test of arguments needed by base class constructors
c) can pass arguments only to one base class constructor function
d) none of the above

133. A virtual base class
a) allows to inherit more than one copy of the base class members
b) strict the path of inheritance
c) is qualified as virtual in base class definition
d) none of the above

134. When a base class is inherited publicly
a) the private members of the base class are not accessible
b) the derived class can directly access the private members of the base class
c) the derived class can access the private members only through the member function of the base class
d) none of the above

135. When two or more classes are used within another class definition, it is
a) inheritance
b) aggregation
c) both (a) & (b)
d) none of the above

136. Composition is referred to as
a) “is a” relationship
b) “has a” relationship
c) both (a) & (b)
d) none of the above

137. Inheritance is referred to as
a) “is a” relationship
b) “has a” relationship
c) Both (a) & (b)
d) none of the above

138. An explicitly defined destructor function
a) may be virtual
b) may not be virtual
c) both (a) & (b)
d) None of the above

139. The copy operation by a simple assignment causes in some cases
a) no effect
b) hollow copy
c) copy exactly the same as original
d) creates new

140. Public data members can be accessed
a) only from the base class itself
b) both form the base class and from its derived class
c) from the class which is a friend of the base class
d) none of the above




Solution Set to Multiple Choice Questions

(131)      B          (132)      B

(133)      C          (134)      C          (135)      B          (136)      B

(137)      A          (138)      A          (139)      B          (140)      C



Multiple Choice Questions in C++ (Set-XIII)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-XIII) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

121. Operator overloading is
a) making c++ operators work with objects
b) giving c++ operators more than they can handle
c) giving new meaning to existing c++ operators
d) making new c++ operators

122. To convert from a user defined class to a basic type, you would most likely use
a) a built-in conversion function
b) a one-argument constructor
c) an overloaded-operator
d) a conversion function that’s member of the class

123. The members of a class
a) by default are public
b) by default are private
c) are made private by declaring as private
d) none of the above]

124. The following symbol indicates the derived class is derived from the base class
a) ::
b) :
c) ->
d) none of the above

125. When a base class publicly inherited
a) the public members of the base class are inherited as private
b) the private members are inherited as private
c) the protected members are inherited as protected
d) none of the above

126. When a base class is privately inherited by derived class
a) the public members of the base class becomes the private members of the derived class
b) the private members are not inherited
c) the protected members of the base class becomes the private members of the derived class
d) All of the above

127. Only one copy of the class is inherited, when it is defined as
a) virtual
b) static
c) public
d) none of the above

128. A class that acts only as a base class and is not used to create objects is
a) parent class
b) super class
c) abstract class
d) none of the above

129. The version of a virtual function actually gets called during runtime is based solely up in the type of the object that is
a) being instantiated and processed by the function
b) in the derived class
c) being pointed to by a base class pointer
d) being passed to the function

130. In multiple inheritance, the base classes are constructed
a) in the order of declaration in the derived class
b) in the order of declaration in the program.
c) in the order of definition of a class
d) none of the above




Solution Set to Multiple Choice Questions

(121)      C          (122)      D          (123)      B          (124)      B

(125)      C          (126)      D          (127)      A          (128)      C

(129)      C          (130)      A         



Multiple Choice Questions in C++ (Set-XII)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-XII) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

111. The following feature supports extensibility and reusability of classes
a) function overloading
b) inheritance
c) operator overloading
d) data encapsulation

112. The process of deriving a class from another derived class is
a) single inheritance
b) multilevel inheritance
c) multiple inheritance
d) none of the above

113. When a derived class inherits only from one class and is not further inherited is
a) single inheritance
b) multiple inheritance
c) multilevel inheritance
d) hybrid inheritance

114. When a derived class inherits from may base classes it is
a) multilevel inheritance
b) single inheritance
c) multiple inheritance
d) none of the above

115. Inheritance is ……….. in nature
a) transitive
b) intransitive
c) both (a) & (b)
d) none of the above

116. ……………. variables cannot be declared
a) structure
b) pointer
c) void
d) class

117. When a subclass inherits from multiple base classes, which inherits from a single class, the inheritance type is
a) single inheritance
b) hybrid inheritance
c) multilevel inheritance
d) multiple inheritance

118. When one class inherits from the base class, then the original class is called
a) base class
b) derived class
c) sub class
d) none of the above

119. The default visibility mode while inheriting is
a) private
b) public
c) protected
d) none of the above

120. The class intended to be a base class should use visibility mode as
a) public
b) protected
c) private
d) Both (a) & (b)




Solution Set to Multiple Choice Questions

(111)      B          (112)      B

(113)      A          (114)      C          (115)      A          (116)      C

(117)      B          (118)      A          (119)      A          (120)      D



Multiple Choice Questions in C++ (Set-XI)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-XI) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

101. The following operators cannot be overloaded
a) scope resolution operator
b) size of operator
c) conditional operator
d) all of the above

102. The operator definition precedes with the keyword class
a) class
b) operator
c) overload
d) none of the above

103. The operator function
a) is declared in the public section of the class
b) may be a member function or a friend function
c) both (a) & (b)
d) none of the above

104. The operator functions may be invoked
a) implicitly
b) explicitly
c) both (a) & (b)
d) none of the above

105. The following operator can’t be overloaded
a) unary
b) binary
c) ternary
d) none of the above

106. Which of the following statements regarding operator overloading function is false?
a) While overloading, the semantics of an operator cannot be changed.
b) The operator precedence cannot be changed while overloading.
c) The overloaded operator must have at least one operand that is of user-defined type.
d) You can create new operator symbol.

107. The following operators cannot be overloaded.
a) Logical AND (&&)
b) Subscript operator ([])
c) Equality operator (==)
d) none of the above

108. A unary operator when overloaded takes
a) no operand
b) one operand
c) two operands
d) none of the above]

109. The no of arguments required when overloading through friend functions is
a) Zero
b) One
c) Two
d) None of the above

110. Which of the following statements regarding operator overloading is false?
a) friend function cannot be used to overload certain operators.
b) Unary operators overloaded by means of friend functions takes no argument
c) Binary operators must explicitly return a value
d) The syntax rules of the operators cannot be overridden.




Solution Set to Multiple Choice Questions

(101)      D          (102)      B          (103)      C          (104)      C

(105)      C          (106)      D          (107)      D          (108)      B

(109)      C          (110)      B         



Multiple Choice Questions in C++ (Set-X)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-X) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

91. Which of the following statements regarding operator overloading is not true?
a) New operators cannot be created while overloading
b) The semantics of an operator cannot be changed while overloading
c) Subscript operator([]) can be overloaded
d) None of the above

92. Which of the following statements can be overloaded?
a) Size of operator
b) Scope resolution operator (::)
c) Class member access operator (->)
d) Pointer to member operator

93. Operator functions
a) Can return a value
b) Cannot return a value
c) May return values of limited data types
d) None of the above

94. While overloading, a unary operator
a) Takes no arguments
b) Takes one argument
c) Takes two arguments
d) None of the above
95. While overloading, a binary operator
a) takes no argument
b) takes one argument
c) takes two arguments
d) none of the above

96. Which of the following operators cannot be overloaded?
a) increment and decrement operator
b) function call operator, ()
c) subscript operator, []
d) none of the above

97. When an arithmetic assignment operator is overloaded, the result
a) goes in the object to the left of the operator
b) goes in the object to the right of the operator
c) goes in the object of which the operator is a member
d) none of the above

98. The function that overloads as operator, precedes with the keyword
a) function
b) operator
c) virtual
d) static

99. The symbol **
a) can be overloaded
b) cannot be overloaded as it is not a C++ operator
c) cannot be overloaded, as on overloading its meaning shall be changed
d) none of the above

100. The stream insertion and extraction operators should be overloaded as
a) friend functions
b) member function
c) non member functions
d) none of the above




Solution Set to Multiple Choice Questions

(91)       D          (92)       C

(93)       A          (94)       A          (95)       B          (96)       D

(97)       A          (98)       B          (99)       B          (100)      A



Multiple Choice Questions in C++ (Set-IX)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-IX) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

81. Variable …………. of void type
a) May be declared
b) Cannot be declared
c) Can be initialized
d) None of the above

82. A destruction function
a) Takes no argument and has no return type not even void
b) Has name similar to that of class, preceded by tilde(~) symbol
c) Is used to destruct an object, constructed through constructor function
d) All of the above

83. Which of the following statements regarding destructor function is false?
a) Destructors do not accept any arguments, nor do they return any values
b) Destructors can be inherited
c) Member functions may be called from within a destructor
d) Destructor functions are called automatically when an object is destroyed

84. Function overloading
a) Involves several function definitions under one name, but different argument types
b) Implements polymorphism
c) Reduces the number of comparison in a program, hence increases the execution speed of a program
d) All of the above

85. The signature of function is
a) The number & type of arguments
b) The return type of a function
c) The class definition
d) None of the above

86. Overloading of constructor function
a) is similar to function overloading
b) different from an overloaded function as it can’t return a value
c) not permitted in C++
d) none of the above

87. The binding of a function call at runtime is
a) Static binding
b) Early binding
c) Late binding
d) Runtime binding

88. The process of giving special meaning to an operator is
a) Operator overloading
b) Operator mechanism
c) Operator definition
d) None of the above

89. The function used to define the task assigned to an operator is
a) Virtual function
b) Operator function
c) Static function
d) None of the above

90. The following operators can not be overloaded
a) Unary operator
b) Binary operator
c) Ternary operator
d) None of the above




Solution Set to Multiple Choice Questions

(81)       B          (82)       D          (83)       B          (84)       D

(85)       A          (86)       B          (87)       C          (88)       A

(89)       B          (90)       C         



Multiple Choice Questions in C++ (Set-VIII)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-VIII) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

71. The class of which the objects are not instantiated is
a) Abstract class
b) Virtual class
c) Static class
d) None of the above

72. && denotes
a) logical OR
b) logical AND
c) Bitwise AND
d) None of the above

73. The parameterized constructor
a) Needs initial values as arguments during creation of an object
b) Can be invoked explicitly only
c) Can be invoked implicitly only
d) None of the above

74. Explicit call to a constructor means
a) Providing the constructor name explicitly to invoke it
b) Not providing the construction name at all
c) Is the shorthand method
d) None of the above

75. Classes in C++ are
a) Fundamental data type
b) Primitive data type
c) Desired data type
d) None of the above

76. A copy constructor is called
a) When an object is defined and initialized with another object
b) When an object is passed by value
c) When a function returns an object
d) All of the above

77. Which of the following regarding constructor function is false?
a) Constructor functions don’t have return type, not even void
b) Constructors can’t be inherited
c) We can refer to their addresses
d) Constructors cannot be virtual

78. If new operator is used, then the constructor function is
a) Parameterized constructor
b) Copy constructor
c) Dynamic constructor
d) Default constructor

79. Which of the following statements regarding constructor is false?
a) A constructor may be defined static
b) Constructor can have default arguments
c) Member functions may be invoked from within a constructor
d) None of the above

80. The antonym of constructor is
a) Creator
b) Destructor
c) Destroyer
d) None of the above




Solution Set to Multiple Choice Questions

(71)       A          (72)       B

(73)       A          (74)       A          (75)       C          (76)       D

(77)       C          (78)       C          (79)       A          (80)       B



Multiple Choice Questions in C++ (Set-VII)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-VII) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

61. A constructor function is
a) A friend function to a class
b) A member function with the same name as its class
c) A non-member function
d) None of the above

62. An enumerated type is composed of
a) Integer values with user defined name
b) Variables of different data types
c) Constant numeric values
d) None of the above

63. In C++, the arguments by default are passed by
a) call be reference
b) call be value
c) both (a) & (b)
d) none of the above

64. ? is an example of
a) unary operator
b) binary operator
c) ternary operator
d) none of the above

65. new operator is used
a) to define a new variable
b) to create a new data type
c) to allocate memory dynamically
d) none of the above

66. A constructor function is generally defined
a) In the public section of a class
b) In the private section of a class
c) In the protected section of a class
d) None of the above

67. A class having no public constructors is
a) A private class
b) A public class
c) An abstract class
d) None of the above

68. If a constructor function is defined in private section of a class, then
a) The object cannot be created
b) Only member functions and friends may declare objects of the class
c) Both (a) & (b)
d) None of the above

69. A constructor with no argument is
a) Default constructor
b) Parameterized constructor
c) Copy constructor
d) None of the above

70. If default arguments are provided to a constructor function, then it becomes
a) Default constructor
b) Copy instructor
c) Parameterized constructor
d) None of the above




Solution Set to Multiple Choice Questions

(61)       B          (62)       A          (63)       B          (64)       C

(65)       C          (66)       A          (67)       A          (68)       C

(69)       A          (70)       A         



Multiple Choice Questions in C++ (Set-VI)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-VI) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

51. When a member function of a class call another member function, it is
a) Nesting of classes
b) Nesting of functions
c) Nesting of objects
d) None of the above

52. A function defined inside a class is called
a) A class function
b) A friend function
c) A member function
d) None of the above

53. Information is made shareable through
a) inheritance
b) data encapsulation
c) data abstraction
d) none of the above

54. Functions can returns
a) arrays
b) reference
c) object
d) all of the above

55. The memory for date members is allocated
a) When a class is defined
b) When an object is initialized
c) When an object is created
d) None of the above

56. The memory for member functions is allocated
a) When a class is defined
b) When a object is created
c) When an object is initialized
d) None of the above

57. The dot operator relates
a) A class member and a class object
b) A class object and a class
c) A class and a member of that class
d) A class object and member of that class

58. A class having another class definition is
a) Nested class
b) Subordinate class
c) Enclosing class
d) None of the above

59. A class whose member functions are friends of other class is
a) Friend class
b) Abstract class
c) Virtual class
d) None of the above

60. The data members of a class are initialized
a) in class definition
b) by a non-member function
c) through constructor function when a class object is created
d) none of the above




Solution Set to Multiple Choice Questions

(51)       B          (52)       C

(53)       A          (54)       D          (55)       B          (56)       A

(57)       D          (58)       C          (59)       A          (60)       C



Multiple Choice Questions in C++ (Set-V)

March 7, 2021 Comments Off on Multiple Choice Questions in C++ (Set-V) By MANOJ AGARWAL
Multiple Choice Questions in C++




Multiple choice questions in C++ (With answers)

41. The default scope for a structure is
a) Private
b) Public
c) Protected
d) None of the above

42. The private data members of a class are accessible
a) Directly to objects of that class
b) Only to the member functions
c) To any function defined outside a class
d) None of the above

43. The objects can directly access
a) Public members
b) Private members
c) Both (a) & (b)
d) None of the above

44. The following is a valid statement in C++
a) int x=(int)2.50;
b) int x=int(2.50);
c) Both (a) & (b)
d) None of the above

45. Which of the following operator can be overloaded
a) Member access operator ( . & .*)
b) Conditional operator (?:)
c) Scope resolution operator (::)
d) None of the above

46. Using same function name to perform different tasks is
a) Function polymorphism
b) Runtime polymorphism
c) Function prototype
d) None of the above

47. Default argument is
a) Specified in function definition
b) Specified in function declaration
c) Specified from left to right
d) None of the above

48. What is wrong with the following statement?
float s_interest (float principal, int rate=0.25, int time);

a) variables must not be specified in function prototype
b) arguments may only be defaulted from right to left
c) the default value must be specified when making a function call
d) none of the above

49. Which of the following statements regarding function overloading is not true.
a) If is used to handle different data types at one place
b) When making a function call, if no exact match is found, promotion is the only criteria to find a match.
c) The default arguments can not be used instead of overloading
d) Unrelated functions should not be overloaded

50. The private members of a class implement the OOP concept of
a) Data abstraction
b) Data hiding
c) Message passing
d) None of the above




Solution Set to Multiple Choice Questions

(41)       B          (42)       B          (43)       A          (44)       C

(45)       D          (46)       A          (47)       B          (48)       B

(49)       C          (50)       B         



x Close

Like Us On Facebook

You cannot copy content of this page.