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.

How will you delete a node in a doubly-linked list (DLL)?

Answer»

The following is the process to delete a node in a doubly-linked list (DLL):

  • STEP 1: Create a function that takes as arguments a linked list and a node that needs to be deleted, and deletes the node.
  • Step 2: To delete a HEAD node:
    • Move the head pointer to the next node in the current node (head here).
    • Set the previous pointer of the next node to the previous pointer of the current node.
  • Step 3: If you wish to remove the centre node, follow these steps.
    • Set the previous pointer of the next node to the previous pointer of the current node.
    • Move the previous node's next pointer to the current node's next pointer.
    • Remove the node. (the most recent node)
    • You do not need to delete previous or next if they are NULL. (for removing the final node)
  • Step 4: Call the function on the given linked list and specify the node you want to delete.

Code to delete a node in a doubly-linked list:

import gc # Node of the doubly linked listclass Node: def __init__(self, data): self.data = data self.next = NONE self.prev = None class DoublyLinkedList: def __init__(self): self.head = None # A function to delete a node in a Doubly Linked List. def deleteNode(self, todelete): if self.head is None or todelete is None: return # If node to be deleted is the head node if self.head == todelete: self.head = todelete.next # Change next only if node to be deleted is NOT # the last node if todelete.next is not None: todelete.next.prev = todelete.prev # Change prev only if node to be deleted is NOT # the first node if todelete.prev is not None: todelete.prev.next = todelete.next gc.collect() # Given a reference to the head of a list and an # integer, inserts a new node on the front of list def push(self, new_data): # Allocates node and inserts the data in it new_node = Node(new_data) # MAKE next of new node as head and previous as None new_node.next = self.head # Change prev of head node to new_node if self.head is not None: self.head.prev = new_node # Move the head to point to the new node self.head = new_node def printList(self, node): while(node is not None): print(node.data,end=' ') node = node.next # Start with an empty listdll = DoublyLinkedList()dll.push(2);dll.push(4);dll.push(8);dll.push(10); print ("\n The original linked list",end=' ')dll.printList(dll.head) # delete nodes from doubly linked listdll.deleteNode(dll.head)dll.deleteNode(dll.head.next)dll.deleteNode(dll.head.next)# Updated linked list will be NULL<-8->NULLprint("\n The updated linked list",end=' ')dll.printList(dll.head)Useful Resources:
  • Networking Interview
  • Data Structure Interview
  • Algorithm Interview
  • Compilers
  • Interview Resources
2.

What are pragma directives?

Answer»

This is a special-purpose directive that is used to enable or disable certain functionality. This type of directive is COMPILER-specific, meaning it differs from one compiler to the next. The following are some of the #pragma directives:

  • #pragma startup and #pragma EXIT: These directives help us describe the routines that must run before the program starts (before control transfers to main()) and right before programme exit (just before control returns from main()).
  • #pragma warn Directive: This directive is used to hide warning messages that appear during the compilation process. When we have a huge programme and want to solve all of the errors before looking at warnings, we may use this to hide all warnings and focus on the faults. By making little syntax adjustments, we may make the warnings visible once more.
  • #pragma GCC poison: The GCC compiler supports this directive, which is used to totally eliminate an identifier from a programme. The #pragma GCC poison directive can be used to prevent an identifier from being used.
  • #pragma GCC dependence: You can use the #pragma GCC dependency to compare the relative dates of two files. A warning is issued if the other file is more recent than the current file. If the current file is derived from the other file and needs to be regenerated, this is handy.
  • #pragma GCC system_header: This pragma does not accept any arguments. The rest of the code in the current file is PROCESSED as though it originated from a system header as a result of this.
  • #pragma once: The #pragma once directive has a fairly STRAIGHTFORWARD concept. Even if the programmer includes it numerous times during a compilation, the header file containing this directive is only included once. There is no mention of this in any ISO C++ standard. The #include guard idiom is comparable to this directive. The use of #pragma only once prevents the programme from being optimised for numerous INCLUSIONS.
3.

What is the difference between Manual and Automation Testing.

Answer»

There are some significant distinctions between automated and manual testing. Manual testing involves a human performing tests STEP by step without the use of test scripts. Test automation frameworks, as well as other tools and technologies, are used to automate the execution of tests in automated testing. Learn More.

Manual TestingAutomation Testing
Manual testing takes time and requires human resources.Because automated testing is CARRIED out by software tools, it is much faster than manual testing.
Manual testing is only feasible when the test cases are executed only once or twice, with no need for frequent repetition.When test cases are run frequently over a lengthy period of time, automated testing is a viable alternative.
Manual testing allows for human observation, which may be more beneficial if the goal is ENHANCED user-friendliness or customer satisfaction.Automated testing excludes human observation and cannot ensure user-friendliness or a FAVOURABLE consumer experience.
4.

Describe how you would reverse a singly linked list.

Answer»

The TASK is to reverse a linked list given a pointer to the HEAD node. By modifying the linkages between nodes, we can reverse the list.

Iterative method:

  • Set up three-pointers. prev is set to NULL, curr is set to head, and NEXT is set to NULL.
  • Go through the linked list one by one. Do the following in a loop.
// Before CHANGING next of CURRENT, // store next node next = curr->next// Now change next of current // This is where actual reversing happens curr->next = prev // Move prev and curr one step forward prev = curr curr = next
5.

What daemon is responsible for tracking events on your system?

Answer»

The DAEMON 'syslogd' is in CHARGE of keeping TRACK of system data and storing it in PARTICULAR LOG files.

6.

What is marshalling?

Answer»

Marshalling is the process of converting an object's MEMORY representation into a format that can be stored or transmitted to other software applications. Marshalling converts an object into serialised form, allowing communication between remote objects.

SERIALIZATION and marshalling are TWO terms that are often used interchangeably. The objective of marshalling is to have the same object that is present in one operating programme, to be present in another running programme, i.e. object on a client to be transmitted to and present on the server. For EXAMPLE, serialization does not always have this intention because it is simply concerned with translating data into a stream of bytes.

7.

What is the difference between array and hash table?

Answer»

An array has a SET NUMBER of memory regions at first. It should store a preset type at each site (e.g. an integer). It could have repeated values or not.

Hash is implemented as a set, on the other HAND. It's built around an array. A hash function determines the position of an item in an array. There should be no duplicates in a hash. A collision occurs when duplicates occur, and there are several techniques for RESOLVING this (e.g. chain duplicates, rehash and so on).

8.

Explain the Unix kernel.

Answer»

The operating system's central core is the UNIX kernel. It CONNECTS to the hardware DEVICES, as WELL as to the processor, memory, and I/O management. Users' requests are managed by the kernel using system CALLS that move the process from user space to kernel space.

A context switch occurs every time a user process performs a system call, such as read(), fork(), exec(), open(), and so on. A context switch is a mechanism that allows a process to change its state. The process can either be blocked until the system call is completed, or it can continue and be told of the COMPLETION of the system call via a signal (nonblocking).

9.

What is a parent/child selector?

Answer»

<P>All ELEMENTS that are a direct child of the specified ELEMENT are SELECTED using the ("parent > child") selection.

Parameters:

  • Parent: This specifies the parent element to be selected.
  • Child: This specifies the direct child element (of the specified parent element) to be selected.

It chooses and returns all of the parent element's direct children.

Here is an example of how to use the jQuery parent > child selector: 

<html><body><h2>Sample Demo</h2><div><p>First line.</p><span>Middle line. (span outside of p element.) </span><p>LAST line. </p></div><br><div><p>First line.</p><p>Middle line. <span>span inside p element.</span></p><p>Last line. </p></div></body></html>
10.

What is a virtual memory?

Answer»

A segment of memory that is produced MOMENTARILY on the storage device is referred to as virtual memory. It occurs when a computer's RAM gets depleted as a result of multiple processes executing at the same time.

A part of the storage disc is made accessible for usage as RAM by the operating system. Because processor power is consumed by moving data around rather than performing instructions, virtual memory is substantially slower than main memory. The operating systems guide shows how the operating system handles memory. When the computer needs to use virtual memory, latency increases. The operating system employs SWAPPING to transport data between RAM and virtual memory. Data from processes that aren't in use right now is moved out of RAM and STORED in virtual memory by the operating system. When the PROCESS is needed again, it copies the data back into RAM.

As transferring to a HARD disc takes far longer than reading and writing RAM, using virtual memory slows down the machine.

11.

What is the default port for the MySQL server?

Answer»

The MySQL client, MySQL CONNECTORS, and utilities like mysqldump and mysqlpump all use PORT 3306 as the default port for the old MySQL PROTOCOL (port).

12.

What are the different types of OSI layers?

Answer»

Open Systems Interconnection (OSI) is an acronym for Open Systems Interconnection. It was created in 1984 by ISO or the International Organization for Standardization. It is a seven-layer ARCHITECTURE, with each layer performing distinct functions. These seven layers work together to send data from one person to another across the globe.

  • Physical Layer: The physical layer is the lowest layer in the OSI reference model. It is in charge of establishing a physical connection between the devices. Bits of information are stored in the physical layer. It is in charge of sending individual bits from one node to another. When this layer receives data, it converts the signal received into 0s and 1s and sends them to the Data Link layer, which reassembles the frame.
  • Data Link Layer: The data link layer is in charge of message transport from node to node. The major purpose of this layer is to ensure that data transfers from one node to another through the physical layer are error-free. There are two sublayers in the Data Link Layer:
    • Media Access Control (MAC)
    • Logical Link Control (LLC)
  • Network Layer: The network layer is responsible for data transmission between hosts that are CONNECTED to various networks. It also handles packet routing, which is the choosing of the shortest path to send a packet from a large number of options. The network layer places the IP addresses of the sender and receiver in the header.
  • Transport Layer: The application layer receives services from the transport layer, while the network layer receives services from the transport layer. Segments are the units of data in the transport layer. It is in charge of the full message's delivery from beginning to end. If an error is detected, the transport layer ACKNOWLEDGES the successful data transmission and re-transmits the data.
  • Session Layer: This layer is in charge of establishing connections, maintaining sessions, authenticating users, and ensuring security.
  • Presentation Layer: The data from the application layer is retrieved and processed here so that it may be transmitted across the network in the proper format.
  • Application Layer: The Application layer, which is implemented by network applications, is at the very top of the OSI Reference Model stack of layers. These PROGRAMS generate the data that must be sent across the network. This layer also acts as a window for application services to connect to the network and show the information they receive to the user.
13.

What is meant by stack and queue?

Answer»
  • A stack is a linear data STRUCTURE in which elements can only be added or removed from the top side of the list. The LIFO (LAST In First Out) principle dictates that the element put last is the first to COME out of a stack. Pushing an element into a stack is referred to as a push operation while removing an element from a stack is referred to as a pop operation. With a pointer called top, we always maintain track of the last entry in the list in the stack.
  • A queue is a linear data structure in which elements can only be inserted from one side of the list, called the back, and only deleted from the other side, called the front. The FIFO (First In First Out) principle GOVERNS the queue data structure, which MEANS that the element placed first in the list is the first one withdrawn from the list. Enqueue operations are used to add items to a queue, and dequeue operations are used to remove items from a queue.
14.

What is the use of pointers?

Answer»

POINTERS are USED to store and maintain the addresses of memory blocks that are dynamically allocated. Data objects or arrays of objects are stored in these blocks. The heap or free store is a memory space in most structured and object-oriented languages from which objects are dynamically allocated.

Example in C:

#include <stdio.h&GT;void printpointer(){ int var = 10; int *pt; pt = &AMP;var; printf("The address is: %p \n",pt); printf("The value is: %d \n", *pt); }int main(){ printpointer();}
15.

What are the types of kernel objects?

Answer»

The FOLLOWING are the several types of kernel objects:

  • ACCESS token objects
  • Event objects
  • File objects
  • File-mapping objects
  • I/O COMPLETION port objects
  • Job objects
  • Mailslot objects
  • Mutex objects
  • Pipe objects
  • Process objects
  • Semaphore objects
  • Thread objects
  • Waitable timer objects 
16.

What are SDLC phases?

Answer»

The SDLC (system development life cycle) is a project management MODEL. It specifies the several stages that must be completed in order to take a project from conception to deployment and afterwards maintenance.

The 7 Stages of the System Development Life Cycle:

  • Planning Stage: The planning stage (also known as the feasibility stage) is the time when developers start thinking about the next project. It helps in understanding the definition of the problem and scope of any existing systems, as well as the determination of the new system objectives.
  • Feasibility or REQUIREMENTS of Analysis Stage: Gathering all of the specific details REQUIRED for a new system, as well as defining the first prototype concepts, is part of the analysis step.
  • Design and Prototyping Stage: The design stage is required before moving on to the primary developer stage. Developers will begin by outlining the overall application's characteristics, as well as individual aspects such as User interfaces, System interfaces, Network requirements, Databases.
  • Software Development Stage: The development stage is when programmers write code and build the application based on the design papers and specifications that were created earlier.
  • Software Testing Stage: Developers will go over their software with a fine-tooth comb during the testing stage, identifying any flaws or defects that need to be recorded, corrected, and retested.
  • Implementation and Integration: The general design for the app will come together after testing. Developer efforts will integrate DIFFERENT modules or designs into the source code, usually by using training environments to find more faults or defects.
  • Operations and Maintenance Stage: This can include resolving new issues that arise as a result of user reports or dealing with LEFTOVER bugs that were not able to be corrected before launch.
17.

What are the advantages and disadvantages of DHCP?

Answer»

DHCP stands for Dynamic Host Configuration PROTOCOL, and it is a client-server architecture.

The following are the advantages or benefits of DHCP:

  • DHCP is simple to set up and assign IP addresses to request clients automatically. As a result, the time it takes to manually configure IP addresses can be decreased.
  • There are no additional expenditures associated with the deployment.
  • Duplicate or ERRONEOUS IP address assignment is AVOIDED. As a result, there are no IP address disputes.
  • It makes network administration easier.
  • It supports a variety of scopes, such as multicast and super scopes.
  • It benefits mobile users greatly because correct configuration parameters are received immediately from the new network.

The following are DHCP's drawbacks or downsides:

  • In networks with only one configured DHCP server, the DHCP server might be a single point of failure.
  • Because DHCP packets cannot cross ROUTERS, a RELAY agent is required to ensure that the DHCP server handles all leases on both network segments. Relay agents accept broadcast DHCP packets and forward them to the DHCP server as unicast packets. In this case, the relay agent must be configured with the DHCP server's IP address.
  • Security: Because the DHCP server lacks a secure means for client authentication, it can get unauthorised access to IP addresses by submitting credentials such as DHCP client identifiers.
  • When a new IP address is assigned, the machine name does not change.