Que- Which is the correct condition for function overriding?
a. The declaration must not be same in base and derived class
b. The declaration must be exactly the same in base and derived class
c. The declaration should have at least 1 same argument in declaration of base and derived class
d. The declaration should have at least 1 different argument in declaration of base and derived class
Ans- The declaration must be exactly the same in base and derived class
Que- Exactly same declaration in base and derived class includes______________
a. Only same name
b. Only same return type and name
c. Only same return type and argument list
d. All the same return type, name and parameter list
Ans- All the same return type, name and parameter list
Que- How to access the overridden method of base class from the derived class?
a. Using arrow operator
b. Using dot operator
c. Using scope resolution operator
d. Can't be accessed once overridden
Ans- Using scope resolution operator
Que- The functions to be overridden _____________
a. Must be private in base class
b. Must not be private base class
c. Must be private in both derived and base class
d. Must not be private in both derived and base class
Ans- Must not be private base class
Que- Which language doesn't support method overriding implicitly?
a. C++
b. C Sharp
c. Java
d. SmallTalk
Ans- C Sharp
Que- In C Sharp ____________________
a. Non- virtual or static methods can't be overridden
b. Non- virtual and static methods only can be overridden
c. Overriding is not allowed
d. Overriding must be implemented using C++ code only
Ans- Non- virtual or static methods can't be overridden
Que- In Delphi ______________
a. Method overriding is done implicitly
b. Method overriding is not supported
c. Method overriding is done with directive override
d. Method overriding is done with the directive virtually
Ans- Method overriding is done with directive override
Que- What should be used to call the base class method from the derived class if function overriding is used in Java?
a. Keyword super
b. Scope resolution
c. Dot operator
d. Function name in parenthesis
Ans- Keyword super
Que- In Kotlin, the function to be overridden must be ______________
a. Private
b. Open
c. Closed
d. Abstract
Ans- Open
Que- Abstract functions of a base class _________________
a. Are overridden by the definition in same class
b. Are overridden by the definition in parent class
c. Are not overridden generally
d. Are overridden by the definition in derived class
Ans- Are overridden by the definition in derived class
Que- If virtual functions are defined in the base class then _______________
a. It is not necessary for derived classes to override those functions
b. It is necessary for derived classes to override those functions
c. Those functions can never be derived
d. Those functions must be overridden by all the derived classes
Ans- It is not necessary for derived classes to override those functions
Que- Which feature of OOP is exhibited by the function overriding?
a. Inheritance
b. Abstraction
c. Polymorphism
d. Encapsulation
Ans- Polymorphism
Que- What are constant member functions?
a. Functions which doesn't change value of calling object
b. Functions which doesn't change value of any object inside definition
c. Functions which doesn't allow modification of any object of class
d. Functions which doesn't allow modification of argument objects
Ans- Functions which doesn't change value of calling object
Que- Which keyword must be used to declare a member function as a constant member function?
a. Constant
b. Const
c. FunctionConst
d. Unchanged
Ans- Const
Que- Which objects can call the const functions?
a. Only const objects
b. Only non-const objects
c. Both const and non-const objects
d. Neither const not non-const objects
Ans- Both const and non-const objects
Que- Non-const functions _______________________
a. Can be called only from non-const object
b. Can be called only from const object
c. Can be called both by const and non-const object
d. Can't be called with object
Ans- Can be called only from non-const object
Que- Which is a correct condition on const member functions?
a. Const member functions can't call non-const member functions
b. Const member functions can't call any other function
c. Const member functions can call only the functions which are neither const nor non-const
d. Const member functions can call only data members of call not member functions
Ans- Const member functions can't call non-const member functions
Que- If a const object calls a non-const member function then ____________________
a. Run time error may get produced
b. Compile time error may get produced
c. Either compile time or run time error is produced
d. The program can't be compiled
Ans- Compile time error may get produced
Que- Can a constructor function be constant?
a. Yes, always
b. Yes, only if permissions are given
c. No, because objects are not involved
d. No, never
Ans- No, never
Que- How is it possible to have both const and non-const version of a function?
a. Function overriding
b. Function prototyping
c. Function overloading
d. Function declaring
Ans- Function overloading
Que- When both the const and non-const version of a functions are required?
a. Return value have to be different in const
b. Return value have to be same in const
c. Return values have to be ignored
d. Return values have to be suppressed
Ans- Return value have to be different in const
Que- If a function is to be made const, which is the correct syntax?
a. const functionName(parameters);
b. const returnType functionName(parameters);
c. const functionName(returnType)(Parameters);
d. const (functionName(parameters));
Ans- const returnType functionName(parameters);
Que- Functions which differ in const-ness are considered ______________________
a. To have same signature
b. To have different signature
c. To produce compile time error
d. To produce runtime error
Ans- To have different signature
Que- If const version of a function when overloading is used, the function ___________________
a. Returns reference to object
b. Returns volatile reference
c. Returns mutable reference
d. Returns const reference
Ans- Returns const reference
Que- Which among the following is recommended for const functions?
a. Const function use should be reduced in a program
b. Const function use should be more in a program
c. Const function use should not matter in a program
d. Const function use should be able to modify the values
Ans- Const function use should be more in a program
Que- Use of const member function in a program _________________________
a. Is mandatory, always
b. Is optional, always
c. Is mandatory, if objects are used
d. Is optional, if const objects are used
Ans- Is optional, always
Que- Which is private member functions access scope?
a. Member functions which can only be used within the class
b. Member functions which can used outside the class
c. Member functions which are accessible in derived class
d. Member functions which can't be accessed inside the class
Ans- Member functions which can only be used within the class
Que- Which among the following is true?
a. The private members can't be accessed by public members of the class
b. The private members can be accessed by public members of the class
c. The private members can be accessed only by the private members of the class
d. The private members can't be accessed by the protected members of the class
Ans- The private members can be accessed by public members of the class
Que- Which member can never be accessed by inherited classes?
a. Private member function
b. Public member function
c. Protected member function
d. All can be accessed
Ans- Private member function
Que- Which syntax among the following shows that a member is private in a class?
a. private: functionName(parameters)
b. private(functionName(parameters))
c. private functionName(parameters)
d. private::functionName(parameters)
Ans- private functionName(parameters)
Que- If private member functions are to be declared in C++ then _____________
a. private:
b. private
c. private(private member list)
d. private :- <private members>
Ans- private:
Que- In java, which rule must be followed?
a. Keyword private preceding list of private member's
b. Keyword private with a colon before list of private member's
c. Keyword private with arrow before each private member
d. Keyword private preceding each private member
Ans- Keyword private preceding each private member
Que- How many private member functions are allowed in a class ?
a. Only 1
b. Only 7
c. Only 255
d. As many as required
Ans- As many as required
Que- How to access a private member function of a class?
a. Using object of class
b. Using object pointer
c. Using address of member function
d. Using class address
Ans- Using address of member function
Que- Private member functions ____________
a. Can't be called from enclosing class
b. Can be accessed from enclosing class
c. Can be accessed only if nested class is private
d. Can be accessed only if nested class is public
Ans- Can't be called from enclosing class
Que- Which function among the following can't be accessed outside the class in java in same package?
a. public void show()
b. void show()
c. protected show()
d. static void show()
Ans- protected show()
Que- If private members are to be called outside the class, which is a good alternative?
a. Call a public member function which calls private function
b. Call a private member function which calls private function
c. Call a protected member function which calls private function
d. Not possible
Ans- Call a public member function which calls private function
Que- Which error will be produced if private members are accessed?
a. Can't access private message
b. Code unreachable
c. Core dumped
d. Bad code
Ans- Can't access private message
Que- Can main() function be made private?
a. Yes, always
b. Yes, if program doesn't contain any classes
c. No, because main function is user defined
d. No, never
Ans- No, never
Que- If a function in java is declared private then it __________________
a. Can't access the standard output
b. Can access the standard output
c. Can't access any output stream
d. Can access only the output streams
Ans- Can access the standard output
Que- What are public member functions?
a. Functions accessible outside the class but not in derived class
b. Functions accessible outside the class directly
c. Functions accessible everywhere using object of class
d. Functions that can't be accessed outside the class
Ans- Functions accessible everywhere using object of class
Que- Which among the following is true for public member functions?
a. Public member functions doesn't have a return type
b. Public member functions doesn't have any security
c. Public member functions are declared outside the class
d. Public member functions can be called using object of class
Ans- Public member functions can be called using object of class
Que- Which type of member functions get inherited in the same specifier in which the inheritance is done? (If private inheritance is used, those become private and if public used, those become publi
a. Private member functions
b. Protected member functions
c. Public member functions
d. All member functions
Ans- Public member functions