Data Structures Algorithms Online Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Nilanjanad
N
Nilanjanad
Community Contributor
Quizzes Created: 1 | Total Attempts: 1,770
| Attempts: 1,770 | Questions: 41
Please wait...
Question 1 / 41
0 %
0/100
Score 0/100
1. The term push and pop is related to

Explanation

The terms "push" and "pop" are commonly used in the context of stacks. In a stack data structure, elements are added or removed from the top of the stack. "Push" refers to adding an element to the top of the stack, while "pop" refers to removing the top element from the stack. Therefore, the correct answer is Stacks.

Submit
Please wait...
About This Quiz
Data Structures Algorithms Online Quiz - Quiz

This online quiz assesses key concepts in data structures and algorithms, focusing on linked lists, sorting complexities, and data structure operations. Ideal for students and professionals looking to deepen their understanding of dynamic data handling and efficiency in computational tasks.

Personalize your quiz and earn a certificate with your name on it!
2. ...... is the term used to insert an element into stack.

Explanation

Push is the term used to insert an element into a stack. When an element is pushed onto a stack, it is added to the top of the stack, becoming the new top element. This operation increases the size of the stack by one. The push operation is essential for adding new elements to a stack and maintaining the order in which elements are accessed and removed.

Submit
3. The insertion operation in the stack is called .........

Explanation

The insertion operation in the stack is called "push". This operation adds an element to the top of the stack, increasing its size by one. The push operation is used to store new data in the stack, allowing for efficient and organized data storage and retrieval.

Submit
4. Stack follows the strategy of ........

Explanation

The stack follows the strategy of LIFO, which stands for "Last In, First Out". This means that the last item added to the stack is the first one to be removed. It operates like a stack of plates, where the last plate added is the first one to be taken off when needed. This strategy is commonly used in programming and data structures, where the most recently added item is often the most relevant or needs to be accessed first.

Submit
5. .......... is the term used to delete an element from the stack.

Explanation

The term "Pop" is used to delete an element from the stack.

Submit
6. A pointer variable which contains the location at the top element of the stack is called .....

Explanation

A pointer variable which contains the location at the top element of the stack is called "Top".

Submit
7. A queue is a .........

Explanation

A queue is a data structure where elements are added to the back and removed from the front, following the First-In-First-Out (FIFO) principle. This means that the element that has been in the queue the longest is the first one to be removed. In other words, the elements are processed in the same order they were added. This behavior is similar to a queue of people waiting in line, where the person who arrived first is the first one to be served.

Submit
8. A queue is a ?

Explanation

A queue is a FIFO (First In First Out) list because it follows the principle that the first element added to the queue will be the first one to be removed. In other words, the elements are processed in the order they were added, resembling a line of people waiting for a service. This behavior is commonly used in computer science and data structures, where queues are used to manage tasks or requests in a sequential manner.

Submit
9. In linked list each node contain minimum of two fields. One field is data field to store the data second field is?

Explanation

In a linked list, each node contains a minimum of two fields. The first field is the data field, which is used to store the actual data. The second field is a pointer to another node, which is used to link the nodes together and create the linked structure. This pointer points to the next node in the list, allowing traversal from one node to another. Therefore, the correct answer is "Pointer to node".

Submit
10. A linear collection of data elements where the linear node is given by means of pointer is called?

Explanation

A linear collection of data elements where each element is connected to the next element through pointers is called a linked list. In a linked list, each element, known as a node, contains the data and a pointer to the next node in the sequence. This allows for efficient insertion and deletion of elements at any position in the list.

Submit
11. A variant of linked list in which last node of the list points to the first node of the list is?

Explanation

A circular linked list is a variant of a linked list in which the last node of the list points to the first node of the list. This creates a circular structure, allowing for easy traversal from any node to any other node in the list. This type of linked list is often used in applications where continuous looping or circular operations are required, such as in a round-robin scheduling algorithm or in implementing a circular buffer.

Submit
12. Which is the pointer associated with the stack?

Explanation

The pointer associated with the stack is the "TOP" pointer. This pointer keeps track of the topmost element in the stack, allowing for easy insertion and removal of elements from the top.

Submit
13. ......... form of access is used to add and remove nodes from a queue.

Explanation

The correct answer is FIFO, First In First Out. This form of access is used to add and remove nodes from a queue, where the first node that is added will be the first one to be removed. This is similar to a queue in real life, where the first person who enters the line will be the first one to leave.

Submit
14. A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as a ?

Explanation

A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as a queue. In a queue, the first element to be inserted is the first one to be deleted (First-In-First-Out or FIFO). This data structure is commonly used in scenarios where elements need to be processed in the same order they were added, such as in scheduling tasks or managing requests.

Submit
15. ........ form of access is used to add remove nodes from a stack.

Explanation

LIFO (Last In, First Out) is the correct answer because it accurately describes the form of access used to add and remove nodes from a stack. In a stack, the last element that is added is the first one to be removed. This follows the LIFO principle, where the most recently added item is the first one to be accessed or removed. Therefore, LIFO is the appropriate form of access for a stack.

Submit
16. In linked list implementation of a queue, where does a new element be inserted?

Explanation

In a linked list implementation of a queue, a new element is inserted at the tail of the linked list. This is because a queue follows the FIFO (First-In-First-Out) principle, where the element that has been in the queue the longest is the first one to be removed. By inserting the new element at the tail, it ensures that it will be the last element in the queue, and will be removed after all the previously inserted elements.

Submit
17. The elements are removal from a stack in .......... order.

Explanation

The elements are removed from a stack in reverse order, meaning that the last element added to the stack is the first one to be removed. This follows the principle of Last-In-First-Out (LIFO), where the most recently added element is the first one to be taken out.

Submit
18. Which of the following name does not relate to stacks?

Explanation

FIFO (First-In-First-Out) lists do not relate to stacks because they follow a different data structure called queues. Stacks, on the other hand, follow the LIFO (Last-In-First-Out) principle, where the last element added is the first one to be removed. LIFO lists, piles, and push down lists all relate to stacks as they follow the same LIFO principle.

Submit
19. . If the MAX_SIZE is the size of the array used in the implementation of circular queue. How is rear manipulated while inserting an element in the queue?

Explanation

The correct answer is rear=(rear+1)%MAX_SIZE. This formula is used to manipulate the rear pointer while inserting an element in a circular queue. By adding 1 to the current value of the rear pointer and then taking the modulo operation with MAX_SIZE, it ensures that the rear pointer wraps around to the beginning of the array if it reaches the end. This allows for the circular behavior of the queue, where new elements can be inserted even if there are empty spaces at the front of the array.

Submit
20. Linked lists are best suited

Explanation

Linked lists are best suited for situations where the size of the structure and the data in the structure are constantly changing. This is because linked lists allow for efficient insertion and deletion of elements at any position in the list, without the need to shift or resize the entire structure. The dynamic nature of linked lists makes them ideal for scenarios where the collection of data is frequently modified.

Submit
21. New nodes are added to the ......... of the queue

Explanation

New nodes are added to the back of the queue. This means that when a new element is inserted into the queue, it is placed at the end or the back of the queue. The front of the queue remains unchanged, and elements are removed from the front of the queue.

Submit
22. In the linked representation of the stack ......... behaves as the top pointer variable of stack.

Explanation

In the linked representation of the stack, the "Start pointer" behaves as the top pointer variable of the stack. The "Start pointer" is responsible for keeping track of the topmost element in the stack, indicating the position where the next element will be inserted or removed. It points to the first node or element in the stack, making it the equivalent of the top pointer in a stack data structure.

Submit
23. The complexity of merge sort algorithm is

Explanation

Merge sort is a divide and conquer algorithm that works by repeatedly dividing the unsorted list into smaller sublists until each sublist contains only one element. Then, it merges the sublists back together in a sorted manner. The time complexity of merge sort is O(n log n) because the list is divided into halves logarithmically, and each division requires linear time to merge the sublists. Therefore, the overall time complexity is proportional to the number of elements in the list multiplied by the logarithm of the number of elements, resulting in O(n log n).

Submit
24. Deletion operation is done using ......... in a queue.

Explanation

In a queue, the deletion operation is done using the "front" of the queue. The front of the queue refers to the element that has been in the queue for the longest time and is the next element to be removed. When an element is deleted from a queue, the front is updated to point to the next element in the queue.

Submit
25. Which of the following data structure is not linear data structure?

Explanation

The correct answer is "None of above". This means that both arrays and linked lists are linear data structures. Arrays store elements in contiguous memory locations, allowing for constant-time access to any element. Linked lists, on the other hand, consist of nodes that are connected through pointers, allowing for efficient insertion and deletion operations. Therefore, both arrays and linked lists are examples of linear data structures.

Submit
26. The retrieval of items in a stack is ........... operation.

Explanation

The retrieval of items in a stack is performed by the pop operation. When an item is popped from a stack, it is removed from the top of the stack and returned as the result of the operation. This allows for the retrieval of the most recently added item in the stack, following the Last In First Out (LIFO) principle.

Submit
27. Which of the following is an application of stack?

Explanation

All of the given options are applications of a stack. Finding factorial can be implemented using a stack to store intermediate results. The Tower of Hanoi problem can be solved using recursion and a stack data structure. Infix to postfix conversion also involves the use of a stack to rearrange the operators and operands. Therefore, all of the options mentioned are valid applications of a stack.

Submit
28. In a circular linked list

Explanation

In a circular linked list, there is no beginning and no end. Unlike a regular linked list where the last element points to null, in a circular linked list the last element points back to the first element, creating a loop. This allows for continuous traversal of the list in both forward and backward directions. As a result, any component in the list can be accessed from any other component, making it a convenient data structure for certain applications.

Submit
29. Consider the following definition in c programming language struct node { int data; struct node * next; } typedef struct node NODE; NODE *ptr; Which of the following c code is used to create new node?

Explanation

The correct answer is "ptr=(NODE*)malloc(sizeof(NODE));". This code is used to dynamically allocate memory for a new node of type NODE. The sizeof(NODE) returns the size of the NODE structure, and malloc is used to allocate memory of that size. The (NODE*) typecast is used to convert the void pointer returned by malloc to a pointer of type NODE, which is then assigned to the ptr variable.

Submit
30. What kind of linked list is best to answer question like “What is the item at position n?”

Explanation

An array implementation of a linked list is the best kind of linked list to answer the question "What is the item at position n?" This is because an array allows for constant time access to any element by its index. In an array implementation of a linked list, each element in the array represents a node in the linked list, and the index of the array corresponds to the position of the node. Therefore, it is efficient to directly access the item at position n by simply accessing the element at index n in the array.

Submit
31. In linked representation of stack the null pointer of the last node in the list signals ..........

Explanation

In linked representation of a stack, the null pointer of the last node in the list signals the bottom of the stack. This means that when the null pointer is encountered, it indicates that there are no more elements below it in the stack. Therefore, the correct answer is "Bottom of the stack".

Submit
32. In Breadth First Search of Graph, which of the following data structure is used?

Explanation

In Breadth First Search of a graph, a queue is used as the data structure. This is because BFS explores all the vertices of a graph in breadth-first manner, meaning it visits all the vertices at the same level before moving to the next level. A queue is ideal for this purpose as it follows the First-In-First-Out (FIFO) principle, allowing vertices to be added to the end of the queue and removed from the front, ensuring that the vertices are visited in the order they were added.

Submit
33. If the MAX_SIZE is the size of the array used in the implementation of circular queue, array index start with 0, front point to the first element in the queue, and rear point to the last element in the queue. Which of the following condition specify that circular queue is FULL?

Explanation

The condition "Front=(rear+1)%MAX_SIZE" specifies that the circular queue is full. This condition checks if the front pointer is equal to the index obtained by adding 1 to the rear pointer and then taking the modulus of the maximum size of the array. If this condition is true, it means that the next position after the rear pointer is the same as the front pointer, indicating that the circular queue is full.

Submit
34. What happens when you push a new node onto a stack?

Explanation

When a new node is pushed onto a stack, it is placed at the front of the linked list. This is because a stack follows the Last-In-First-Out (LIFO) principle, meaning that the most recently added element is the first one to be removed. By placing the new node at the front of the linked list, it ensures that it will be the first node to be accessed and removed when necessary.

Submit
35. Let the following circular queue can accommodate maximum six elements with the following data front = 2 rear = 4 queue = _______; L, M, N, ___, ___ What will happen after ADD O operation takes place?

Explanation

After the ADD O operation takes place, the front remains at 2 and the rear is incremented to 5. The element "O" is added to the queue, resulting in the queue becoming "L, M, N, O, ___".

Submit
36. In liked representation of stack ....... holds the elements of the stack.

Explanation

In linked representation of a stack, the INFO fields hold the elements of the stack. This means that each node in the linked list representation of the stack contains an INFO field which stores the actual data element. The INFO fields are used to store the values that are pushed onto the stack and popped off the stack when needed.

Submit
37. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?

Explanation

The elements "A", "B", "C", and "D" will be removed in the order of ABCD. This is because a queue follows the First-In-First-Out (FIFO) principle, meaning that the element that was added first will be removed first. In this case, "A" is the first element to be added, so it will be the first one to be removed, followed by "B", "C", and "D" in that order.

Submit
38. In linked list implementation of queue, if only front pointer is maintained, which of the following operation take worst case linear time?

Explanation

In a linked list implementation of a queue, if only the front pointer is maintained, both insertion and emptying the queue take worst case linear time.
For insertion, since only the front pointer is maintained, we would need to traverse the entire linked list to reach the end and insert the new element, resulting in a linear time complexity.
Similarly, to empty the queue, we would need to traverse the entire linked list and remove each element one by one, resulting in a linear time complexity as well.

Submit
39. Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?

Explanation

A doubly linked list is more efficient than a singly linked list when it comes to deleting a node whose location is given. This is because a doubly linked list allows for easier navigation in both directions, forward and backward, as each node contains references to both the next and the previous nodes. Therefore, when the location of a node is given, deleting it in a doubly linked list can be done in constant time, O(1), by simply updating the references of the previous and next nodes. In a singly linked list, on the other hand, deleting a node with a given location requires traversing the list to find the node before the given location, resulting in a time complexity of O(n), where n is the number of nodes in the list.

Submit
40. In the array implementation of circular queue, which of the following operation take worst case linear time?

Explanation

In the array implementation of a circular queue, all operations, including insertion, deletion, and emptying the queue, can be performed in constant time, regardless of the number of elements in the queue. This is because a circular queue uses a fixed-size array and keeps track of the front and rear elements using pointers that wrap around the array. Therefore, none of the operations take worst case linear time.

Submit
41. The data structure required for Breadth First Traversal on a graph is?

Explanation

The correct answer is Queue. Breadth First Traversal visits all the vertices of a graph in breadth-first order, i.e., it visits all the vertices at the same level before moving to the next level. In order to achieve this, a queue data structure is used. The vertices are inserted into the queue and then visited one by one in the order they were inserted, ensuring that the vertices at the same level are visited before moving to the next level. An array is not suitable for this traversal as it does not provide the required functionality of adding and removing elements in a specific order.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 22, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 12, 2015
    Quiz Created by
    Nilanjanad
Cancel
  • All
    All (41)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
The term push and pop is related to
...... is the term used to insert an element into stack.
The insertion operation in the stack is called .........
Stack follows the strategy of ........
.......... is the term used to delete an element from the stack.
A pointer variable which contains the location at the top element of...
A queue is a .........
A queue is a ?
In linked list each node contain minimum of two fields. One field is...
A linear collection of data elements where the linear node is given by...
A variant of linked list in which last node of the list points to the...
Which is the pointer associated with the stack?
......... form of access is used to add and remove nodes from a queue.
A linear list of elements in which deletion can be done from one end...
........ form of access is used to add remove nodes from a stack.
In linked list implementation of a queue, where does a new element be...
The elements are removal from a stack in .......... order.
Which of the following name does not relate to stacks?
. If the MAX_SIZE is the size of the array used in the implementation...
Linked lists are best suited
New nodes are added to the ......... of the queue
In the linked representation of the stack ......... behaves as the top...
The complexity of merge sort algorithm is
Deletion operation is done using ......... in a queue.
Which of the following data structure is not linear data structure?
The retrieval of items in a stack is ........... operation.
Which of the following is an application of stack?
In a circular linked list
Consider the following definition in c programming language struct...
What kind of linked list is best to answer question like “What is...
In linked representation of stack the null pointer of the last node in...
In Breadth First Search of Graph, which of the following data...
If the MAX_SIZE is the size of the array used in the implementation of...
What happens when you push a new node onto a stack?
Let the following circular queue can accommodate maximum six elements...
In liked representation of stack ....... holds the elements of the...
If the elements “A”, “B”, “C” and “D” are placed in a...
In linked list implementation of queue, if only front pointer is...
Which of the following operations is performed more efficiently by...
In the array implementation of circular queue, which of the following...
The data structure required for Breadth First Traversal on a graph is?
Alert!

Advertisement