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.
| 1. |
In how many ways can an object be passed to a function?(a) 1(b) 2(c) 3(d) 4I have been asked this question during an internship interview.I'm obligated to ask this question of Passing and Returning Object with Functions topic in division Object of Object Oriented Programming |
|
Answer» The correct choice is (c) 3 |
|
| 2. |
If an object is passed by value _____________(a) A new copy of object is created implicitly(b) The object itself is used(c) Address of the object is passed(d) A new object is created with new random valuesThe question was asked in unit test.The above asked question is from Passing and Returning Object with Functions in section Object of Object Oriented Programming |
|
Answer» Right answer is (a) A NEW copy of object is CREATED IMPLICITLY |
|
| 3. |
Pass by address passes the address of object _________ and pass by reference passes the address of the object _________(a) Explicitly, explicitly(b) Implicitly, implicitly(c) Explicitly, Implicitly(d) Implicitly, explicitlyI got this question by my college professor while I was bunking the class.The doubt is from Passing and Returning Object with Functions in chapter Object of Object Oriented Programming |
|
Answer» RIGHT answer is (c) Explicitly, IMPLICITLY Explanation: Pass by address USES the EXPLICIT address passing to the FUNCTION whereas pass by reference implicitly passes the address of the object. |
|
| 4. |
If an object is passed by reference, the changes made in the function ___________(a) Are reflected to the main object of caller function too(b) Are reflected only in local scope of the called function(c) Are reflected to the copy of the object that is made during pass(d) Are reflected to caller function object and called function object alsoI have been asked this question in a job interview.Question is taken from Passing and Returning Object with Functions topic in section Object of Object Oriented Programming |
|
Answer» The correct choice is (a) Are REFLECTED to the main OBJECT of caller function too |
|
| 5. |
Constructor function is not called when an object is passed to a function, will its destructor be called when its copy is destroyed?(a) Yes, depending on code(b) Yes, must be called(c) No, since no constructor was called(d) No, since same object gets usedThe question was posed to me in an international level competition.I would like to ask this question from Passing and Returning Object with Functions topic in portion Object of Object Oriented Programming |
|
Answer» Correct option is (b) Yes, MUST be called |
|
| 6. |
When an object is returned by a function, a _______________ is automatically created to hold the return value.(a) Temporary object(b) Virtual object(c) New object(d) Data memberThe question was posed to me at a job interview.I want to ask this question from Passing and Returning Object with Functions topic in division Object of Object Oriented Programming |
|
Answer» CORRECT answer is (a) TEMPORARY object Easy explanation - The temporary object is created. It holds the return value. The VALUES gets assigned as REQUIRED, and the temporary object gets destroyed. |
|
| 7. |
Is the destruction of temporary object safe (while returning object)?(a) Yes, the resources get free to use(b) Yes, other objects can use the memory space(c) No, unexpected side effects may occur(d) No, always gives rise to exceptionsThis question was posed to me in an interview for job.Question is from Passing and Returning Object with Functions in section Object of Object Oriented Programming |
|
Answer» CORRECT choice is (c) No, unexpected side EFFECTS MAY occur Best explanation: The destruction of temporary variable may GIVE rise to unexpected logical errors. Consider the destructor which may free the dynamically allocated memory. But this may abort the program if another is still trying to copy the values from that dynamic memory. |
|
| 8. |
How to overcome the problem arising due to destruction of temporary object?(a) Overloading insertion operator(b) Overriding functions can be used(c) Overloading parenthesis or returning object(d) Overloading assignment operator and defining copy constructorI got this question in semester exam.Origin of the question is Passing and Returning Object with Functions topic in division Object of Object Oriented Programming |
|
Answer» The correct OPTION is (d) Overloading assignment operator and defining copy constructor |
|
| 9. |
How many objects can be returned at once?(a) Only 1(b) Only 2(c) Only 16(d) As many as requiredI had been asked this question in a job interview.This question is from Passing and Returning Object with Functions topic in portion Object of Object Oriented Programming |
|
Answer» The CORRECT option is (a) Only 1 |
|
| 10. |
It is necessary to return the object if it was passed by reference to a function.(a) Yes, since the object must be same in caller function(b) Yes, since the caller function needs to reflect the changes(c) No, the changes are made automatically(d) No, the changes are made explicitlyThis question was addressed to me in an internship interview.My query is from Passing and Returning Object with Functions topic in division Object of Object Oriented Programming |
|
Answer» The correct option is (c) No, the changes are MADE automatically |
|
| 11. |
How many objects can be passed to a function simultaneously?(a) Only 1(b) Only an array(c) Only 1 or an array(d) As many as requiredThe question was posed to me in an interview for internship.I want to ask this question from Passing and Returning Object with Functions in division Object of Object Oriented Programming |
|
Answer» Correct option is (d) As many as required |
|
| 12. |
If an object is passed by address, will be constructor be called?(a) Yes, to allocate the memory(b) Yes, to initialize the members(c) No, values are copied(d) No, temporary object is createdThe question was posed to me in final exam.This question is from Passing and Returning Object with Functions in section Object of Object Oriented Programming |
|
Answer» The correct option is (c) No, values are copied |
|
| 13. |
Is it possible that an object of is passed to a function, and the function also have an object of same name?(a) No, Duplicate declaration is not allowed(b) No, 2 objects will be created(c) Yes, Scopes are different(d) Yes, life span is differentI have been asked this question in my homework.This interesting question is from Passing and Returning Object with Functions in section Object of Object Oriented Programming |
|
Answer» Correct CHOICE is (a) No, DUPLICATE declaration is not allowed |
|
| 14. |
Passing an object using copy constructor and pass by value are same.(a) True(b) FalseThis question was posed to me in an online quiz.This question is from Passing and Returning Object with Functions topic in portion Object of Object Oriented Programming |
|
Answer» Correct option is (B) False |
|
| 15. |
If a reference variable is declared final then _________________(a) It can never be reassigned to refer to a different object(b) It can be assigned to refer to any object anytime(c) It can never be assigned with any object(d) It can be assigned with 2 or more objects simultaneouslyI have been asked this question by my college director while I was bunking the class.The doubt is from Object Reference in division Object of Object Oriented Programming |
|
Answer» The correct choice is (a) It can never be reassigned to REFER to a different object |
|
| 16. |
Which of the members are referred by this pointer usually (Java)?(a) Members of class where this is used(b) Member of the parent class where this is used(c) Members that are passed as argument to the object(d) Pointers are not applicable in javaThe question was asked in a job interview.This intriguing question comes from Object Reference topic in division Object of Object Oriented Programming |
|
Answer» Correct option is (a) MEMBERS of class where this is USED |
|
| 17. |
How to refer to method of nested class?(a) enclosingClassObject.innerClassObject.method();(b) innerClassObject.method();(c) method();(d) depends on where the method is being calledThis question was posed to me in an online quiz.This question is from Object Reference topic in portion Object of Object Oriented Programming |
|
Answer» The correct option is (d) depends on where the method is being called |
|
| 18. |
How many objects can be referenced from the same variables?(a) One at a time(b) Many at a time(c) Many using array name(d) 7 at max at same timeI had been asked this question in unit test.I want to ask this question from Object Reference topic in chapter Object of Object Oriented Programming |
|
Answer» Right CHOICE is (a) One at a time |
|
| 19. |
Java handles memory dynamically and references are deleted as soon as they are out of scope.(a) True(b) FalseThis question was posed to me in an international level competition.This key question is from Object Reference topic in portion Object of Object Oriented Programming |
|
Answer» Right option is (a) True |
|
| 20. |
Which among the following is true?(a) Object referencing refers to methods address(b) Object referencing refers to variable of object(c) Object referencing points to same address, if assigned by variables(d) Object referencing is used to point methodsThe question was asked in an interview for internship.I'm obligated to ask this question of Object Reference in portion Object of Object Oriented Programming |
|
Answer» Correct choice is (c) Object REFERENCING points to same address, if assigned by variables |
|
| 21. |
If same object name is given to different objects of different class then _____________(a) Its compile time error(b) Its runtime error(c) It’s not an error(d) Program suns smoothI got this question by my college professor while I was bunking the class.This interesting question is from Object Use topic in section Object of Object Oriented Programming |
|
Answer» Correct answer is (a) Its compile time error |
|
| 22. |
A single object can be used __________________(a) As only two class types at a time(b) As only three class types at a time(c) As only one class type at a time(d) As of as many class types as requiredI had been asked this question during a job interview.I need to ask this question from Object Use in chapter Object of Object Oriented Programming |
|
Answer» Correct answer is (c) As only one class TYPE at a time |
|
| 23. |
Which object can be used to access the standard input?(a) System.inner(b) cin(c) System.stdin(d) console.inputThe question was posed to me at a job interview.My enquiry is from Object Use topic in division Object of Object Oriented Programming |
|
Answer» Correct OPTION is (b) cin |
|
| 24. |
Which among the following is not a use of object?(a) Defining a member function(b) Accessing data members(c) Creating instance of a class(d) Using class membersThis question was posed to me in a job interview.The doubt is from Object Use topic in section Object of Object Oriented Programming |
|
Answer» CORRECT option is (a) DEFINING a member function Best explanation: The objects can’t be used to define any member function. Member functions MUST be defined by the CLASS only. Objects can only ACCESS the members and use them. |
|
| 25. |
Objects can be used _____________________(a) To access any member of a class(b) To access only public members of a class(c) To access only protected members of a class(d) To access only private members of a classThe question was asked in an internship interview.The query is from Object Use in section Object of Object Oriented Programming |
|
Answer» CORRECT option is (b) To access only public MEMBERS of a class For explanation: The objects are created for a specific class. Then the objects can be used to access the public members of a class. The members can be the DATA members or the member FUNCTIONS of the class. |
|
| 26. |
An object can be used to represent _________________(a) A real world entity(b) A real function(c) Some real data only(d) Some function onlyI got this question in an internship interview.This is a very interesting question from Object Use in division Object of Object Oriented Programming |
|
Answer» The correct answer is (a) A REAL world entity |
|
| 27. |
Objects type ____________________(a) Can be changed in runtime(b) Can’t be changed in runtime(c) Can be changed in compile time(d) May or may not get changedI had been asked this question in examination.The question is from Object Use topic in division Object of Object Oriented Programming |
|
Answer» The correct option is (b) Can’t be CHANGED in runtime |
|
| 28. |
Object cout and cin _________________(a) Can be used directly with > symbols respectively(b) Can be used directly with >> and |
|
Answer» The correct ANSWER is (a) Can be used directly with << and >> symbols respectively |
|
| 29. |
What are singleton objects?(a) The only two objects of a class throughout the program(b) The only object of a class throughout the program(c) The objects that are alive throughout the program(d) The objects that are created and then deleted without useI had been asked this question in examination.My enquiry is from Object Use topic in division Object of Object Oriented Programming |
|
Answer» The CORRECT option is (B) The only object of a class THROUGHOUT the program |
|
| 30. |
A factory object is used ______________________(a) To create new classes(b) To create new function(c) To create new data members(d) To create new objectsThis question was posed to me in a national level competition.The above asked question is from Object Use topic in portion Object of Object Oriented Programming |
|
Answer» Correct choice is (d) To CREATE new objects |
|
| 31. |
Which object can be used to contain other objects?(a) First class object(b) Derived class object(c) Container object(d) Enclosure objectI had been asked this question during an online exam.My enquiry is from Object Use topic in portion Object of Object Oriented Programming |
|
Answer» CORRECT answer is (c) Container OBJECT Easy explanation - A container object can be used to CONTAIN other OBJECTS. Container object is an ADT. Its object are collection of other objects. Some specific RULES apply to these types of objects. |
|
| 32. |
Immutable object are used ______________________(a) To set up as a fixed state(b) To set up variable object(c) To set up an object of abstract class(d) To set up an object of derived classThe question was asked in an online quiz.Origin of the question is Object Use topic in chapter Object of Object Oriented Programming |
|
Answer» The correct CHOICE is (a) To set up as a fixed state |
|
| 33. |
What is function object?(a) An object with a single function(b) An object with only functions(c) An object with more than one function(d) An object with no functionsThis question was addressed to me during an online exam.Enquiry is from Object Use in chapter Object of Object Oriented Programming |
|
Answer» The CORRECT CHOICE is (a) An object with a single function |
|
| 34. |
Which among the following is not a property of an object?(a) Identity(b) Properties(c) Attributes(d) NamesThe question was asked in examination.I need to ask this question from Object Use topic in section Object of Object Oriented Programming |
|
Answer» The CORRECT answer is (d) NAMES |
|
| 35. |
Which among the following is the main use of object?(a) To create instance of a function(b) To create instance of a program(c) To create instance of class(d) To create instance of structuresThe question was asked in unit test.This intriguing question originated from Object Use in section Object of Object Oriented Programming |
| Answer» | |
| 36. |
Is an array of characters always a string?(a) Yes, always(b) Yes, if each character is terminated by null(c) No, since each character is terminated by null(d) No, neverI got this question by my school principal while I was bunking the class.This interesting question is from Object Array topic in chapter Object of Object Oriented Programming |
|
Answer» Correct answer is (d) No, never |
|
| 37. |
Two dimensional array can’t be initialized with the declaration.(a) True(b) FalseI have been asked this question in unit test.Enquiry is from Object Array in portion Object of Object Oriented Programming |
|
Answer» The correct choice is (B) False |
|
| 38. |
From which index does the array of objects start?(a) 0(b) 1(c) 2(d) 3This question was addressed to me during an online exam.Query is from Object Array topic in division Object of Object Oriented Programming |
|
Answer» Right choice is (a) 0 |
|
| 39. |
Can we have two dimensional object array?(a) Yes, always(b) Yes, only if primitive type array(c) No, since two indices are impossible(d) No, neverI had been asked this question in a national level competition.The above asked question is from Object Array in section Object of Object Oriented Programming |
|
Answer» Correct ANSWER is (a) YES, always |
|
| 40. |
If an array of objects is of size 10 and a data value have to be retrieved from 5th object then ________________ syntax should be used.(a) Array_Name[4].data_variable_name;(b) Data_Type Array_Name[4].data_variable_name;(c) Array_Name[4].data_variable_name.value;(d) Array_Name[4].data_variable_name(value);The question was asked in examination.My doubt stems from Object Array topic in portion Object of Object Oriented Programming |
|
Answer» Correct answer is (a) Array_Name[4].data_variable_name; |
|
| 41. |
The Object array is created in _____________________(a) Heap memory(b) Stack memory(c) HDD(d) ROMThe question was asked during a job interview.My question is from Object Array topic in division Object of Object Oriented Programming |
|
Answer» The correct option is (a) HEAP memory |
|
| 42. |
The objects in an object array _______________________(a) Can be created without use of constructor(b) Can be created without calling default constructor(c) Can’t be created with use of constructor(d) Can’t be created without calling default constructorThe question was asked in unit test.I would like to ask this question from Object Array topic in portion Object of Object Oriented Programming |
|
Answer» Right answer is (b) Can be created WITHOUT calling default CONSTRUCTOR |
|
| 43. |
How the objects of array can be denoted?(a) Indices(b) Name(c) Random numbers(d) AlphabetsThe question was asked in an online interview.I'd like to ask this question from Object Array topic in chapter Object of Object Oriented Programming |
|
Answer» The correct OPTION is (a) Indices |
|
| 44. |
If constructor arguments are passed to objects of array then ____________ if the constructors are overloaded.(a) It is mandatory to pass same number of arguments to all the objects(b) It is mandatory to pass same type of arguments to all the objects(c) It is not mandatory to call same constructor for all the objects(d) It is mandatory to call same constructor for all the constructorsThe question was asked during an online interview.My question comes from Object Array topic in chapter Object of Object Oriented Programming |
|
Answer» Correct answer is (C) It is not mandatory to call same constructor for all the objects |
|
| 45. |
When are the array of objects without any initialization useful?(a) When object data is not required just after the declaration(b) When initialization of object data is to be made by the compiler(c) When object data doesn’t matter in the program(d) When the object should contain garbage dataThe question was asked in an international level competition.This intriguing question originated from Object Array in division Object of Object Oriented Programming |
|
Answer» The correct option is (a) When object data is not REQUIRED just after the declaration |
|
| 46. |
Which is the condition that must be followed if the array of objects is declared without initialization, only with size of array?(a) The class should have separate constructor for each object(b) The class must have no constructors(c) The class should not have any member function(d) The class must have a default or zero argument constructorThis question was addressed to me during an interview.My question is from Object Array topic in division Object of Object Oriented Programming |
|
Answer» The correct answer is (d) The class MUST have a default or zero argument constructor |
|
| 47. |
What is the type of elements of array of objects?(a) Class(b) Void(c) String(d) NullI had been asked this question in my homework.This intriguing question originated from Object Array topic in division Object of Object Oriented Programming |
|
Answer» The CORRECT answer is (a) Class |
|
| 48. |
Which among the following is a mandatory condition for array of objects?(a) All the objects should be of different class(b) All the objects should be of same program classes(c) All the objects should be of same class(d) All the objects should have different dataThis question was posed to me during an interview.The above asked question is from Object Array topic in division Object of Object Oriented Programming |
|
Answer» Right choice is (C) All the OBJECTS should be of same CLASS |
|
| 49. |
What is an array of objects?(a) An array of instances of class represented by single name(b) An array of instances of class represented by more than one name(c) An array of instances which have more than 2 instances(d) An array of instances which have different typesThis question was addressed to me in homework.My question is based upon Object Array topic in division Object of Object Oriented Programming |
|
Answer» Correct CHOICE is (a) An ARRAY of instances of class represented by single name |
|
| 50. |
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 in a national level competition.Asked question is from Memory Allocation of Object in portion Object of Object Oriented Programming |
|
Answer» Correct ANSWER is (b) delete |
|