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 are interrupts?

Answer»

An interrupt is a part of the hardware system that ALERTS the CPU when it wants to access a specific resource. This interrupt signal is received by an interrupt handler, which “TELLS” the PROCESSOR to operate in response to the interrupt request.

2.

What is the RR Scheduling Algorithm in OS?

Answer»

The RR (round-robin) scheduling algorithm was designed with time-sharing systems in mind. The CPU scheduler goes around a circular queue, allocating CPU to each task for a time period of up to around 10 to 100 milliseconds. 

It is SIMPLE and easy to IMPLEMENT. It is preemptive because processes are only allotted CPU for a certain amount of time. All processes get an equal share of CPU. DISADVANTAGES include CONTEXT switches, low THROUGHPUT, larger waiting time, and response time. 

3.

What are the two concepts of swapping in the context of OS? How does swapping help in better memory management?

Answer»

Swapping has been subdivided into two concepts: Swap-in and Swap-out.

  • Swap-out is a technique for transferring a process from RAM to the secondary memory.
  • Swap-in is a technique for removing a program from the secondary memory and reinstalling it in the main memory, also known as RAM.

Processes can be copied from the main memory to a BACKING store and then copied back at regular intervals determined by the operating system. Swapping allows more processes to execute at the same time than memory allows. Swapping allows the CPU to do numerous jobs at the same time. As a result, procedures don't have to wait very long to be executed. It aids the CPU's ABILITY to manage several tasks in a SINGLE main memory. It facilitates the creation and use of VIRTUAL memory. 

4.

What is meant by Cycle Stealing?

Answer»

In the context of Direct Memory Access, we come across cycle stealing (DMA). The DMA controller can either USE the data BUS when the CPU is not using it or FORCE the CPU to CEASE execution temporarily. Cycle stealing is the term for the second method. It's worth noting that cycle stealing is only possible at specific breakpoints in an instruction cycle.

5.

Write the code to reverse a given number using Command Line Arguments.

Answer»
  • There is no need for a specific input line because the number is entered as a Command-line Argument.
  • From the command line argument, extract the input number. This number will be of the String type.
  • Convert this number to an integer and save it in the variable num.
  • Create a variable called rev to record the inverse of this number.
  • Now loop through num until it equals zero, i.e. (num > 0).
  • At the end of each iteration, add the REMAINDER of num to rev after multiplying it by 10. The last digit of num will be STORED in rev.
  • To ELIMINATE the last digit from the num, divide it by ten.
  • When the loop is finished, rev has the opposite of num.
class IB { // Function for reversing the number public static int revNum(int num) { // Variable which stores the // required reverse number int rev = 0; // Traversing the number digit by digit while (1) { if(num <= 0) break; // Attach the last digit of num // as the next digit of rev rev = rev * 10 + num % 10; // Drop the last digit of num num = num / 10; } // Return the resultant reverse number return rev; } public static void main(String[] args) { if (args.length > 0) { // Obtain the command line argument and // Convert it to integer type from string type int number = Integer.parseInt(args[0]); System.out.println(revNum(number)); } else System.out.println("No command line arguments found."); }}
6.

How will you swap two numbers without the use of a third variable?

Answer»

This can be achieved using ARITHMETIC operations.

int x = 5, y = 15; // Code to SWAP the values of x and y x = x + y; // x now BECOMES 20 y = x - y; // y becomes 5 x = x - y; // x becomes 15

Or

int x = 5, y = 15; // Code to swap the values of x and y x = x * y; // x now becomes 75 y = x / y; // y becomes 5 x = x / y; // x becomes 15

This can ALSO be achieved using bitwise operations.

int x = 5, y = 15; // Code to swap the values of x and y x = x ^ y; // x now becomes 20 y = x ^ y; // y becomes 5 x = x ^ y; // x becomes 15
7.

What is the difference between the Java Development Kit (JDK), Java Runtime Environment (JRE), and Java Virtual Machine (JVM)?

Answer»

Java Virtual Machine(JVM) is an abstract machine that offers a runtime environment for Java byte-code execution. It is a specification that DESCRIBES how the Java Virtual Machine works. Oracle and other companies have helped with its adoption. JRE is the name of the program that implements it.

There are JVMs for a variety of hardware and software systems (so JVM is platform-dependent). It is a runtime instance that is created when the Java class is executed. The JVM is divided into three parts: specification, implementation, and instance.

Java Runtime Environment (JRE) is an acronym for Java Runtime Environment. It is the JVM implementation. The Java Runtime Environment (JRE) is a collection of software tools for creating Java applications. It's responsible for creating the runtime environment. It is the JVM implementation. It is a real THING. It comprises a collection of libraries as well as other files that JVM uses during execution.

The TERM JDK stands for Java DEVELOPMENT Kit. It's a software development environment for creating Java applets and applications. It is a real thing. It includes JRE as well as developer tools. JDK is an implementation of any of Oracle Corporation's Java PLATFORMS, as listed below:

  • Java Platform Standard Edition
  • Java Platform Enterprise Edition
  • Java Platform Micro Edition
8.

What exactly are macros? What are the benefits and drawbacks?

Answer»

Macros are pre-processor constants that are replaced at compile time. Thus, a macro is a section of CODE in a program that has been given a name. The compiler substitutes this name with the ACTUAL PIECE of code whenever it encounters it.

The downside of macros is that they are not FUNCTION calls; they simply change the code. Similarly, they have the advantage of saving time when substituting the same values.

#include <stdio.h>// defining macros#define TEXT "Hello"#define EVEN 2#define SUMMATION (8 + 2)int main(){ printf("String: %s\n", TEXT); printf("First Even Number: %d\n", EVEN); printf("Summation: 8+2=%d\n", SUMMATION); return 0;}

Any instance of the terms TEXT, EVEN and SUMMATION in the sample above will be substituted by whatever is in their body.

9.

In a database management system, what are the two integrity rules?

Answer»

REFERENTIAL integrity rules and ENTITY integrity rules are the TWO forms of integrity rules.

According to referential integrity requirements, if a primary key value is used as a foreign key in a child table, it cannot be changed. Let R and S be two different relations. Assume that R relates to the relation S through a set of attributes that serve as the Primary Key of S and as a Foreign Key in the relation R. The Foreign Key in a TUPLE in R must then be either equal to the Primary Key in a tuple in S or completely NULL.

The main key value cannot be null due to entity integrity. An attribute X of a relation R(R) cannot take null values if it is a PRIME Attribute of R(R). A Prime Attribute is an attribute that is a part of a relation's Candidate Key.

10.

What is a checkpoint in a database management system, and when does it eventuate?

Answer»

A CHECKPOINT is a TECHNIQUE that removes all previous logs from the SYSTEM and stores them PERMANENTLY on the storage drive. Checkpoints are those LOCATIONS in the transaction log record from which all committed data up to the point of the crash can be recovered.

11.

What do you mean by SQL Correlated Subqueries?

Answer»

A correlated sub-QUERY is a sub-query that is dependent on another query. Sub-queries that are EXECUTED for each row of an outer query are referred to as correlated sub-queries. For each row in the outer query, each sub-query is executed once.

Correlated sub-queries can alternatively be thought of as queries that the PARENT statement uses for row-by-row PROCESSING. The parent statement, in this case, MIGHT be SELECT, UPDATE, or DELETE.

12.

What do you mean by concurrency control?

Answer»

Concurrency Control in a Database MANAGEMENT System is a method of CONTROLLING multiple operations at the same time without interfering. It ensures that Database transactions are completed in a timely and accurate manner to deliver accurate results without jeopardizing the database's data integrity.

The concurrency control mechanism is used by DBMS for the following reasons:

  • ISOLATION is achieved by reciprocal exclusion of conflicting transactions.
  • Conflicts between read-write and write-write must be resolved.
  • Constantly preserving execution obstacles in order to maintain database consistency
  • The system must keep TRACK of how the concurrent transactions interact. Concurrent-control techniques are used to ACHIEVE this control.
     
13.

What is the meaning of a command line argument in C?

Answer»

Command-line arguments are USED to get parameters from the command PROMPT in C. There are three arguments to the main FUNCTION in C. They are as follows:

  • Argument counter
  • Argument vector
  • Environment vector
14.

Explain memory leak in C++. How can you avoid it?

Answer»

Memory leaking happens in C++ when programmers dynamically allocate memory with the new keyword or using malloc()/calloc() and then forget to deallocate it with the delete() or delete[] operators or the free() function. In C++, one of the most common causes of memory leakage is the use of the incorrect delete operator.

The delete [] operator should be used to free an array of DATA values, whereas the delete operator should be used to clear a single allocated memory space.

 To avoid memory leak: 

  • When possible, UTILISE SMART pointers instead of MANUALLY managing memory.
  • Instead of char *, use std::string. All memory management is handled internally, which is quick and well-optimized.
  • Unless you're interacting with an older library, you should never use a raw pointer.
  • In C++, the SIMPLEST strategy to avoid memory leaks is to have a few new/delete calls as possible at the program level — ideally NONE.
  • Write all code between the new and delete keywords to allocate memory and deallocate memory.
15.

Enlist the differences between AWT and Swing in Java.

Answer»
AWTSwing
JAVA AWT is a Java API for creating graphical user interfaces.Swing is a part of Java Foundation Classes that are used to build a variety of apps.
The components that BELONG to Java AWT are heavily weighted.The components that belong to Java Swing are light weighted.
The EXECUTION time of AWT is more than that of Swing. AWT components are comparatively less powerful.The execution time of Swing is less than that of AWT. Swing components are comparatively more powerful.
The components that belong to Java AWT are platform-dependent.The components that belong to Java Swing are independent of any platform.
AWT does not support the MVC pattern.Swing SUPPORTS the MVC pattern.
16.

What is slice splicing in software testing? What are its two types?

Answer»

A PROGRAM SLICE is a set of program statements. We could code a slice and test it right away if we chose to construct software in terms of compatible slices. We can then code and test additional slices before combining them into good software. Slice splicing is the term for this process.

There are two forms of slicing: static and dynamic.

Static Slicing: 

  • A static slice of a program contains all statements that may change the value of a variable at any POINT during any arbitrary execution of the program.
  • In general, static slices are larger.
  • It considers every potential program execution.

Dynamic slicing: 

  • A dynamic slice of a program is made up of all the statements that ACTUALLY impact the value of a variable at any point for a specific execution of the program.
  • In general, dynamic slices are smaller.
  • Only takes into account a particular program execution.
17.

Give an instance where there was a bug that you didn't find in black box testing but discovered in white box testing.

Answer»

Let's IMAGINE you have an ITEM that is stored ACROSS numerous tables, and you WANT to delete it. Your black-box test case is considered passed after the entity disappears from the GUI after deletion in black-box testing. White-box testing, on the other hand, verifies that all relevant ROWS are removed from the tables. The test case is considered unsuccessful if the deletion simply deletes the parent record, leaving the child rows intact.

18.

In a software program, what is cyclomatic complexity?

Answer»

The number of linearly independent paths in a code segment is measured in terms of cyclomatic complexity. It's a software STATISTIC that shows how COMPLEX a code is. It is calculated using the program's Control Flow Graph. The nodes in the graph represent the smallest set of commands in a program, and a directed edge CONNECTS the two nodes, indicating whether the second command should be executed immediately after the first.

The directed graph inside control flow is the edge connecting two basic blocks of the program MATHEMATICALLY, as control may flow from first to second.

CC = E − N + P

where,

CC: cyclomatic complexity.

E: number of edges in the control flow graph

N: the number of nodes in the control flow graph

P: the number of CONNECTED elements

19.

Discuss the RSA algorithm in brief.

Answer»

The RSA, an asymmetric CRYPTOGRAPHY ALGORITHM, is used to PROTECT the data transfer. For encryption, this technique uses a public key, while the decryption key is kept secure or secret. Two huge PRIME numbers are used to generate the encryption key, which is then publicized along with an auxiliary value. This public key can be used for encryption by anyone, but only someone who knows the prime numbers can decrypt it. This technique, HOWEVER, is believed to be slow, and as a result, it is not frequently used to encrypt data.

20.

What is the tunnel mode in networking?

Answer»

TUNNEL Mode is a way of transmitting data over the Internet that encrypts both the contents and the ORIGINAL IP address information. It secures communications between security gateways, firewalls, and other devices in a Site-to-Site VPN. In Transport Mode or Tunnel Mode, the Encapsulating Security Payload (ESP) is USED. ESP encrypts the data and the IP header information in Tunnel Mode.

21.

What is Ethernet?

Answer»

Ethernet is a network technology that connects devices via cables for DATA TRANSMISSION in Local Area Networks (LANs), Metropolitan Area Networks (MANs), and Wide Area Networks (WANS). It delivers services on the OSI Model's Physical and Data Link LAYERS. The purpose of an Ethernet network is so computers and other devices can efficiently share FILES, information, and data. Ethernet was first introduced in 1980.

22.

What do you know about SLIP?

Answer»

Serial Line Internet Protocol (SLIP) is a basic protocol for communication over serial ports and routers that works with TCP/IP. They allow machines that were previously configured for direct communication to communicate with one another.

A client might be linked to the Internet service provider (ISP) over a slower SLIP line, for example. When a client requires a service, he or she submits a request to the ISP. The ISP responds to the request and SENDS it across high-speed multiplexed lines to the Internet. The results are then sent back to the client through SLIP lines by the ISP.

The format of a SLIP frame is FAIRLY simple, consisting of a payload and a flag that SERVES as an end delimiter. The flag is usually a special character with a decimal value of 192. If this flag is included in the data, it is preceded by an escape SEQUENCE, which prevents the receiver from mistaking it for the end of the frame.

23.

What is a Ping?

Answer»

A ping is a computer program that is used to determine whether a host is reachable and CAPABLE of accepting requests ACROSS an IP NETWORK. It operates by sending an ICMP (Internet Control Message Protocol) Echo to a network computer and waiting for a response. It can be used for troubleshooting as WELL.

24.

What do you understand about round trip time?

Answer»

The round-trip time (RTT) is the time it takes for a network request to travel from a starting point to a DESTINATION and back to the initial point in milliseconds (ms). RTT is a USEFUL indicator for measuring the health of a connection on a local network or the wider INTERNET, and it is frequently used by network MANAGERS to diagnose network connection speed and DEPENDABILITY.

25.

What is the difference between a clustered index and non clustered index ?

Answer»

A clustered index is a form of index that reorders the PHYSICAL storage of records in a table, whereas a NON clustered index is one in which the logical order of the index does not match the physical storage order of the rows on the disc. Insert and UPDATE operations are FASTER than with a clustered index. Data is PHYSICALLY stored in index order, making it faster to read than non-clustered data.

26.

What does a database schema imply? What are its types?

Answer»

A "database schema" is a plan for how a database is built that describes how data is ORGANIZED (DIVIDED into database tables in the case of RELATIONAL databases). A database schema is formally defined as a series of formulas (sentences) known as integrity constraints that are imposed on a database.

Physical schema, logical schema, and view schema are the three types of schema.

The physical schema describes how the data contained in blocks of storage is characterized at the physical level of a database.

The logical schema is the design of a database at the logical level; programmers and database administrators work at this level; data can be characterized as certain types of data records that are stored in data structures; however, internal details such as data structure IMPLEMENTATION are obscured at this level (available at the physical level).

View schema is the design of a database at the view level. This term refers to how end-users interact with database systems.

27.

What is piggybacking?

Answer»

After receiving DATA packets in two-way communication, the RECEIVER sends an acknowledgment (control frame or ACK) to the sender. The receiver, on the other hand, does not send the acknowledgment right away, instead of waiting until the next data packet is received by its NETWORK layer. The ACK is then ADDED to the incoming data frame. Piggybacking is the process of postponing the ACK and attaching it to the next outgoing data frame.

28.

What is NAT?

Answer»

NETWORK Address Translation (NAT) is an acronym for Network Address Translation. It involves modifying the IP headers of packets being TRANSPORTED over a traffic routing DEVICE to REMAP one IP address SPACE to another.

29.

What do you understand about a Subnet Mask?

Answer»

The number indicating the range of IP addresses that can be used within a network is called a Subnet Mask. Sub Networks or subnets are assigned to them. These SUBNETWORKS are a collection of LANs that are linked to the internet.

This Subnet mask is a 32-bit value that MASKS the IP address and divides it into two parts: the network address and the host address. Subnet Masks are made by assigning all network bits to "1" and all host bits to "0." There are two network addresses that can't be assigned to any host on the network: "0" and "255", which are assigned to the network and the broadcast address, RESPECTIVELY, and HENCE can't be assigned to anyone.

30.

What is IPsec? What are its components?

Answer»

IP security (IPSec) is an Internet Engineering Task Force (IETF) STANDARD suite of PROTOCOLS that offer data authentication, integrity, and confidentiality between two COMMUNICATION points over an IP network. It also specifies how packets are encrypted, decrypted, and authenticated. It specifies the protocols for safe key exchange and key management.

It consists of the following components:

  • Encapsulating Security Payload (ESP): Data integrity, encryption, authentication, and anti-replay are all provided by ESP. It also supports payload authentication.
  • Authentication Header (AH): This header also supports data integrity, authentication, and anti-replay, but not encryption. anti-replay protection guards against unwanted packet transmission. It does not ensure the privacy of data.
  • IKE (Internet Key Exchange): It's a network security protocol that allows two devices to dynamically exchange encryption keys and find a way to communicate across a Security Association (SA). To support secure communication, the Security Association (SA) creates common security PROPERTIES between two network entities. IKE (Internet Key Exchange) protects the content of messages and serves as an open framework for implementing common ALGORITHMS like SHA and MD5. Each packet is assigned a unique identifier by the algorithm's IP sec users. The device can then determine whether a packet is correct or not using this identifier. Unauthorized packets are deleted and not delivered to the intended recipient.
31.

What is Socket Programming? What Are The Benefits And Drawbacks Of Java Sockets?

Answer»

Socket programming is a method of allowing two network nodes to communicate with each other. One socket (node) LISTENS on a SPECIFIC port at an IP address, while the other socket connects with it. While the client connects to the server, the server creates the listener socket.

Java Socket Benefits:

  • Sockets are adaptable and adequate. For general communications, efficient socket-based programming is simple to build.
  • Low network TRAFFIC is caused by sockets. Unlike HTML forms and CGI scripts, which construct and send entire web pages for each new request, Java applets can simply send the information that has changed.

Java Socket Drawbacks:

  • Because a Java applet running in a Web browser can only connect to the machine from which it originated and nowhere else on the network, security restrictions can be OPPRESSIVE at times.
  • Despite all of Java's beneficial capabilities, Socket-based CONNECTIONS merely allow for the transmission of raw data packets between programs. Both the client and the server must provide ways for making the data valuable in some way.
  • Because data formats and protocols are application-specific, the re-use of socket-based systems is limited.