CPP MCQ PART – 4



PAGES: 1     2     3     4     6     7 


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

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

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

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

CHECK ANSWERS


PAGES: 1     2     3     4     6     7