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. |
What Do You Mean By Pure Virtual Functions In C++? Give An Example? |
|
Answer» Pure VIRTUAL function is a function which doesn't have an implementation and the same NEEDS to be implemented by the the NEXT immediate non-abstract class. (A class will BECOME an abstract class if there is at-least a single pure virtual function and thus pure virtual functions are used to create interfaces in c++). Pure virtual function is a function which doesn't have an implementation and the same needs to be implemented by the the next immediate non-abstract class. (A class will become an abstract class if there is at-least a single pure virtual function and thus pure virtual functions are used to create interfaces in c++). |
|
| 52. |
How To Create A Pure Virtual Function? |
|
Answer» A function is MADE as pure virtual function by the USING a specific signature, " = 0" appended to the function declaration as given below, A function is made as pure virtual function by the using a specific signature, " = 0" appended to the function declaration as given below, |
|
| 53. |
Why Pure Virtual Functions Are Used If They Don't Have Implementation / When Does A Pure Virtual Function Become Useful? |
|
Answer» Pure virtual functions are used when it doesn't make sense to provide definition of a virtual function in the BASE CLASS or a proper definition does not exists in the context of base class. Consider the above example, class SymmetricShape is used as base class for shapes with symmetric structure(CIRCLE, SQUARE, equilateral triangle etc). In this case, there exists no proper definition for function draw() in the base class SymmetricShape instead the CHILD classes of SymmetricShape (Cirlce, Square etc) can implement this method and draw proper shape. Pure virtual functions are used when it doesn't make sense to provide definition of a virtual function in the base class or a proper definition does not exists in the context of base class. Consider the above example, class SymmetricShape is used as base class for shapes with symmetric structure(Circle, square, equilateral triangle etc). In this case, there exists no proper definition for function draw() in the base class SymmetricShape instead the child classes of SymmetricShape (Cirlce, Square etc) can implement this method and draw proper shape. |
|
| 54. |
What Is Virtual Destructor? Why They Are Used? |
|
Answer» Virtual destructors are USED for the same purpose as virtual functions. When you remove an object of subclass, which is REFERENCED by a parent CLASS pointer, only destructor of base class will get executed. But if the destructor is DEFINED USING virtual keyword, both the destructors [ of parent and sub class ] will get invoked. Virtual destructors are used for the same purpose as virtual functions. When you remove an object of subclass, which is referenced by a parent class pointer, only destructor of base class will get executed. But if the destructor is defined using virtual keyword, both the destructors [ of parent and sub class ] will get invoked. |
|
| 55. |
What You Mean By Early Binding And Late Binding? How It Is Related To Dynamic Binding? |
|
Answer» Binding is the process of linking ACTUAL address of functions or identifiers to their reference. This happens mainly two times. Binding is the process of linking actual address of functions or identifiers to their reference. This happens mainly two times. |
|
| 56. |
How To Create A Reference Variable In C++? |
|
Answer» APPENDING an ampersand (&) to the end of datatype MAKES a variable ELIGIBLE to use as reference variable. Appending an ampersand (&) to the end of datatype makes a variable eligible to use as reference variable. |
|
| 57. |
What Is Meant By Reference Variable In C++? |
|
Answer» In C++, reference variable allows you create an alias (SECOND name) for an already existing variable. A reference variable can be used to access (read/write) the original data. That MEANS, both the variable and reference variable are attached to same memory location. In effect, if you CHANGE the value of a variable USING reference variable, both will get changed (because both are attached to same memory location). In C++, reference variable allows you create an alias (second name) for an already existing variable. A reference variable can be used to access (read/write) the original data. That means, both the variable and reference variable are attached to same memory location. In effect, if you change the value of a variable using reference variable, both will get changed (because both are attached to same memory location). |
|
| 58. |
What Are The Difference Between Reference Variables And Pointers In C++? |
|
Answer» Pointers:
Reference Variables:
Pointers: Reference Variables: |
|
| 59. |
What Do You Mean By Storage Classes? |
|
Answer» Storage class are used to specify the visibility/scope and LIFE time of symbols(FUNCTIONS and variables). That means, storage classes specify where all a variable or function can be ACCESSED and till what time those variables will be available during the execution of PROGRAM. Storage class are used to specify the visibility/scope and life time of symbols(functions and variables). That means, storage classes specify where all a variable or function can be accessed and till what time those variables will be available during the execution of program. |
|
| 60. |
What Do You Mean By Internal Linking And External Linking In C++? |
|
Answer» A symbol is said to be LINKED internally when it can be ACCESSED only from with-in the scope of a single translation unit. By external linking a symbol can be accessed from other translation UNITS as well. This linkage can be controlled by using static and extern keywords. A symbol is said to be linked internally when it can be accessed only from with-in the scope of a single translation unit. By external linking a symbol can be accessed from other translation units as well. This linkage can be controlled by using static and extern keywords. |
|
| 61. |
What Do You Mean By Translation Unit In C++? |
|
Answer» We organize our C++ PROGRAMS into different source files (.cpp, .cxx etc). When you consider a source file, at the preprocessing stage, some extra content may get added to the source code ( for example, the contents of HEADER files included) and some content may get removed ( for example, the part of the code in the #ifdef of #ifndef block which resolve to false/0 based on the symbols defined). This effective content is called a translation unit. In other words, a translation unit consists of Contents of source file Plus contents of files included DIRECTLY or indirectly Minus source code lines ignored by any CONDITIONAL pre processing DIRECTIVES ( the lines ignored by #ifdef,#ifndef etc) We organize our C++ programs into different source files (.cpp, .cxx etc). When you consider a source file, at the preprocessing stage, some extra content may get added to the source code ( for example, the contents of header files included) and some content may get removed ( for example, the part of the code in the #ifdef of #ifndef block which resolve to false/0 based on the symbols defined). This effective content is called a translation unit. In other words, a translation unit consists of Contents of source file Plus contents of files included directly or indirectly Minus source code lines ignored by any conditional pre processing directives ( the lines ignored by #ifdef,#ifndef etc) |
|
| 62. |
What Are C++ Inline Functions? |
|
Answer» C++ inline functions are special functions, for which the compiler replaces the function call with body/definition of function. Inline functions makes the PROGRAM execute faster than the normal functions, since the overhead involved in saving current state to stack on the function call is avoided. By giving developer the control of making a function as inline, he can further optimize the CODE based on application logic. But actually, it's the compiler that decides whether to MAKE a function inline or not regardless of it's declaration. Compiler may choose to make a non inline function inline and vice versa. Declaring a function as inline is in effect a request to the compiler to make it inline, which compiler may ignore. So, please note this point for the interview that, it is UPTO the compiler to make a function inline or not. C++ inline functions are special functions, for which the compiler replaces the function call with body/definition of function. Inline functions makes the program execute faster than the normal functions, since the overhead involved in saving current state to stack on the function call is avoided. By giving developer the control of making a function as inline, he can further optimize the code based on application logic. But actually, it's the compiler that decides whether to make a function inline or not regardless of it's declaration. Compiler may choose to make a non inline function inline and vice versa. Declaring a function as inline is in effect a request to the compiler to make it inline, which compiler may ignore. So, please note this point for the interview that, it is upto the compiler to make a function inline or not. |
|
| 63. |
What Is Implicit Conversion/coercion In C++? |
|
Answer» Implicit conversions are performed when a type (say T) is used in a CONTEXT where a COMPATIBLE type (Say F) is expected so that the type T will be promoted to type F. Implicit conversions are performed when a type (say T) is used in a context where a compatible type (Say F) is expected so that the type T will be promoted to type F. |
|
| 64. |
In How Many Ways We Can Initialize An Int Variable In C++? |
|
Answer» In c++, variables can be INITIALIZED in TWO ways, the traditional C++ INITIALIZATION using "=" OPERATOR and second using the constructor notation. In c++, variables can be initialized in two ways, the traditional C++ initialization using "=" operator and second using the constructor notation. |
|
| 65. |
What Is The Use Of Volatile Keyword In C++? Give An Example ? |
|
Answer» Most of the times compilers will do optimization to the code to speed up the PROGRAM. For example in the below code, Most of the times compilers will do optimization to the code to speed up the program. For example in the below code, |
|
| 66. |
What Are The Basics Concepts Of Oop? |
|
Answer» Encapsulation : Encapsulation is the mechanism by which data and associated operations/methods are BOUND together and thus hide the data from outside world. It's also called data hiding. In c++, encapsulation achieved using the access specifiers (private, PUBLIC and protected). Data members will be declared as private (thus protecting from direct access from outside) and public methods will be provided to access these data. Consider the below class In the class Person, access to the data field age is protected by declaring it as private and providing public access methods. What would have happened if there was no access methods and the field age was public? Anybody who has a Person object can set an invalid value (negative or very large value) for the age field. So by encapsulation we can preventing direct access from outside, and thus have complete control, protection and integrity of the data. In the above example, class Square inherits the properties and methods of class SymmetricShape. Inheritance is the one of the very important concepts in C++/OOP. It helps to modularise the code, improve reusability and reduces tight coupling between components of the system. Encapsulation : Encapsulation is the mechanism by which data and associated operations/methods are bound together and thus hide the data from outside world. It's also called data hiding. In c++, encapsulation achieved using the access specifiers (private, public and protected). Data members will be declared as private (thus protecting from direct access from outside) and public methods will be provided to access these data. Consider the below class In the class Person, access to the data field age is protected by declaring it as private and providing public access methods. What would have happened if there was no access methods and the field age was public? Anybody who has a Person object can set an invalid value (negative or very large value) for the age field. So by encapsulation we can preventing direct access from outside, and thus have complete control, protection and integrity of the data. In the above example, class Square inherits the properties and methods of class SymmetricShape. Inheritance is the one of the very important concepts in C++/OOP. It helps to modularise the code, improve reusability and reduces tight coupling between components of the system. |
|
| 67. |
What Do You Mean By C++ Access Specifiers? |
|
Answer» Access specifiers are used to define how the members (FUNCTIONS and variables) can be ACCESSED outside the class. There are THREE access specifiers defined which are public, private, and protected Access specifiers are used to define how the members (functions and variables) can be accessed outside the class. There are three access specifiers defined which are public, private, and protected |
|
| 68. |
What Is An Object/instance? |
|
Answer» Object is the instance of a class, which is concrete. From the above example, we can create instance of class Vehicle as given below Vehicle vehicleObject; Object is the instance of a class, which is concrete. From the above example, we can create instance of class Vehicle as given below Vehicle vehicleObject; |
|
| 69. |
What Is A Class? |
|
Answer» Class defines a datatype, it's type definition of category of thing(s). But a class actually does not define the data, it just specifies the structure of data. To use them you need to create objects out of the class. Class can be CONSIDERED as a blueprint of a building, you can not stay INSIDE blueprint of building, you need to construct building(s) out of that plan. You can create any number of BUILDINGS from the blueprint, similarly you can create any number of objects from a class. Class defines a datatype, it's type definition of category of thing(s). But a class actually does not define the data, it just specifies the structure of data. To use them you need to create objects out of the class. Class can be considered as a blueprint of a building, you can not stay inside blueprint of building, you need to construct building(s) out of that plan. You can create any number of buildings from the blueprint, similarly you can create any number of objects from a class. |
|
| 70. |
What Is Difference Between C And C++? |
|
Answer» C++ is Multi-Paradigm ( not pure OOP, supports both procedural and OBJECT oriented) while C follows procedural style programming. C++ is Multi-Paradigm ( not pure OOP, supports both procedural and object oriented) while C follows procedural style programming. |
|
| 71. |
What Are The Data Structures Does Sga Contains? |
|
Answer» The SGA contains the following data structures:
The SGA contains the following data structures: |
|
| 72. |
What Are Database Buffers? |
|
Answer» It is the portion of the System GLOBAL AREA that holds copies of data blocks read from datafiles. All user PROCESSES are connected to the instance CONCURRENTLY and share access to the DATABASE buffer cache. It is the portion of the System Global Area that holds copies of data blocks read from datafiles. All user processes are connected to the instance concurrently and share access to the database buffer cache. |
|
| 73. |
What Is Redo Log Buffer? |
|
Answer» The Redo Log Buffer is a circular buffer in the System GLOBAL Area that HOLDS information about changes made to the database. Redo entries CONTAIN the information to reconstruct, or redo, changes made to the database by INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP operations. Redo entries are used for database recovery, if necessary. The Redo Log Buffer is a circular buffer in the System Global Area that holds information about changes made to the database. Redo entries contain the information to reconstruct, or redo, changes made to the database by INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP operations. Redo entries are used for database recovery, if necessary. |
|
| 74. |
What Is Shared Pool? |
|
Answer» The Shared Pool part of the System Global AREA contains the library cache, the dictionary cache, BUFFERS for parallel execution MESSAGES, and control structures. The Shared Pool part of the System Global Area contains the library cache, the dictionary cache, buffers for parallel execution messages, and control structures. |
|
| 75. |
What Is Pga? |
|
Answer» A PGA i.e Program Global Area is a memory region that contains data and CONTROL information for a server process.It is a memory created by ORACLE when a server process is started and it is non shared. Access to it is exclusive to that server process and is READ and written by Oracle code. A PGA i.e Program Global Area is a memory region that contains data and control information for a server process.It is a memory created by Oracle when a server process is started and it is non shared. Access to it is exclusive to that server process and is read and written by Oracle code. |
|
| 76. |
What Are The Contents Of Pga? |
Answer»
|
|
| 77. |
What Are Dedicated And Shared Server Process? |
|
Answer» Server Configurations:
The server process created on BEHALF of each USER process is CALLED a dedicated server process (or shadow process).Shared server architecture removes the need for a dedicated server process for each connection. Server Configurations: The server process created on behalf of each user process is called a dedicated server process (or shadow process).Shared server architecture removes the need for a dedicated server process for each connection. |
|
| 78. |
What Are Server Processes In Oracle? |
|
Answer» Oracle creates server PROCESSES to serve user processes requests, connected to the instance. In some situations, when the application and Oracle are on the same system, it is POSSIBLE to combine the user process and corresponding server process into one process for reducing system overhead. HOWEVER, when the application and Oracle operate on different COMPUTERS, a user process ALWAYS talks to Oracle through a separate server process. Oracle creates server processes to serve user processes requests, connected to the instance. In some situations, when the application and Oracle are on the same system, it is possible to combine the user process and corresponding server process into one process for reducing system overhead. However, when the application and Oracle operate on different computers, a user process always talks to Oracle through a separate server process. |
|
| 79. |
What Server Processes Can Perform Created On Behalf Of Each User’s Application? |
|
Answer» Server processes can perform one or more of the FOLLOWING:
Server processes can perform one or more of the following: |
|
| 80. |
What Are Background Processes In Oracle? |
|
Answer» In order to ENHANCE performance and accommodate MANY USERS, a multi-process Oracle SYSTEM USES some additional Oracle processes called background processes. In order to enhance performance and accommodate many users, a multi-process Oracle system uses some additional Oracle processes called background processes. |
|
| 81. |
What Are The Processes Does Background Processes In An Oracle Includes? |
|
Answer» The background PROCESSES in an Oracle instance can include the following:
The background processes in an Oracle instance can include the following: |
|
| 82. |
What Is Database Writer Process? |
|
Answer» It writes the contents of buffers to DATA files.The DBWn processes are responsible for WRITING MODIFIED buffers in the database buffer cache to disk. It writes the contents of buffers to data files.The DBWn processes are responsible for writing modified buffers in the database buffer cache to disk. |
|
| 83. |
What Is Log Writer Process? |
|
Answer» It is responsible for writing the redo log BUFFER to a redo log file on disk. Log Writer writes all redo entries which is copied into the buffer since the last time it wrote. It is responsible for writing the redo log buffer to a redo log file on disk. Log Writer writes all redo entries which is copied into the buffer since the last time it wrote. |
|
| 84. |
What Is System Monitor Process? |
|
Answer» It performs RECOVERY, if necessary, at instance startup. It performs recovery, if necessary, at instance startup. |
|
| 85. |
What Is Process Monitor Process? |
|
Answer» It performs PROCESS recovery when a user process fails. Process Monitor is responsible for CLEANING up the database BUFFER cache and reclaiming resources that the user process was USING. Process Monitor ALSO registers information about the instance and dispatcher processes with the network listener. It performs process recovery when a user process fails. Process Monitor is responsible for cleaning up the database buffer cache and reclaiming resources that the user process was using. Process Monitor also registers information about the instance and dispatcher processes with the network listener. |
|
| 86. |
What Is Recoverer Process? |
|
Answer» The re-coverer PROCESS (RECO) is a background process used with the distributed database configuration that automatically RESOLVES failures. The RECO process of a node automatically connects to other databases INVOLVED in an in- doubt distributed TRANSACTION. The re-coverer process (RECO) is a background process used with the distributed database configuration that automatically resolves failures. The RECO process of a node automatically connects to other databases involved in an in- doubt distributed transaction. |
|
| 87. |
What Are Job Queue Processes? |
|
Answer» Job queue processes are USED for PROCESSING BATCH. They RUN user jobs. They can be viewed as a scheduler service that can be used to schedule jobs LIKE PL/SQL statements or procedures on an Oracle instance. Job queue processes are used for processing batch. They run user jobs. They can be viewed as a scheduler service that can be used to schedule jobs like PL/SQL statements or procedures on an Oracle instance. |
|
| 88. |
What Are Archiver Processes? |
|
Answer» It copies redo LOG FILES to a designated storage device after a log switch has occurred. ARCHIVER processes are there only when the database is in ARCHIVELOG mode, and automatic archiving is enabled. An Oracle instance can have up to 10 Archiver processes (ARC0 to ARC9). The LGWR process starts a new ARCn process whenever the current NUMBER of Archiver processes is INSUFFICIENT to handle the workload. It copies redo log files to a designated storage device after a log switch has occurred. Archiver processes are there only when the database is in ARCHIVELOG mode, and automatic archiving is enabled. An Oracle instance can have up to 10 Archiver processes (ARC0 to ARC9). The LGWR process starts a new ARCn process whenever the current number of Archiver processes is insufficient to handle the workload. |
|
| 89. |
Explain Briefly Shared Server Architecture? |
|
Answer» This architecture removes the need for a dedicated server process for each connection. A dispatcher routes various incoming NETWORK session requests to a shared server processes pool. An idle shared server process from a shared pool of server processes CHOOSES a request from a common queue, which means a small number of shared servers can do the same amount of processing as many dedicated servers. This architecture removes the need for a dedicated server process for each connection. A dispatcher routes various incoming network session requests to a shared server processes pool. An idle shared server process from a shared pool of server processes chooses a request from a common queue, which means a small number of shared servers can do the same amount of processing as many dedicated servers. |
|
| 90. |
What Is Concurrency In Oracle? |
|
Answer» The multiuser database management system's concern is how to control concurrency, which is the concurrent ACCESS of the same data by multiple USERS. Without SUFFICIENT concurrency controls, data could be updated or changed improperly, trading off with data integrity. To manage data concurrency is to make each user wait for a turn. The multiuser database management system's concern is how to control concurrency, which is the concurrent access of the same data by multiple users. Without sufficient concurrency controls, data could be updated or changed improperly, trading off with data integrity. To manage data concurrency is to make each user wait for a turn. |
|
| 91. |
Give An Example Of Synonyms? |
|
Answer» CREATE PUBLIC SYNONYM SALES FOR jward.sales_data; CREATE PUBLIC SYNONYM sales FOR jward.sales_data; |
|
| 92. |
What Is A Synonyms? |
|
Answer» A synonym is an alias for database OBJECTS such as table, view, materialized view, sequence, PROCEDURE, function, package. Because a synonym is simply an alias, it does not REQUIRE storage other than its DATA dictionary definition. A synonym is an alias for database objects such as table, view, materialized view, sequence, procedure, function, package. Because a synonym is simply an alias, it does not require storage other than its data dictionary definition. |
|
| 93. |
List Out Indexing Scheme That Oracle Provides? |
|
Answer» ORACLE PROVIDES several indexing SCHEMES:
Oracle provides several indexing schemes: |
|
| 94. |
What Is An Index? |
|
Answer» INDEXES are structures ASSOCIATED with tables and clusters. You can create indexes on one or more columns of a table to enhance the speed of SQL statement execution on that table. Just as the index in Oracle manual helps you to locate information faster than if there were no indexes. An Oracle index provides a faster access PATH to table data. Indexes are structures associated with tables and clusters. You can create indexes on one or more columns of a table to enhance the speed of SQL statement execution on that table. Just as the index in Oracle manual helps you to locate information faster than if there were no indexes. An Oracle index provides a faster access path to table data. |
|
| 95. |
Explain Sequence Generator In Oracle? |
|
Answer» The SEQUENCE generator gives a sequential series of numbers.The sequence generator is especially useful for generating unique sequential numbers. Sequence numbers are Oracle integers of up to 38 digits defined in the database. A sequence definition provides information, such as:
Sequence numbers are generated independent of any tables. The same sequence generator can be used for many tables. Sequence number GENERATION can be used to produce primary keys for your data automatically. Oracle stores the definitions of all sequences for a particular database as rows in data dictionary table in the SYSTEM table- space. The sequence generator gives a sequential series of numbers.The sequence generator is especially useful for generating unique sequential numbers. Sequence numbers are Oracle integers of up to 38 digits defined in the database. A sequence definition provides information, such as: Sequence numbers are generated independent of any tables. The same sequence generator can be used for many tables. Sequence number generation can be used to produce primary keys for your data automatically. Oracle stores the definitions of all sequences for a particular database as rows in data dictionary table in the SYSTEM table- space. |
|
| 96. |
What Is A Dimension? |
|
Answer» A dimension is hierarchical relationships between pairs of columns or COLUMN SETS. Each value at the CHILD level is tied with ONE value at the PARENT level. A dimension is a container of logical relationships between columns and it does not contain any data. A dimension is hierarchical relationships between pairs of columns or column sets. Each value at the child level is tied with one value at the parent level. A dimension is a container of logical relationships between columns and it does not contain any data. |
|
| 97. |
What Are Materialized Views? |
|
Answer» These are schema objects that are used to summarize, compute, replicate, and distribute data. They can be used in various environments for computation such as data WAREHOUSING, decision support, and distributed or mobile computing and it ALSO provides local access to data RATHER than ACCESSING from remote sites. In data WAREHOUSES, MVs are used to compute and store aggregated data. These are schema objects that are used to summarize, compute, replicate, and distribute data. They can be used in various environments for computation such as data warehousing, decision support, and distributed or mobile computing and it also provides local access to data rather than accessing from remote sites. In data warehouses, MVs are used to compute and store aggregated data. |
|
| 98. |
How Views Are Used? |
|
Answer» It provides security by restricting access to a predetermined set of rows or columns of a table. It HIDES data complexity. It SIMPLIFIES statements for the user. It provides security by restricting access to a predetermined set of rows or columns of a table. It hides data complexity. It simplifies statements for the user. |
|
| 99. |
What Is A View? |
|
Answer» A view is a TAILORED PRESENTATION of the data contained in one or more TABLES or other views. A view is OUTPUT of a query and treats it as a table. Therefore, a view can be thought of as a stored query or a virtual table. A view is not ASSIGNED any storage space, nor does a view actually contain data. A view is a tailored presentation of the data contained in one or more tables or other views. A view is output of a query and treats it as a table. Therefore, a view can be thought of as a stored query or a virtual table. A view is not assigned any storage space, nor does a view actually contain data. |
|
| 100. |
When And How Oracle Database Creates A Schema? |
|
Answer» Oracle DATABASE AUTOMATICALLY creates a SCHEMA when you CREATE a user. Oracle Database automatically creates a schema when you create a user. |
|