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. |
What Are The Types Of Constructors? |
|
Answer» BASICALLY constructors are 5 TYPES those are
Basically constructors are 5 types those are
|
|
| 2. |
Which Oops Concept Exposes Only Necessary Information To The Calling Functions? |
|
Answer» Data Hiding / Abstraction |
|
| 3. |
Which Oops Concept Is Used As Reuse Mechanism? |
|
Answer» Inheritance is the OOPS CONCEPT that can be USED as REUSE mechanism. Inheritance is the OOPS concept that can be used as reuse mechanism. |
|
| 4. |
What Is The Default Access Specifier In A Class Definition? |
|
Answer» PRIVATE ACCESS specifier is USED in a CLASS DEFINITION. Private access specifier is used in a class definition. |
|
| 5. |
Which Keyword Can Be Used For Overloading? |
|
Answer» OPERATOR KEYWORD is USED for OVERLOADING. Operator keyword is used for overloading. |
|
| 6. |
How Many Instances Can Be Created For An Abstract Class? |
|
Answer» ZERO INSTANCES will be CREATED for an ABSTRACT CLASS. Zero instances will be created for an abstract class. |
|
| 7. |
What Is Static And Dynamic Binding? |
|
Answer» BINDING is NOTHING but the association of a NAME with the class. Static binding is a binding in which name can be associated with the class during compilation TIME , and it is also called as EARLY Binding. Binding is nothing but the association of a name with the class. Static binding is a binding in which name can be associated with the class during compilation time , and it is also called as early Binding. |
|
| 8. |
What Are Base Class, Sub Class And Super Class? |
| Answer» | |
| 9. |
What Does The Keyword Virtual Represented In The Method Definition? |
|
Answer» It MEANS, we can OVERRIDE the METHOD. It means, we can override the method. |
|
| 10. |
What Is A Copy Constructor? |
|
Answer» This is a special CONSTRUCTOR for creating a new object as a copy of an existing object. There will be ALWAYS only on copy constructor that can be either DEFINED by the user or the SYSTEM. This is a special constructor for creating a new object as a copy of an existing object. There will be always only on copy constructor that can be either defined by the user or the system. |
|
| 11. |
Do We Require Parameter For Constructors? |
|
Answer» No, we do not REQUIRE PARAMETER for CONSTRUCTORS. No, we do not require parameter for constructors. |
|
| 12. |
What Is Dynamic Or Run Time Polymorphism? |
|
Answer» Dynamic or Run time polymorphism is also known as METHOD overriding in which call to an OVERRIDDEN function is resolved during run time, not at the compile time. It MEANS having TWO or more methods with the same name,same signature but with different implementation. Dynamic or Run time polymorphism is also known as method overriding in which call to an overridden function is resolved during run time, not at the compile time. It means having two or more methods with the same name,same signature but with different implementation. |
|
| 13. |
What Are All The Operators That Cannot Be Overloaded? |
|
Answer» Following are the operators that cannot be overloaded -. Following are the operators that cannot be overloaded -. |
|
| 14. |
What Is The Default Access Modifier In A Class? |
|
Answer» The DEFAULT ACCESS MODIFIER of a CLASS is PRIVATE by default. The default access modifier of a class is Private by default. |
|
| 15. |
What Is The Difference Between Structure And A Class? |
|
Answer» STRUCTURE default access type is PUBLIC , but class access type is private. A structure is used for grouping data whereas class can be used for grouping data and methods. Structures are exclusively used for dataand it doesn’t require STRICT validation , but classes are used to encapsulates and INHERIT data which REQUIRES strict validation. Structure default access type is public , but class access type is private. A structure is used for grouping data whereas class can be used for grouping data and methods. Structures are exclusively used for dataand it doesn’t require strict validation , but classes are used to encapsulates and inherit data which requires strict validation. |
|
| 16. |
What Is ‘this’ Pointer? |
|
Answer» THIS POINTER REFERS to the CURRENT object of a class. THIS KEYWORD is used as a pointer which DIFFERENTIATES between the current object with the global object. Basically, it refers to the current object. THIS pointer refers to the current object of a class. THIS keyword is used as a pointer which differentiates between the current object with the global object. Basically, it refers to the current object. |
|
| 17. |
What Is Early And Late Binding? |
|
Answer» Early BINDING refers to ASSIGNMENT of values to variables during DESIGN TIME whereas LATE binding refers to assignment of values to variables during run time. Early binding refers to assignment of values to variables during design time whereas late binding refers to assignment of values to variables during run time. |
|
| 18. |
What Are The Various Types Of Constructors? |
|
Answer» There are three various types of constructors , and they are as follows:.
There are three various types of constructors , and they are as follows:. |
|
| 19. |
What Is The Difference Between New And Override? |
|
Answer» The new modifier instructs the compiler to USE the new implementation instead of the BASE CLASS FUNCTION. Whereas, Override modifier helps to override the base class function. The new modifier instructs the compiler to use the new implementation instead of the base class function. Whereas, Override modifier helps to override the base class function. |
|
| 20. |
How Can We Call The Base Method Without Creating An Instance? |
|
Answer» Yes, it is possible to call the base method WITHOUT creating an INSTANCE. And that method should be,.Static method.Doing INHERITANCE from that class.-Use Base KEYWORD from derived class. Yes, it is possible to call the base method without creating an instance. And that method should be,.Static method.Doing inheritance from that class.-Use Base Keyword from derived class. |
|
| 21. |
What Is Sealed Modifiers? |
|
Answer» Sealed MODIFIERS are the ACCESS modifiers where it cannot be inherited by the methods. Sealed modifiers can also be applied to PROPERTIES, events and methods. This modifier cannot be applied to STATIC MEMBERS. Sealed modifiers are the access modifiers where it cannot be inherited by the methods. Sealed modifiers can also be applied to properties, events and methods. This modifier cannot be applied to static members. |
|
| 22. |
What Are Access Modifiers? |
|
Answer» ACCESS modifiers determine the scope of the method or VARIABLES that can be ACCESSED from other various OBJECTS or classes. There are 5 TYPES of access modifiers , and they are as follows:. Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes. There are 5 types of access modifiers , and they are as follows:. |
|
| 23. |
What Is An Abstraction? |
|
Answer» Abstraction is a good feature of OOPS , and it SHOWS only the necessary details to the client of an object. MEANS, it shows only necessary details for an object, not the inner details of an object. Example – When you want to switch On television, it not necessary to SHOW all the functions of TV. WHATEVER is required to switch on TV will be showed by using abstract class. Abstraction is a good feature of OOPS , and it shows only the necessary details to the client of an object. Means, it shows only necessary details for an object, not the inner details of an object. Example – When you want to switch On television, it not necessary to show all the functions of TV. Whatever is required to switch on TV will be showed by using abstract class. |
|
| 24. |
Difference Between Class And An Object? |
|
Answer» An object is an instance of a class. Objects hold any information , but CLASSES don’t have any information. Definition of properties and FUNCTIONS can be DONE at class and can be USED by the object.Class can have sub-classes, and an object doesn’t have sub-objects. An object is an instance of a class. Objects hold any information , but classes don’t have any information. Definition of properties and functions can be done at class and can be used by the object.Class can have sub-classes, and an object doesn’t have sub-objects. |
|
| 25. |
Difference Between Overloading And Overriding? |
|
Answer» Overloading is static binding WHEREAS OVERRIDING is DYNAMIC binding. Overloading is nothing but the same method with DIFFERENT arguments , and it may or may not return the same value in the same class itself. Overloading is static binding whereas Overriding is dynamic binding. Overloading is nothing but the same method with different arguments , and it may or may not return the same value in the same class itself. |
|
| 26. |
What Are Tokens? |
|
Answer» Token is recognized by a compiler and it cannot be broken down into component ELEMENTS. Keywords, identifiers, CONSTANTS, string literals and operators are examples of tokens. Token is recognized by a compiler and it cannot be broken down into component elements. Keywords, identifiers, constants, string literals and operators are examples of tokens. |
|
| 27. |
What Is Super Keyword? |
|
Answer» Super KEYWORD is USED to invoke OVERRIDDEN method which overrides one of its superclass methods. This keyword allows to access overridden methods and ALSO to access hidden MEMBERS of the superclass. Super keyword is used to invoke overridden method which overrides one of its superclass methods. This keyword allows to access overridden methods and also to access hidden members of the superclass. |
|
| 28. |
What Are Different Types Of Arguments? |
|
Answer» A parameter is a variable used during the DECLARATION of the function or SUBROUTINE and arguments are passed to the function , and it should match with the parameter defined. There are two TYPES of Arguments.
A parameter is a variable used during the declaration of the function or subroutine and arguments are passed to the function , and it should match with the parameter defined. There are two types of Arguments.
|
|
| 29. |
What Is The Use Of Finalize Method? |
|
Answer» Finalize method HELPS to perform CLEANUP OPERATIONS on the RESOURCES which are not currently used. Finalize method is protected , and it is ACCESSIBLE only through this class or by a derived class. Finalize method helps to perform cleanup operations on the resources which are not currently used. Finalize method is protected , and it is accessible only through this class or by a derived class. |
|
| 30. |
What Is A Ternary Operator? |
|
Answer» Ternary operator is said to be an operator which takes THREE ARGUMENTS. Arguments and results are of different data TYPES , and it is DEPENDS on the function. Ternary operator is also called asconditional operator. Ternary operator is said to be an operator which takes three arguments. Arguments and results are of different data types , and it is depends on the function. Ternary operator is also called asconditional operator. |
|
| 31. |
What Is Function Overloading? |
|
Answer» Function overloading is defined as a NORMAL function, but it has the ability to perform different tasks. It allowscreation of SEVERAL methods with the same name which differ from each other by type of input and output of the function. Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allowscreation of several methods with the same name which differ from each other by type of input and output of the function. |
|
| 32. |
What Is A Virtual Function? |
|
Answer» Virtual function is a MEMBER function ofclass and its functionality can be overridden in its DERIVED class. This function can be implemented by using a keyword called virtual, and it can be GIVEN during function declaration. Virtual function is a member function ofclass and its functionality can be overridden in its derived class. This function can be implemented by using a keyword called virtual, and it can be given during function declaration. |
|
| 33. |
What Is Inline Function? |
|
Answer» Inline function is a technique used by the compilers and instructs to INSERT COMPLETE body of the function wherever that function is used in the PROGRAM SOURCE code. Inline function is a technique used by the compilers and instructs to insert complete body of the function wherever that function is used in the program source code. |
|
| 34. |
Define Destructor? |
|
Answer» Destructor is a method which is automatically CALLED when the OBJECT ismade ofscope or DESTROYED. Destructor NAME is ALSO same asclass name but with the tilde symbol before the name. Destructor is a method which is automatically called when the object ismade ofscope or destroyed. Destructor name is also same asclass name but with the tilde symbol before the name. |
|
| 35. |
Define A Constructor? |
|
Answer» Constructor is a method USED to initialize the state of an OBJECT, and it gets invoked at the time of object creation. RULES forconstructor are:. Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation. Rules forconstructor are:. |
|