Explore topic-wise InterviewSolutions in .

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 do you understand about kernel in the context of Operating Systems?

Answer»

The kernel is a component of an operating system that manages computer and hardware functions. It primarily oversees memory and CPU functions. It's a crucial part of any operating system. Kernel serves as a link between applications and hardware-based data processing via inter-process communication and system calls.

When an operating system is loaded, the kernel is loaded initially and remains in memory until the operating system is SHUT down. It's in charge of things like disk management, task management, and memory management.
It determines which processes should be assigned to the CPU and which should be kept in the main memory for execution. It serves as a link between user software and hardware. The kernel's primary GOAL is to manage communication between software, such as user-level applications, and hardware, such as the CPU and disc memory.

The following are the different types of the kernel in Operating Systems:

  • Monolithic Kernel - A monolithic kernel is one in which all operating system services run in kernel space. There are interdependencies between the components of the system. It has a large number of lines of code that is difficult to understand.
  • MicroKernel - This is a sort of kernel that takes a minimalist approach. It has thread scheduling and virtual memory. With fewer services in kernel space, it is more stable.
  • Hybrid Kernel - This is a hybrid kernel that combines both monolithic and microkernel functionality. It combines the monolithic kernel's performance and DESIGN with the modularity and stability of a microkernel.
  • Exo Kernel - Exo Kernel is a form of the kernel that adheres to the end-to-end philosophy. It uses the fewest possible hardware abstractions. It assigns physical resources to different applications.
  • Nano Kernel - This is a kernel that provides hardware abstraction but does not PROVIDE system services. Because the MicroKernel lacks system services, the Microkernel and Nano Kernel have become interchangeable.
Useful Interview Resources
  • Java Interview Questions (Core & Advanced)
  • Coding Interview Questions for Practice
  • Technical Interview Questions for Practice
  • Interview Preparation
2.

What is the difference between deadlock and starvation in the context of Operating Systems?

Answer»

Deadlock - When each process possesses a resource and waits for ANOTHER process to retain a resource, a deadlock ensues. Mutual Exclusion, Hold and Wait, No Preemption, and Circular Wait are all necessary circumstances for the deadlock to occur. No process that is holding one resource while waiting for another is performed in this scenario.

Starvation - When high priority processes continue to RUN while low priority processes are stalled for an indeterminate time, this is known as starvation. A continual stream of higher-priority processes in a densely loaded computer system can prevent a low-priority operation from ever receiving the CPU. When resources are SCARCE, high-priority processes consume them continuously. Ageing can help to tackle the problem of starvation. The importance of LONG waiting processes is increasingly raised as processes age.

The following table lists the differences between deadlock and starvation:

DeadlockStarvation
In the case of deadlock, none of the processes is EXECUTED since they are waiting for each other to finish.In case of starvation, high-priority processes continue to run, whereas low-priority activities are halted.
In this case, processes are preventing resources from being used.In this case, high-priority processes consume resources constantly.

The necessary conditions for deadlock are:

  • No Preemption
  • Hold and Wait
  • Circular Wait
  • Mutual Exclusion
The necessary condition for starvation includes that the process must be having low priority and there must be other high priority resources that are continuously occupying the resources.
It can be avoided by avoiding the conditions that lead to deadlock.Starvation can be avoided with the concept of ageing.
3.

What do you understand about deadlocks in the context of Operating Systems? What are the necessary conditions for deadlock to occur in a system?

Answer»

When a process enters a WAITING state because another waiting process is holding the requested resource, it is referred to as a deadlock. A typical difficulty in multi-processing is a deadlock, which occurs when numerous processes share a mutually exclusive resource known as a soft lock or software.

The FOLLOWING are the necessary conditions for a deadlock to occur in a system:

  • No preemption - A resource can only be released FREELY by the process that is holding it once it has completed its task.
  • Mutual Exclusion - The resource should not be shareable. If the resource is being used by a process, it cannot be used by another process until the current process RELEASES it.
  • Hold and wait - Suppose that a process holds onto some of the resources required for its execution. However, some of the resources that it requires are being held by other resources. Deadlock can happen only when this process does not give away its acquired resources and keeps on waiting for the other resources.
  • Circular Wait - Two or more processes waiting for each other to complete their task and release the resources should form a CYCLIC dependency graph. It is only then that no process would be able to complete its execution and a deadlock would be obtained.
4.

What do you understand about Data Independence in the context of DataBase Management Systems (DBMS)?

Answer»

In Database Management Systems (DBMS), data independence implies that the application is independent of the storage structure and data ACCESS mechanism. It allows you to change the schema definition at one level without having to change the schema definition at the next level up.

Data independence can be divided into two categories:

  • Physical Data Independence: The data CONTAINED in the database is referred to as physical data. It's in a binary format. Physical changes should not have an impact on the logical level. For example, if we wish to edit data WITHIN a table, we shouldn't change the table's format.
  • Logical Data Independence (LDI): The ability to update the CONCEPTUAL schema without having to change the external schema is referred to as logical data independence. To distinguish the external level from the conceptual view, logical data independence is used. Any modifications to the conceptual representation of the data will not AFFECT the user’s view of the data.
5.

What do you understand about ACID properties in the context of Database Management Systems (DBMS)?

Answer»

The ACID properties for a TRANSACTION in SQL DBMS refers to the following properties:

  • Atomicity: Atomicity refers to the fact that DATA remains atomic. It means that if any operation on the data is conducted, it should either be performed or executed completely, or it should not be performed at all. It also implies that the operation should not be interrupted or just half completed. When performing operations on a transaction, the operation should be completed rather than partially.
  • Consistency: The term "consistency" denotes that the value should be retained at all times. The integrity of the data should be maintained in DBMS, which means that whenever a modification is made to the database, it should always be preserved. The integrity of the data is critical in transactions so that the database remains consistent before and after the transaction. The information should always be accurate.
  • Isolation: The term "isolation" refers to the act of being separated from others. Isolation in DBMS refers to the property of a database where no data from one database should impact the other and where many transactions can take place at the same time. In other words, when the operation on the first database is finished, the process on the second database should begin. It indicates that if two actions are conducted on two different databases, the value of one database may not be affected by the value of the other. When two or more transactions OCCUR at the same time in the case of transactions, consistency should be maintained. Any modifications made in one transaction will not be visible to other transactions until the change is committed to the memory.
  • Durability: The term "durability" refers to something's ability to last. The term durability in DBMS refers to the fact that if an operation is completed successfully, the data remains permanent in the database. The database's durability should be such that even if the system fails or crashes, the database will survive. However, if the database is lost, the recovery manager is responsible for guaranteeing the database's long-term viability. Every time we make a change, we must USE the COMMIT COMMAND to commit the values.
6.

What do you understand by query optimisation in the context of SQL?

Answer»

A single query can be run using various methods or rewritten in various formats and STRUCTURES. As a result, the topic of query optimization arises: which of these forms or paths is the most efficient? The query optimizer considers all alternative query plans to discover the most efficient way to EXECUTE a query.

The purpose of query optimization is to reduce the number of system resources necessary to complete a query, allowing the user to receive the proper result set more quickly.

  • It gives the user faster results, making the application appear to be speedier.
  • Second, because each request takes less time than unoptimized queries, the system can HANDLE more queries in the same amount of time.
  • Finally, query optimization decreases the amount of WEAR on the server's hardware (for example, disk drives) and allows it to run more efficiently (e.g. lower power consumption, less memory usage).

A query can be optimised in one of two ways: 

  • Analyze and alter RELATIONAL phrases that are equivalent: Reduce the number of tuples and columns in the intermediate and final query processes (discussed here).
  • For each operation, multiple algorithms can be used: These underlying techniques influence the frequency of disk and block accesses by determining how tuples are accessed from the data structures they are stored in, indexing, hashing, and data retrieval.
7.

What do you know about RDBMS? What are the advantages and disadvantages of using RDBMS?

Answer»

RDBMS is an acronym for Relational DataBase Management Systems. It's an application that LETS us build, remove, and update relational databases. A relational database is a database system that stores and retrieves data in the FORM of rows and columns in a tabular format. It is a minor subset of DBMS that was created in the 1970s by E.F Codd. The MAJOR DBMS, such as SQL, My-SQL, and ORACLE, are all based on relational DBMS concepts.

The following features are simulated by Relational Database Management Systems to maintain data integrity:

  • Entity Integrity: No two records of a database table can be completely duplicated.
  • Referential Integrity: Only those rows of those tables that are not used by other tables can be erased. Otherwise, data discrepancy may result.
  • User-defined Integrity: Rules based on confidentiality and access that are established by the users.
  • Domain integrity: The database tables' columns are contained inside certain specified limits based on default values, data types, or ranges.

The following are the advantages of an RDMS:

  • SIMPLE to manage: Each table can be modified independently without impacting the others. It offers logical database independence i.e. data can be viewed in different ways by the different users.
  • Secured: It is more secure since it has numerous levels of security. Access to shared data might be restricted.
  • Flexible: Data may be updated at a single location without having to make changes to many files. It limits redundancy and replication of the data. Databases can be simply expanded to accommodate additional records, increasing scalability. It also makes it easier to use SQL queries.
  • Users: RDBMS can store many users in a client-side architecture.
  • Allows enormous amounts of data to be stored and retrieved with ease.
  • Simple Data Handling: The relational architecture allows for faster data retrieval. Due to keys, indexes, and normalisation principles, data redundancy or duplication is avoided. Because RDBMS is built on ACID principles for data transactions, data consistency is ensured (Atomicity Consistency Isolation Durability).
  • Tolerance for Failures: Database replication allows for simultaneous access and aids in system recovery in the event of disasters such as power outages or unexpected shutdowns.

The following are the disadvantages of an RDMS:

  • High Cost and Extensive Hardware and Software Support: To make these systems work, huge budgets and setups are necessary.
  • Scalability: As more data is added, more servers, as well as more power and memory, are necessary.
  • Complexity: Large amounts of data complicate understanding of RELATIONSHIPS and may reduce performance.
  • Structured Limits: A relational database system's fields or columns are surrounded by various limits, which can lead to data loss. It is difficult to recover the lost data.
8.

What do you understand about checkpoints in the context of Database Management Systems (DBMS)? What are the advantages of using checkpoints?

Answer»

The checkpoint specifies a time when the DBMS was in a consistent state and all transactions had been committed. These checkpoints are tracked during transaction execution. Transaction log files will be created after the execution. The log file is destroyed when it reaches the savepoint/checkpoint by RECORDING its update to the database. Then a NEW log is produced with the transaction's upcoming execution actions, which is updated until the next checkpoint, and the process continues.

When transaction logs are created in a real-time SETTING, they consume a significant amount of storage space. Keeping track of each update and maintaining it may also take up more physical space on the system. As the transaction log file grows in size, it may eventually become unmanageable. Checkpoints can be used to address this. A Checkpoint is a way for deleting all prior transaction logs and saving them in a permanent storage location.

The following are the advantages of checkpoints:

  • It makes the data recovery procedure GO faster.
  • The majority of DBMS packages perform self-checkpoints.
  • To avoid unnecessary redo operations, checkpoint records in the log file are employed.
  • It has very low OVERHEAD and can be done frequently because dirty pages are flushed away continuously in the background.
9.

What is the difference between mutable and immutable objects in the context of the Java programming language?

Answer»
  • Mutable objects - Objects that can have their value altered after initialization are known as mutable objects. After the object is formed, we can update its values, such as FIELDS and states. Java.util.Date, StringBuilder, and StringBuffer are just a few examples. When we update the value of an existing mutable object, no new object is generated; instead, the value of the existing object is changed. The classes of these objects contain methods for making modifications to them.
  • Immutable objects - Immutable objects are those whose values cannot be modified once they have been created. We are unable to make any changes to the object once it has been created. Primitive objects such as int, long, float, and double, as WELL as all legacy classes, Wrapper class, and String class, are examples. In a nutshell, immutable refers to something that cannot be changed or modified. The object values and state of immutable objects cannot be modified once they have been created. For immutable objects, only Getters (get() method) and not Setters (SET() method) are available.

The following table LISTS the differences between mutable objects and immutable objects:

Mutable ObjectsImmutable Objects
Without creating a new object, mutable objects can be altered to any value or state.Immutable objects, on the other hand, cannot have their value or state modified after they have been formed. Whenever we modify the state of an immutable object, a new object is produced.
Mutable objects have a method for changing the object's content.Immutable objects, on the other hand, do not have any methods for changing their values.
Setters and getters are both supported by mutable objects.Immutable objects, on the other hand, only support setters and not getters.
Mutable objects may or may not be thread-safe.Immutable objects are thread-safe by default.
StringBuffer, Java.util.Date, StringBuilder, and other mutable classes are examples.Legacy classes, wrapper classes, String classes, and other immutable objects are examples.
10.

What is the difference between functions and procedures in the context of computer programming?

Answer»
  • Function: One of the most fundamental concepts in computer programming is function. It's used to compute anything based on a SET of inputs.   User-defined or pre-defined functions are also possible. A BLOCK of code in the function program performs certain duties or functions.
  • Procedure: A procedure is a set of instructions or commands used in computer programming. It is referred to as a procedure, subroutine, function, or subprogram depending on the programming language. For example, in SQL both function and procedures are distinct concepts.

The following table lists the differences between functions and procedures:

FunctionProcedure
A function is a type of equation that is used to calculate anything from a set of inputs. As a result, it got its name from Mathematics.A procedure is a collection of commands that are executed in a specific order.
In SQL, a procedure can invoke a function.A function, on the other HAND, cannot invoke a procedure in SQL.
We can't use DML (Data manipulation language) commands LIKE Insert, Delete, or UPDATE inside a SQL function.DML instructions can be used inside the procedure in SQL.
SQL queries can call functions.Procedures, however, cannot be accessed via a SQL query.
When functions are called, they are compiled each time. Procedures, on the other hand, are only compiled once and can be called as many times as needed without having to be compiled each time.
A function's return statement returns the control and result value to the calling code.The procedure's return statement returns control to the calling code, it cannot return the result value.
Explicit transaction handles are not supported by the function.Explicit transaction handles are supported by the procedure.
The SELECT statement can be used to work on functions.It is not possible to use it in a SELECT statement.
11.

What do you understand about virtual functions in the context of the C++ programming language?

Answer»

A virtual function is a MEMBER function defined in a base class that is redefined (overridden) by a derived class. When you use a pointer or a reference to the base class to refer to a derived class object, you can call a virtual function for that object and have it run the derived class's version of the function. Regardless of the type of reference (or pointer) used for the function call, virtual functions ENSURE that the right function is called for an object. They're mostly used to achieve polymorphism at runtime. The virtual KEYWORD is used to DECLARE functions in base classes. The call to a virtual function is resolved at runtime.

Let us understand it better with the help of the following example:

#include<bits/stdc++.h>using namespace std;class Parent {public: virtual void fun() // virtual function { cout << "Inside the fun() method of Parent class\n"; } void foo() { cout << "Inside the foo() method of Parent class\n"; }};class Child : public Parent {public: void fun() { cout << "Inside the fun() method of Child class\n"; } void foo() { cout << "Inside the foo() method of Child class\n"; }};int main(){ Parent *parent_object_pointer; Child child_object_pointer; parent_object_pointer = &child_object_pointer; // Virtual function, binded at runtime parent_object_pointer->fun(); // Non-virtual function, binded at compile time parent_object_pointer->foo(); return 0;}

Output:

Inside the fun() method of Child classInside the foo() method of Parent class

Explanation:

In the above code, the class Child inherits from the class Parent. Two methods fun() and foo() are defined in the Parent class and are overridden in the Child class. However, the fun() method is declared as a virtual function by using the ‘virtual’ keyword. Inside the main() method, we create an object of the Parent class and initialise it with an object of the Child class. So, the call to the fun() method is resolved at run time and not at compile time. Because of this, the statement “Inside the fun() method of Child class” gets printed. SIMILARLY, the call to the foo() method gets resolved at compile time and not at run time. Because of this, the statement “Inside the foo() method of Parent class” gets printed.

12.

What do you understand about Abstraction in the context of Object-Oriented Programming languages? What are its advantages?

Answer»

Abstraction Is obfuscating the internal implementation and focusing solely on the services. It is accomplished by utilising abstract classes and interfaces and then putting them into action. Only the features of an object that distinguish it from all other objects are required. Only the most crucial details are highlighted, while the remainder is hidden from the user or reader.

Let us consider an example of abstraction in the real world: By emphasizing the set of services offered by the bank via the ATM GUI screen, the bank is highlighting the set of services offered by the bank without highlighting internal implementation.

Abstraction can be divided into three CATEGORIES as follows:

  • Procedural Abstraction: As the name implies, procedural abstraction entails a series of procedures in the form of functions that are followed ONE after the other to achieve abstraction through classes.
  • Data Abstraction: As the phrase implies, abstraction is the process of extracting information from a set of data that describes an entity.
  • Control Abstraction: Control abstraction is achieved by creating the program in a WAY that encloses object details.

The following are the advantages of abstraction:

  • The main benefit of using abstraction in programming is that it allows you to group several RELATED classes as siblings
  • Because there are no highlights to internal implementation, users or communities can accomplish security.
  • The enhancement will become easier because any modifications to the internal system may be made without affecting end users.
  • It gives the end-user additional flexibility in how they can use the system.
  • It expands the application's functionality.
13.

What do you understand about exceptions in the context of the Java programming language? What are the different types of exceptions in Java?

Answer»

An EXCEPTION is an unwelcome or unexpected occurrence that occurs during the execution of a program, i.e. at run time, and disturbs the program's usual flow of instructions. The APPLICATION can detect and handle exceptions. When a method throws an exception, it creates an object. The exception object is the name given to this object. It contains details about the exception, such as the name and DESCRIPTION of the error, as well as the program's state at the time the error occurred.

An exception can happen for a variety of reasons. Here are a few examples:

  • User input that is not valid.
  • Failure of a device.
  • A network connection is lost.
  • Physical restraints (eg: out of disk memory).
  • Code flaws.
  • Attempting to open a file that is currently unavailable.

Java defines several different types of exceptions for its various class libraries. Users can also define their exceptions in Java. The following are the different types of exceptions in Java:

  • Built-in Exceptions: Exceptions that are present in Java libraries are known as built-in exceptions. These exceptions are appropriate for explaining specific mistake scenarios.
    • Checked Exceptions: Checked exceptions are also known as compile-time exceptions SINCE the COMPILER checks them at compile time.
    • Unchecked Exceptions: Unchecked exceptions are the polar opposite of checked exceptions. These exceptions will not be checked by the compiler at compilation time. To put it another way, if a programme throws an unchecked exception, even if we don't handle or declare it, the programme won't throw a compilation error.
  • User-Defined Exceptions: In some cases, Java's built-in exceptions are unable to adequately explain a scenario. In such instances, users can design their exceptions, known as 'user-defined Exceptions’.
14.

What is the difference between method overloading and method overriding in the context of the Java programming language?

Answer»
  • Method overloading - Method Overloading is a polymorphism that occurs at COMPILE time. Method overloading is when a class has multiple methods with the same name but distinct signatures. The return type of a method can be the same or different in method overloading, but we must alter the argument SINCE we cannot create method overloading in Java by just changing the method's return type.
  • Method overriding - Method Overriding is a polymorphism that occurs at RUNTIME. The derived class offers the exact implementation of the method that is already supplied by the base or parent class in method overriding. The return type must be the same or co-variant when overriding a method.

The following table lists the differences between method overloading and method overriding:

Method Overloading Method Overriding
Method overloading is a polymorphism that occurs at compile time.Method overriding is a polymorphism that occurs at runtime.
It contributes to the program's readability.It's used to provide the method's specific implementation, which is already provided by its parent or superclass.
Method overloading is done within a single class.Method overriding is done in two different CLASSES which have the relationship between them through inheritance.
Inheritance may or may not be required for method overloading.Inheritance is ALWAYS required for method overriding.
Methods must have the same name but distinct signatures when overloading.Methods that are overridden must have the same name and signature.
15.

What are some of the advantages and disadvantages of Object-Oriented Programming languages?

Answer»

The following are the advantages of Object ORIENTED Programming languages:

  • Instead of needing to start writing code from scratch, we can build programs from standard functioning modules that communicate with one another, which saves time and increases productivity. The OOP language allows us to divide the PROGRAM down into bite-sized problems that can be solved quickly (one object at a time).
  • Object-Oriented Programming languages have proven to increase programmer efficiency, improve software quality, and reduce maintenance costs.
  • It is FEASIBLE for several instances of a class to coexist without interfering with each other. This allows for parallel development.
  • It is relatively simple to divide a project's work into objects.
  • We can minimise duplicate code and increase the use of existing classes by using inheritance.
  • The data concealing principle helps programmers in developing secure programs.
  • More information about the model in an implementable form can be captured by using the data-centred design technique.

The following are the disadvantages of Object-Oriented Programming languages:

  • The length of programs written in the OOP language is significantly greater than that of programs written in the procedural technique. As the program grows in SIZE, it takes longer to execute, resulting in slower program execution. That can make it be an inefficient choice when there are technical limitations involved due to the size that it can end up being. Because of the duplication involved, the first-time coding can be more extensive than other options as well.
  • Because using OOP is a little challenging, programmers must have excellent design and programming skills, as well as adequate planning.
  • It takes some time to become used to OOPs. For some PEOPLE, the thinking process involved with object-oriented programming is not natural.
16.

What are the differences between C and C++ programming languages?

Answer»
  • C programming language - C is a machine-independent structural or procedural-oriented computer language that is widely utilized in a variety of applications. C is a fundamental programming language that can be used to create everything from operating systems (such as Windows) to complicated applications such as the Oracle database, Git, Python interpreter, and many others. Because it serves as the foundation for other programming languages, the C programming language might be referred to as a god's programming language. We can simply learn other programming languages if we already KNOW C. Dennis RITCHIE, a legendary computer scientist, created the C programming language at Bell Laboratories. It has a few extra characteristics that set it APART from other programming languages.
  • C++ programming language - Bjarne Stroustrup created C++ in 1980 at Bell Labs as a special-purpose computer language. C++ is a programming language that is very similar to C and is so compatible with C that it can run 99 per cent of C PROGRAMS without modifying any source code. However, because C++ is an object-oriented programming language, it is a safer and more well-structured programming language than C.

You can learn more about their differences here.