InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
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 virtuallyThis question was posed to me at a job interview.My doubt is from Overriding Member Functions in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct answer is (c) Method overriding is done with directive override |
|
| 52. |
In C# ____________________(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 onlyThe question was posed to me in an interview for internship.This intriguing question comes from Overriding Member Functions topic in section Member Functions & its Types of Object Oriented Programming |
|
Answer» Right CHOICE is (a) NON – virtual or STATIC methods can’t be OVERRIDDEN |
|
| 53. |
Which language doesn’t support the method overriding implicitly?(a) C++(b) C#(c) Java(d) SmallTalkThe question was asked during an interview.I would like to ask this question from Overriding Member Functions topic in section Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct answer is (b) C# |
|
| 54. |
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 classThe question was asked in an online interview.I'd like to ask this question from Overriding Member Functions in division Member Functions & its Types of Object Oriented Programming |
|
Answer» The CORRECT ANSWER is (b) Must not be PRIVATE base class |
|
| 55. |
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 overriddenThe question was posed to me at a job interview.The question is from Overriding Member Functions in section Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct choice is (c) USING scope resolution operator |
|
| 56. |
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 listI had been asked this question in an international level competition.Origin of the question is Overriding Member Functions in section Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct answer is (d) All the same return type, NAME and parameter list |
|
| 57. |
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 classI had been asked this question in final exam.My question is based upon Overriding Member Functions topic in section Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct option is (b) The declaration MUST be exactly the same in base and derived class |
|
| 58. |
Which among the following is true?(a) Inheritance must not be using when overriding is used(b) Overriding can be implemented without using inheritance(c) Inheritance must be done, to use overriding are overridden(d) Inheritance is mandatory only if more than one functionsThe question was asked in exam.This question is from Overriding Member Functions in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» Right option is (C) Inheritance must be DONE, to use overriding are overridden |
|
| 59. |
Which among the following best describes member function overriding?(a) Member functions having same name in base and derived classes(b) Member functions having same name in base class only(c) Member functions having same name in derived class only(d) Member functions having same name and different signature inside main functionI have been asked this question in semester exam.My question comes from Overriding Member Functions in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» CORRECT choice is (a) Member functions having same name in base and derived classes The best I can explain: The member function which is defined in base class and again in the derived class, is overridden by the definition GIVEN in the derived class. This is because the preference is given more to the local members. When derived class OBJECT calls that function, definition from the derived class is used. |
|
| 60. |
Which operator can be used to free the memory allocated for an object in C++?(a) Free()(b) delete(c) Unallocate(d) CollectThe question was asked by my college director while I was bunking the class.My question is taken from Overloading Member Functions topic in section Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct choice is (b) delete |
|
| 61. |
In java ______________ takes care of managing memory for objects dynamically.(a) Free collector(b) Dust collector(c) Memory manager(d) Garbage collectorThe question was posed to me by my school principal while I was bunking the class.This intriguing question originated from Overloading Member Functions topic in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct answer is (d) Garbage collector |
|
| 62. |
If an object is declared in a user defined function __________________(a) Its memory is allocated in stack(b) Its memory is allocated in heap(c) Its memory is allocated in HDD(d) Its memory is allocated in cacheI got this question during an online exam.I want to ask this question from Overloading Member Functions topic in section Member Functions & its Types of Object Oriented Programming |
|
Answer» CORRECT choice is (a) Its memory is allocated in stack The explanation is: The memory for any data or object that are used in a user defined function are always allocated in the stack. This is to ensure that the object is destroyed as SOON as the function is returned. Also this ensures that the correct memory ALLOCATION and destruction is PERFORMED. |
|
| 63. |
The memory allocated for an object ____________________(a) Can be only dynamic(b) Can be only static(c) Can be static or dynamic(d) Can’t be done using dynamic functionsThe question was posed to me in an internship interview.The query is from Overloading Member Functions topic in section Member Functions & its Types of Object Oriented Programming |
|
Answer» The CORRECT choice is (c) Can be static or dynamic |
|
| 64. |
Which operator can be used to check the size of an object?(a) sizeof(objectName)(b) size(objectName)(c) sizeofobject(objectName)(d) sizedobject(objectName)The question was asked in an interview.Question is from Overloading Member Functions in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct choice is (a) sizeof(objectName) |
|
| 65. |
Which function is called whenever an object goes out of scope?(a) Destructor function(b) Constructor function(c) Delete function(d) Free functionThe question was posed to me in an interview for job.My question is from Overloading Member Functions topic in section Member Functions & its Types of Object Oriented Programming |
|
Answer» The CORRECT choice is (a) Destructor function |
|
| 66. |
Which among the following keyword can be used to free the allocated memory for an object?(a) delete(b) free(c) either delete or free(d) only deleteI have been asked this question during an interview.This key question is from Overloading Member Functions topic in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» CORRECT answer is (c) either delete or free The EXPLANATION is: The memory allocated for an object is usually automatically made free. But if EXPLICITLY memory has to be made free then we can use either free or delete keywords depending on PROGRAMMING languages. |
|
| 67. |
When is the memory allocated for an object gets free?(a) At termination of program(b) When object goes out of scope(c) When main function ends(d) When system restartsI got this question by my school principal while I was bunking the class.The above asked question is from Overloading Member Functions in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Right option is (b) When OBJECT goes out of scope |
|
| 68. |
Which keyword among the following can be used to declare an array of objects in java?(a) new(b) create(c) allocate(d) arrThis question was posed to me during a job interview.My enquiry is from Overloading Member Functions in section Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct answer is (a) new |
|
| 69. |
Which of the following function can be used for dynamic memory allocation of objects?(a) malloc()(b) calloc()(c) create()(d) both malloc() and calloc()This question was posed to me during an interview.Origin of the question is Overloading Member Functions topic in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» Right OPTION is (d) both malloc() and calloc() |
|
| 70. |
Using new is type safe as _______________________(a) It require to be specified with type of data(b) It doesn’t require to be specified with type of data(c) It requires the name of data(d) It allocated memory for the dataThe question was posed to me during an interview.My doubt is from Overloading Member Functions in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct answer is (b) It doesn’t require to be specified with type of data |
|
| 71. |
When is the memory allocated for an object?(a) At declaration of object(b) At compile time(c) When object constructor is called(d) When object is initialized to another objectThe question was posed to me in an online interview.The origin of the question is Overloading Member Functions topic in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» CORRECT CHOICE is (c) When OBJECT constructor is called To explain: The object memory allocation takes place when the object constructor is called. Declaration of an object doesn’t mean that memory is allocated for its members. If object is initialized with ANOTHER object, it may just get a reference to the previously created object. |
|
| 72. |
Where is the memory allocated for the objects?(a) HDD(b) Cache(c) RAM(d) ROMI had been asked this question in examination.This interesting question is from Overloading Member Functions in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct answer is (C) RAM |
|
| 73. |
What does memory allocation for objects mean?(a) Actual creation and memory allocation for object members(b) Creation of member functions(c) Creation of data members for a class(d) Actual creation and data declaration for object membersThe question was asked in homework.This question is from Overloading Member Functions topic in division Member Functions & its Types of Object Oriented Programming |
|
Answer» The CORRECT OPTION is (a) Actual creation and memory allocation for object MEMBERS |
|
| 74. |
Which operator among the following must be overloaded using the friend function?(a) > operator only(c) Both > operators(d) It’s not mandatory to use friend function in any caseI have been asked this question by my college professor while I was bunking the class.I want to ask this question from Member Operator Function in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Right option is (C) Both << and >> operators |
|
| 75. |
All the operators can be overloaded using the member function operator overloading.(a) True(b) FalseThis question was addressed to me in quiz.Enquiry is from Member Operator Function topic in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» Right answer is (B) False |
|
| 76. |
Which operator among the following can be overloaded using both friend function and member function?(a) Assignment operator(b) Subscript(c) Member selection (arrow operator)(d) Modulus operatorI have been asked this question in unit test.Origin of the question is Member Operator Function topic in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct option is (d) Modulus OPERATOR |
|
| 77. |
Which operator among the following can be overloading using only member function?(a) Assignment operator(b) Addition operator(c) Subtraction operator(d) Multiplication and division operatorI got this question in unit test.This intriguing question comes from Member Operator Function topic in division Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct answer is (a) Assignment operator |
|
| 78. |
Where in the parameter list is the implicit *this is added?(a) Right most parameter(b) Anywhere in parameter list(c) Left most parameter(d) Not added to parameter listI had been asked this question during an internship interview.I would like to ask this question from Member Operator Function topic in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct choice is (c) Left most parameter |
|
| 79. |
When the friend operator overloading is converted into member operator overloading _______________(a) Two parameters of friend function remains same parameters in member operator overloading(b) Two parameters of friend function becomes only one parameter of member function(c) Two parameters of friend function are removed while using member function(d) Two parameters of friend function are made 4 in member operator overloadingThe question was posed to me during a job interview.The origin of the question is Member Operator Function in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct choice is (b) Two parameters of friend function BECOMES only one PARAMETER of member function |
|
| 80. |
If left operand member is specified directly in the function definition, which is the correct implicit conversion of that syntax?(a) *this className(b) *this parameterObject(c) *this returnedObject(d) *this objectI got this question at a job interview.This is a very interesting question from Member Operator Function in division Member Functions & its Types of Object Oriented Programming |
|
Answer» RIGHT choice is (d) *this object The explanation is: SINCE the left operands are passed implicitly, those object members can be accessed directly in the function definition. The compiler converts the syntax into the syntax that can be processed. The implicitly converted syntax contains *this POINTER FOLLOWED by the objectName that is left operand in the expression. |
|
| 81. |
Which object’s members can be called directly while overloading operator function is used (In function definition)?(a) Left operand members(b) Right operand members(c) All operand members(d) None of the membersI had been asked this question in an international level competition.Question is taken from Member Operator Function in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Right answer is (a) LEFT operand members |
|
| 82. |
Why the left parameter is removed from parameter list?(a) Because it is of no use(b) Because it is never used in definitions(c) Because it becomes parameter pointed by *this(d) Because it can’t be referred by *this pointerI have been asked this question in exam.Question is from Member Operator Function in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» RIGHT choice is (c) Because it becomes parameter pointed by *this The best I can explain: The LEFT OBJECT is REMOVED from being passed as a parameter, because it is implicitly passed. It is passed implicitly because it is considered the object with respect to which the OVERLOADING function is being called. |
|
| 83. |
What is the syntax to overload an operator?(a) className::operator(parameters)(b) className:operator(parameters)(c) className.operator(paramteres)(d) className->operator(parameters)I had been asked this question in an online interview.I'd like to ask this question from Member Operator Function in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct answer is (a) CLASSNAME::operator |
|
| 84. |
If a friend overloaded operator have to be changed to member overloaded operator, which operator should be used with the class name?(a) Scope resolution operator(b) Colon(c) Arrow operator(d) Dot operatorI had been asked this question during an interview.This is a very interesting question from Member Operator Function topic in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct choice is (a) Scope resolution OPERATOR |
|
| 85. |
If the left operand is pointed by *this pointer, what happens to other operands?(a) Other operands are passed as function return type(b) Other operands are passed to compiler implicitly(c) Other operands must be passed using another member function(d) Other operands are passed as function argumentsThis question was addressed to me by my college professor while I was bunking the class.Question is taken from Member Operator Function in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» The CORRECT choice is (d) Other operands are PASSED as FUNCTION arguments |
|
| 86. |
When the operator to be overloaded becomes the left operand member then ______________(a) The right operand acts as implicit object represented by *this(b) The left operand acts as implicit object represented by *this(c) Either right or left operand acts as implicit object represented by *this(d) *this pointer is not applicable in that member functionI have been asked this question in unit test.I'm obligated to ask this question of Member Operator Function in section Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct CHOICE is (B) The left operand acts as IMPLICIT object represented by *this |
|
| 87. |
Which among the following is mandatory condition for operators overloading?(a) Overloaded operator must be member function of the left operand(b) Overloaded operator must be member function of the right operand(c) Overloaded operator must be member function of either left or right operand(d) Overloaded operator must not be dependent on the operandsThe question was asked in an interview for job.The question is from Member Operator Function topic in section Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct option is (a) Overloaded operator MUST be member FUNCTION of the left operand |
|
| 88. |
Which among the following are valid ways of overloading the operators?(a) Only using friend function(b) Only using member function(c) Either member functions or friend functions can be used(d) Operators can’t be overloadedThe question was posed to me during an interview for a job.This interesting question is from Member Operator Function in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct choice is (c) EITHER member functions or friend functions can be USED |
|
| 89. |
Which keyword is used to define the inline member function?(a) no keyword required(b) inline(c) inlined(d) lineThis question was posed to me in a national level competition.This intriguing question comes from Types of Member Functions in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Right choice is (b) inline |
|
| 90. |
Which keyword is used to define the static member functions?(a) static(b) stop(c) open(d) stateThis question was addressed to me in homework.I'm obligated to ask this question of Types of Member Functions in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» RIGHT choice is (a) static Best explanation: The static keyword is used to DECLARE any static member function in a CLASS. The static members become common to each object of the class being created. They share the same VALUES. |
|
| 91. |
Which among the following is true?(a) Member functions can never be private(b) Member functions can never be protected(c) Member functions can never be public(d) Member functions can be defined in any access specifierThe question was posed to me in an international level competition.This is a very interesting question from Types of Member Functions in section Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct ANSWER is (d) Member functions can be defined in any ACCESS SPECIFIER |
|
| 92. |
All type of member functions can’t be used inside a single class.(a) True(b) FalseThis question was posed to me in examination.I'd like to ask this question from Types of Member Functions topic in division Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct choice is (b) False |
|
| 93. |
Member functions _____________________(a) Must be defined inside class body(b) Can be defined inside class body or outside(c) Must be defined outside the class body(d) Can be defined in another classThis question was addressed to me in a job interview.This key question is from Types of Member Functions in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Right choice is (C) Must be defined outside the class body |
|
| 94. |
Which keyword is used to make a nonmember function as friend function of a class?(a) friendly(b) new(c) friend(d) connectThis question was addressed to me in an online quiz.Origin of the question is Types of Member Functions topic in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct ANSWER is (c) friend |
|
| 95. |
What is the syntax of a const member function?(a) void fun() const {}(b) void fun() constant {}(c) void const fun() {}(d) const void fun(){}I had been asked this question during an online exam.My doubt is from Types of Member Functions topic in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct OPTION is (a) void fun() CONST {} |
|
| 96. |
What are friend member functions (C++)?(a) Member function which can access all the members of a class(b) Member function which can modify any data of a class(c) Member function which doesn’t have access to private members(d) Non-member functions which have access to all the members (including private) of a classI had been asked this question in a job interview.Origin of the question is Types of Member Functions in section Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct choice is (d) Non-MEMBER FUNCTIONS which have access to all the members (including private) of a class |
|
| 97. |
Which among the following best describes the inline member functions?(a) Functions defined inside the class only(b) Functions with keyword inline only(c) Functions defined outside the class(d) Functions defined inside the class or with the keyword inlineThe question was asked during an internship interview.The query is from Types of Member Functions topic in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Correct option is (d) Functions defined inside the CLASS or with the KEYWORD inline |
|
| 98. |
What are const member functions?(a) Functions in which none of the data members can be changed in a program(b) Functions in which only static members can be changed(c) Functions which treat all the data members as constant and doesn’t allow changes(d) Functions which can change only the static membersI got this question in a job interview.This interesting question is from Types of Member Functions topic in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Right option is (C) FUNCTIONS which treat all the data members as constant and doesn’t ALLOW changes |
|
| 99. |
Correct syntax to access the static member functions from the main() function is ______________(a) classObject::functionName();(b) className::functionName();(c) className:classObject:functionName();(d) className.classObject:functionName();The question was asked in a national level competition.I want to ask this question from Types of Member Functions topic in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» Right choice is (B) CLASSNAME::functionName(); |
|
| 100. |
How can static member function can be accessed directly in main() function?(a) Dot operator(b) Colon(c) Scope resolution operator(d) Arrow operatorI got this question by my college director while I was bunking the class.This interesting question is from Types of Member Functions topic in chapter Member Functions & its Types of Object Oriented Programming |
|
Answer» The correct option is (C) Scope resolution operator |
|