Explore topic-wise InterviewSolutions in Current Affairs.

This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.

1.

Define Data Structures?

Answer»

DATA STRUCTURES is defined as the way of ORGANIZING all data items that CONSIDER not only the elements stored but ALSO stores the relationship between the elements.

Data Structures is defined as the way of organizing all data items that consider not only the elements stored but also stores the relationship between the elements.

2.

How Can I Search For Data In A Linked List?

Answer»

Unfortunately, the only WAY to search a linked LIST is with a linear search, because the only way a linked list's members can be accessed is SEQUENTIALLY. Sometimes it is quicker to take the DATA from a linked list and store it in a DIFFERENT data structure so that searches can be more efficient.

Unfortunately, the only way to search a linked list is with a linear search, because the only way a linked list's members can be accessed is sequentially. Sometimes it is quicker to take the data from a linked list and store it in a different data structure so that searches can be more efficient.

3.

How Many Different Trees Are Possible With 10 Nodes ?

Answer»

1014 - For example, consider a tree with 3 NODES(n=3), it will have the maximum combination of 5 different (IE, 23 - 3 =? 5) TREES.

1014 - For example, consider a tree with 3 nodes(n=3), it will have the maximum combination of 5 different (ie, 23 - 3 =? 5) trees.

4.

When Can You Tell That A Memory Leak Will Occur?

Answer»

A MEMORY LEAK occurs when a PROGRAM loses the ability to free a block of dynamically ALLOCATED memory.

A memory leak occurs when a program loses the ability to free a block of dynamically allocated memory.

5.

What Is A Node Class?

Answer»

A node class is a class that, relies on the BASE class for services and implementation, provides a wider interface to users than its base class, relies primarily on virtual functions in its public interface DEPENDS on all its direct and indirect base class can be understood only in the context of the base class can be used as base for further derivation can be used to CREATE objects. A node class is a class that has added new services or FUNCTIONALITY beyond the services inherited from its base class.

A node class is a class that, relies on the base class for services and implementation, provides a wider interface to users than its base class, relies primarily on virtual functions in its public interface depends on all its direct and indirect base class can be understood only in the context of the base class can be used as base for further derivation can be used to create objects. A node class is a class that has added new services or functionality beyond the services inherited from its base class.

6.

Tell How To Check Whether A Linked List Is Circular ?

Answer»

Create TWO POINTERS, each set to the START of the LIST. Update each as follows:

while (pointer1) { pointer1 = pointer1->next; pointer2 = pointer2->next; if(pointer2)pointer2=pointer2->next; if (pointer1 == pointer2) { print (”circularn”); } }

Create two pointers, each set to the start of the list. Update each as follows:

7.

What Is The Difference Between Array And Stack?

Answer»

STACK follows LIFO. Thus the item that is first ENTERED would be the last removed.

In array the items can be entered or removed in any order. Basically each member access is done using index. No strict order is to be FOLLOWED here to remove a PARTICULAR element.

Array MAY be multidiamensional or onediamensional but stack should be onediamensional. but both are linear data structure.

STACK follows LIFO. Thus the item that is first entered would be the last removed.

In array the items can be entered or removed in any order. Basically each member access is done using index. No strict order is to be followed here to remove a particular element.

Array may be multidiamensional or onediamensional but stack should be onediamensional. but both are linear data structure.

8.

What Is The Difference Between Null And Void Pointer?

Answer»

NULL can be VALUE for POINTER type variables.
VOID is a type identifier which has not SIZE.
NULL and void are not same. EXAMPLE: void* ptr = NULL;

NULL can be value for pointer type variables.
VOID is a type identifier which has not size.
NULL and void are not same. Example: void* ptr = NULL;

9.

What Is Precision?

Answer»

Precision REFERS the ACCURACY of the decimal portion of a VALUE. Precision is the NUMBER of digits allowed after the decimal point.

Precision refers the accuracy of the decimal portion of a value. Precision is the number of digits allowed after the decimal point.

10.

What Is Impact Of Signed Numbers On The Memory?

Answer»

Sign of the number is the FIRST bit of the STORAGE allocated for that number. So you GET one bit less for STORING the number. For example if you are storing an 8-bit number, without sign, the RANGE is 0-255. If you decide to store sign you get 7 bits for the number plus one bit for the sign. So the range is -128 to +127.

Sign of the number is the first bit of the storage allocated for that number. So you get one bit less for storing the number. For example if you are storing an 8-bit number, without sign, the range is 0-255. If you decide to store sign you get 7 bits for the number plus one bit for the sign. So the range is -128 to +127.

11.

How Memory Is Reserved Using A Declaration Statement ?

Answer»

Memory is reserved using data type in the variable declaration. A programming language implementation has predefined SIZES for its data types.

For EXAMPLE: 

in C# the declaration int i; will reserve 32 bits for variable i.
A POINTER declaration reserves memory for the address or the pointer variable, but not for the data that it will POINT to. The memory for the data pointed by a pointer has to be allocated at RUNTIME.
The memory reserved by the compiler for simple variables and for storing pointer address is allocated on the stack, while the memory allocated for pointer referenced data at runtime is allocated on the heap.

Memory is reserved using data type in the variable declaration. A programming language implementation has predefined sizes for its data types.

For example: 

in C# the declaration int i; will reserve 32 bits for variable i.
A pointer declaration reserves memory for the address or the pointer variable, but not for the data that it will point to. The memory for the data pointed by a pointer has to be allocated at runtime.
The memory reserved by the compiler for simple variables and for storing pointer address is allocated on the stack, while the memory allocated for pointer referenced data at runtime is allocated on the heap.

12.

How Many Parts Are There In A Declaration Statement?

Answer»

There are TWO MAIN PARTS, VARIABLE identifier and data type and the third type is optional which is type QUALIFIER like signed/unsigned.

There are two main parts, variable identifier and data type and the third type is optional which is type qualifier like signed/unsigned.

13.

Is Pointer A Variable?

Answer»

Yes, a pointer is a variable and can be used as an ELEMENT of a structure and as an ATTRIBUTE of a class in some programming LANGUAGES such as C++, but not Java. However, the contents of a pointer is a memory ADDRESS of another location of memory, which is usually the memory address of another variable, element of a structure, or attribute of a class.

Yes, a pointer is a variable and can be used as an element of a structure and as an attribute of a class in some programming languages such as C++, but not Java. However, the contents of a pointer is a memory address of another location of memory, which is usually the memory address of another variable, element of a structure, or attribute of a class.

14.

What Is Significance Of " * " ?

Answer»

The symbol “*” tells the COMPUTER that you are declaring a pointer. Actually it DEPENDS on CONTEXT.

In a statement like int *ptr; the ‘*’ tells that you are declaring a pointer.
In a statement like int i = *ptr; it tells that you want to assign value POINTED to by ptr to variable i.
The symbol “*” is also called as Indirection OPERATOR/ Dereferencing Operator.

The symbol “*” tells the computer that you are declaring a pointer. Actually it depends on context.

In a statement like int *ptr; the ‘*’ tells that you are declaring a pointer.
In a statement like int i = *ptr; it tells that you want to assign value pointed to by ptr to variable i.
The symbol “*” is also called as Indirection Operator/ Dereferencing Operator.

15.

Why Do We Use A Multidimensional Array?

Answer»

A multidimensional array can be useful to organize subgroups of data within an array. In addition to ORGANIZING data stored in elements of an array, a multidimensional array can store memory addresses of data in a pointer array and an array of pointers.

Multidimensional arrays are used to store INFORMATION in a matrix form.

e.g; a railway timetable, schedule cannot be stored as a single dimensional array. One can use a 3-D array for STORING height, width and length of each ROOM on each floor of a building.

A multidimensional array can be useful to organize subgroups of data within an array. In addition to organizing data stored in elements of an array, a multidimensional array can store memory addresses of data in a pointer array and an array of pointers.

Multidimensional arrays are used to store information in a matrix form.

e.g; a railway timetable, schedule cannot be stored as a single dimensional array. One can use a 3-D array for storing height, width and length of each room on each floor of a building.

16.

How Do You Assign An Address To An Element Of A Pointer Array ?

Answer»

We can assign a memory address to an element of a POINTER array by using the address operator, which is the AMPERSAND (&), in an assignment STATEMENT such as ptemployee[0] = &projects[2];

We can assign a memory address to an element of a pointer array by using the address operator, which is the ampersand (&), in an assignment statement such as ptemployee[0] = &projects[2];

17.

Run Time Memory Allocation Is Known As ?

Answer»

Allocating MEMORY at runtime is called a DYNAMICALLY allocating memory. In this, you dynamically allocate memory by using the NEW operator when declaring the ARRAY.

for example : int grades[] = new int[10];

Allocating memory at runtime is called a dynamically allocating memory. In this, you dynamically allocate memory by using the new operator when declaring the array.

for example : int grades[] = new int[10];

18.

What Method Is Used To Place A Value Onto The Top Of A Stack?

Answer»

push() method, Push is the direction that DATA is being added to the stack. push() member method PLACES a VALUE ONTO the top of a stack.

push() method, Push is the direction that data is being added to the stack. push() member method places a value onto the top of a stack.

19.

What Method Removes The Value From The Top Of A Stack?

Answer»

The pop() MEMBER METHOD removes the value from the TOP of a STACK, which is then returned by the pop() member method to the statement that CALLS the pop() member method.

The pop() member method removes the value from the top of a stack, which is then returned by the pop() member method to the statement that calls the pop() member method.

20.

What Does Isempty() Member Method Determines?

Answer»

isEmpty() checks if the stack has at LEAST one element. This METHOD is called by POP() before retrieving and RETURNING the TOP element.

isEmpty() checks if the stack has at least one element. This method is called by Pop() before retrieving and returning the top element.

21.

What Is A Queue ?

Answer»

A QUEUE is a sequential ORGANIZATION of data. A queue is a FIRST in first out type of data structure. An element is inserted at the last position and an element is always TAKEN out from the first position.

A Queue is a sequential organization of data. A queue is a first in first out type of data structure. An element is inserted at the last position and an element is always taken out from the first position.

22.

What Is The Relationship Between A Queue And Its Underlying Array?

Answer»

Data stored in a queue is ACTUALLY stored in an array. Two indexes, front and end will be USED to identify the start and end of the queue.

When an element is removed front will be incremented by 1. In CASE it reaches past the LAST index available it will be reset to 0. Then it will be checked with end. If it is GREATER than end queue is empty.

When an element is added end will be incremented by 1. In case it reaches past the last index available it will be reset to 0. After incrementing it will be checked with front. If they are equal queue is full.

Data stored in a queue is actually stored in an array. Two indexes, front and end will be used to identify the start and end of the queue.

When an element is removed front will be incremented by 1. In case it reaches past the last index available it will be reset to 0. Then it will be checked with end. If it is greater than end queue is empty.

When an element is added end will be incremented by 1. In case it reaches past the last index available it will be reset to 0. After incrementing it will be checked with front. If they are equal queue is full.

23.

Which Process Places Data At The Back Of The Queue?

Answer»

ENQUEUE is the PROCESS that PLACES data at the BACK of the queue.

Enqueue is the process that places data at the back of the queue.

24.

Why Is The Isempty() Member Method Called?

Answer»

The ISEMPTY() member method is called WITHIN the DEQUEUE PROCESS to determine if there is an item in the queue to be removed i.e. isEmpty() is called to decide WHETHER the queue has at least one element. This method is called by the dequeue() method before returning the front element.

The isEmpty() member method is called within the dequeue process to determine if there is an item in the queue to be removed i.e. isEmpty() is called to decide whether the queue has at least one element. This method is called by the dequeue() method before returning the front element.

25.

How Is The Front Of The Queue Calculated ?

Answer»

The FRONT of the QUEUE is CALCULATED by front = (front+1) % SIZE.

The front of the queue is calculated by front = (front+1) % size.

26.

What Does Each Entry In The Link List Called?

Answer»

Each ENTRY in a linked list is called a node. THINK of a node as an entry that has three SUB entries. One sub entry CONTAINS the data, which may be one ATTRIBUTE or many attributes. Another points to the previous node, and the last points to the next node. When you enter a new item on a linked list, you allocate the new node and then set the pointers to previous and next nodes.

Each entry in a linked list is called a node. Think of a node as an entry that has three sub entries. One sub entry contains the data, which may be one attribute or many attributes. Another points to the previous node, and the last points to the next node. When you enter a new item on a linked list, you allocate the new node and then set the pointers to previous and next nodes.

27.

What Is Linked List ?

Answer»

Linked List is one of the fundamental data structures. It CONSISTS of a sequence of ? nodes, each CONTAINING arbitrary data fields and one or two (”links”) pointing to the next and/or previous nodes. A linked list is a self-referential DATATYPE because it contains a POINTER or link to ANOTHER data of the same type. Linked lists permit insertion and removal of nodes at any point in the list in constant time, but do not allow random access.

Linked List is one of the fundamental data structures. It consists of a sequence of ? nodes, each containing arbitrary data fields and one or two (”links”) pointing to the next and/or previous nodes. A linked list is a self-referential datatype because it contains a pointer or link to another data of the same type. Linked lists permit insertion and removal of nodes at any point in the list in constant time, but do not allow random access.

28.

What Member Function Places A New Node At The End Of The Linked List?

Answer»

The appendNode() member function places a new node at the end of the LINKED LIST. The appendNode() REQUIRES an integer representing the current DATA of the node.

The appendNode() member function places a new node at the end of the linked list. The appendNode() requires an integer representing the current data of the node.

29.

How Is Any Data Structure Application Is Classified Among Files?

Answer»

A linked list APPLICATION can be organized into a header FILE, SOURCE file and main application file. The first file is the header file that contains the definition of the NODE structure and the LinkedList class definition. The second file is a source code file containing the implementation of member functions of the LinkedList class. The last file is the application file that contains code that creates and USES the LinkedList class.

A linked list application can be organized into a header file, source file and main application file. The first file is the header file that contains the definition of the NODE structure and the LinkedList class definition. The second file is a source code file containing the implementation of member functions of the LinkedList class. The last file is the application file that contains code that creates and uses the LinkedList class.

30.

Which File Contains The Definition Of Member Functions?

Answer»

Definitions of member FUNCTIONS for the LINKED List CLASS are CONTAINED in the LinkedList.cpp FILE.

Definitions of member functions for the Linked List class are contained in the LinkedList.cpp file.

31.

What Are The Major Data Structures Used In The Following Areas : Rdbms, Network Data Model & Hierarchical Data Model?

Answer»
  1. RDBMS Array (i.e. Array of STRUCTURES)
  2. NETWORK data model Graph
  3. Hierarchical data model TREES.

32.

Difference Between Calloc And Malloc ?

Answer»

malloc: ALLOCATE n bytes.
CALLOC: allocate m times n bytes INITIALIZED to 0.

malloc: allocate n bytes.
calloc: allocate m times n bytes initialized to 0.

33.

Does The Minimal Spanning Tree Of A Graph Give The Shortest Distance Between Any 2 Specified Nodes?

Answer»

No! Minimal spanning tree assures that the TOTAL weight of the tree is KEPT at its minimum. But it doesn’t MEAN that the distance between any TWO nodes involved in the minimal-spanning tree is minimum.

No! Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it doesn’t mean that the distance between any two nodes involved in the minimal-spanning tree is minimum.

34.

There Are 8, 15, 13, 14 Nodes Were There In 4 Different Trees. Which Of Them Could Have Formed A Full Binary Tree?

Answer»

 In general: There are 2n-1 nodes in a full BINARY tree. By the method of ELIMINATION:

Full binary TREES contain odd number of nodes. So there cannot be full binary trees with 8 or 14 nodes, so rejected. With 13 nodes you can FORM a complete binary tree but not a full binary tree. So the correct answer is 15.

 In general: There are 2n-1 nodes in a full binary tree. By the method of elimination:

Full binary trees contain odd number of nodes. So there cannot be full binary trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete binary tree but not a full binary tree. So the correct answer is 15.

35.

In An Avl Tree, At What Condition The Balancing Is To Be Done?

Answer»

If the ‘pivotal VALUE’ (or the ‘Height FACTOR’) is GREATER than 1 or LESS than –1.

If the ‘pivotal value’ (or the ‘Height factor’) is greater than 1 or less than –1.

36.

Convert The Expression ((a + B) * C - (d - E) ^ (f + G)) To Equivalent Prefix And Postfix Notations?

Answer»

PREFIX Notation:

^ – * +ABC – DE + FG

POSTFIX Notation:

AB + C * DE – – FG + ^

Prefix Notation:

^ – * +ABC – DE + FG

postfix Notation:

AB + C * DE – – FG + ^

37.

What Are The Notations Used In Evaluation Of Arithmetic Expressions Using Prefix And Postfix Forms?

Answer»

POLISH and REVERSE Polish NOTATIONS.

Polish and Reverse Polish notations.

38.

What Is The Data Structures Used To Perform Recursion?

Answer»

STACK. Because of its LIFO (Last In First Out) property it REMEMBERS its ‘caller’ so knows whom to return when the function has to return. Recursion makes use of system stack for STORING the return addresses of the function calls.

Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.

Stack. Because of its LIFO (Last In First Out) property it remembers its ‘caller’ so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls.

Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.

39.

If You Are Using C Language To Implement The Heterogeneous Linked List, What Pointer Type Will You Use?

Answer»

The heterogeneous linked LIST contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to USE ordinary pointers for this. So we go for void pointer. Void pointer is CAPABLE of STORING pointer to any type as it is a generic pointer type.

The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.

40.

What Are The Major Data Structures Used In The Following Areas : Network Data Model & Hierarchical Data Model?

Answer»

RDBMS – ARRAY (i.e. Array of STRUCTURES)
Network data MODEL – Graph
HIERARCHICAL data model – TREES

RDBMS – Array (i.e. Array of structures)
Network data model – Graph
Hierarchical data model – Trees

41.

Parenthesis Is Never Required In Postfix Or Prefix Expressions, Why?

Answer»

Parenthesis is not required because the order of the OPERATORS in the POSTFIX /prefix expressions determines the actual order of OPERATIONS in EVALUATING the expression.

Parenthesis is not required because the order of the operators in the postfix /prefix expressions determines the actual order of operations in evaluating the expression.

42.

Is Any Implicit Arguments Are Passed To A Function When It Is Called?

Answer»

YES there is a SET of implicit arguments that contain information necessary for the function to execute and return correctly. One of them is return address which is stored within the function’s data AREA, at the time of returning to calling PROGRAM the address is retrieved and the function branches to that location.

Yes there is a set of implicit arguments that contain information necessary for the function to execute and return correctly. One of them is return address which is stored within the function’s data area, at the time of returning to calling program the address is retrieved and the function branches to that location.

43.

Calculate The Efficiency Of Sequential Search?

Answer»

The number of comparisons DEPENDS on where the record with the argument key appears in the table.

If it appears at first position then one comparison If it appears at last position then n comparisons Average=(n+1)/2 comparisons UNSUCCESSFUL SEARCH n comparisons Number of comparisons in any CASE is O (n).

The number of comparisons depends on where the record with the argument key appears in the table.

44.

What Are The Issues That Hamper The Efficiency In Sorting A File?

Answer»

The issues are:

  1. Length of TIME REQUIRED by the PROGRAMMER in coding a particular sorting program.
  2. Amount of machine time NECESSARY for running the particular program.
  3. The amount of space necessary for the particular program .

The issues are:

45.

Is It Necessary To Sort A File Before Searching A Particular Item ?

Answer»

If less work is involved in searching a element than to SORT and then extract, then we don’t go for sort.

If frequent use of the file is required for the purpose of retrieving SPECIFIC element, it is more efficient to sort the file.

Thus it DEPENDS on SITUATION.

If less work is involved in searching a element than to sort and then extract, then we don’t go for sort.

If frequent use of the file is required for the purpose of retrieving specific element, it is more efficient to sort the file.

Thus it depends on situation.

46.

Define Double Linked List?

Answer»

It is a collection of DATA elements called nodes,

where each NODE is divided into three PARTS:

  1. An INFO field that contains the information stored in the node.
  2. Left field that CONTAIN pointer to node on left side.
  3. Right field that contain pointer to node on right side.

It is a collection of data elements called nodes,

where each node is divided into three parts:

47.

What Are The Disadvantages Of Circular List?

Answer»

i) We can’t traverse the LIST backward.
II) If a POINTER to a node is given we cannot delete the node.

i) We can’t traverse the list backward.
ii) If a pointer to a node is given we cannot delete the node.

48.

Define Circular List?

Answer»

In linear list the next field of the last node contain a null POINTER, when a next field in the last node contain a pointer back to the FIRST node it is called CIRCULAR list.

ADVANTAGES – From any point in the list it is possible to reach at any other point.

In linear list the next field of the last node contain a null pointer, when a next field in the last node contain a pointer back to the first node it is called circular list.

Advantages – From any point in the list it is possible to reach at any other point.

49.

What Are The Disadvantages Of Linear List?

Answer»

i) We cannot reach any of the nodes that precede node (p).
ii) If a LIST is traversed, the EXTERNAL pointer to the list must be PERSEVERED in ORDER to reference the list again.

i) We cannot reach any of the nodes that precede node (p).
ii) If a list is traversed, the external pointer to the list must be persevered in order to reference the list again.

50.

What Is Dangling Pointer And How To Avoid It?

Answer»

After a call to free(p) MAKES a subsequent REFERENCE to *p ILLEGAL, i.e. THOUGH the storage to p is freed but the value of p(address) remain unchanged .so the object at that address may be used as the value of *p (i.e. there is no way to detect the illegality).Here p is called dangling pointer.

To avoid this it is better to set p to NULL after executing free(p).The null pointer value doesn’t reference a storage location it is a pointer that doesn’t point to anything.

After a call to free(p) makes a subsequent reference to *p illegal, i.e. though the storage to p is freed but the value of p(address) remain unchanged .so the object at that address may be used as the value of *p (i.e. there is no way to detect the illegality).Here p is called dangling pointer.

To avoid this it is better to set p to NULL after executing free(p).The null pointer value doesn’t reference a storage location it is a pointer that doesn’t point to anything.