15it32c - Data Structures And Algorithms - Multiple Choice Test

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Rmkumar
R
Rmkumar
Community Contributor
Quizzes Created: 2 | Total Attempts: 1,663
Questions: 26 | Attempts: 1,435

SettingsSettingsSettings
15it32c - Data Structures And Algorithms - Multiple Choice Test - Quiz

.


Questions and Answers
  • 1. 

    Which of the following data structure is not linear data structure?

    • A.

      Arrays

    • B.

      Linked lists

    • C.

      Both of above

    • D.

      None of above

    Correct Answer
    D. None of above
    Explanation
    The correct answer is "None of above". This means that both arrays and linked lists are linear data structures. Arrays are a contiguous block of memory where elements are stored in a linear manner. Linked lists are a collection of nodes where each node contains a reference to the next node, creating a linear sequence. Therefore, both arrays and linked lists are examples of linear data structures.

    Rate this question:

  • 2. 

    Which of the following data structure is not linear data structure?

    • A.

      Arrays

    • B.

      Linked lists

    • C.

      Both of above

    • D.

      None of above

    Correct Answer
    D. None of above
    Explanation
    The correct answer is "None of above". This is because both arrays and linked lists are examples of linear data structures. Arrays store elements in contiguous memory locations, allowing for constant-time access to elements. Linked lists, on the other hand, consist of nodes where each node contains a reference to the next node, forming a linear sequence. Therefore, both arrays and linked lists are linear data structures, and the correct answer is that none of the options provided is a non-linear data structure.

    Rate this question:

  • 3. 

    Which of the following data structure is linear data structure?

    • A.

      Trees

    • B.

      Graphs

    • C.

      Arrays

    • D.

      None of above

    Correct Answer
    C. Arrays
    Explanation
    Arrays are a linear data structure because they store elements in a contiguous block of memory, where each element can be accessed directly using its index. The elements in an array are stored in a linear manner, one after the other, making it easy to traverse or access elements sequentially. Unlike trees and graphs, which have a hierarchical or non-linear structure, arrays provide a simple and efficient way to store and access data in a linear fashion. Therefore, arrays are the correct answer for this question.

    Rate this question:

  • 4. 

    The operation of processing each element in the list is known as

    • A.

      Sorting

    • B.

      Merging

    • C.

      Inserting

    • D.

      Traversal

    Correct Answer
    D. Traversal
    Explanation
    Traversal refers to the process of accessing each element in a list or data structure. It involves visiting every element one by one, usually in a linear manner, to perform a specific operation or gather information. In this context, the operation of processing each element in the list aligns with the concept of traversal. Sorting, merging, and inserting are different operations that may be performed on a list, but they do not specifically involve processing each element in the list like traversal does.

    Rate this question:

  • 5. 

    Finding the location of the element with a given value is:

    • A.

      Traversal

    • B.

      Search

    • C.

      Sort

    • D.

      None of above

    Correct Answer
    B. Search
    Explanation
    The correct answer is "Search" because finding the location of an element with a given value involves searching for that value within a data structure or collection. Traversal refers to the process of accessing each element in a data structure, while sorting involves arranging elements in a specific order. "None of the above" is not applicable in this context as searching is the appropriate term for this action.

    Rate this question:

  • 6. 

    Linked lists are best suited

    • A.

      For relatively permanent collections of data

    • B.

      For the size of the structure and the data in the structure are constantly changing

    • C.

      For both of above situation

    • D.

      For none of above situation

    Correct Answer
    B. For the size of the structure and the data in the structure are constantly changing
    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 size of the data collection is not fixed and can vary over time.

    Rate this question:

  • 7. 

    Arrays are best data structures:

    • A.

      For relatively permanent collections of data

    • B.

      For the size of the structure and the data in the structure are constantly changing

    • C.

      For both of above situation

    • D.

      For none of above situation

    Correct Answer
    A. For relatively permanent collections of data
    Explanation
    Arrays are best data structures for relatively permanent collections of data because arrays provide a fixed-size and contiguous block of memory to store elements. This makes it efficient for accessing elements using their index. Arrays are suitable for situations where the size of the structure and the data in the structure are not constantly changing, as adding or removing elements from an array requires resizing and copying the entire array. Therefore, arrays are not ideal for situations where the structure or data frequently change.

    Rate this question:

  • 8. 

    Each array declaration need not give, implicitly or explicitly, the information about

    • A.

      The name of array

    • B.

      The data type of array

    • C.

      The first data from the set to be stored

    • D.

      The index set of the array

    Correct Answer
    C. The first data from the set to be stored
    Explanation
    When declaring an array, it is not necessary to provide information about the first data from the set to be stored. The declaration only needs to include the name of the array and the data type of the elements in the array. The first data from the set to be stored can be assigned later when the array is initialized or populated with values.

    Rate this question:

  • 9. 

    The elements of an array are stored successively in memory cells because

    • A.

      By this way computer can keep track only the address of the first element and the addresses of other elements can be calculated

    • B.

      The architecture of computer memory does not allow arrays to store other than serially

    • C.

      Both of above

    • D.

      None of the above

    Correct Answer
    A. By this way computer can keep track only the address of the first element and the addresses of other elements can be calculated
    Explanation
    The elements of an array are stored successively in memory cells because by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated. This allows for efficient access to array elements by using the base address and an offset calculation to access any element in the array. Storing elements sequentially in memory also allows for better cache utilization and faster memory access.

    Rate this question:

  • 10. 

    The memory address of the first element of an array is called

    • A.

      Floor address

    • B.

      Foundation address

    • C.

      First address

    • D.

      Base address

    Correct Answer
    D. Base address
    Explanation
    The memory address of the first element of an array is called the base address. This is because the base address represents the starting point or foundation of the array in memory. It is the reference point from which the array elements are accessed and can be used to calculate the memory address of any other element in the array.

    Rate this question:

  • 11. 

    A variable P is called pointer if

    • A.

      P contains the address of an element in DATA.

    • B.

      P points to the address of first element in DATA

    • C.

      P can store only memory addresses

    • D.

      P contain the DATA and the address of DATA

    Correct Answer
    A. P contains the address of an element in DATA.
    Explanation
    The correct answer is that a variable P is called a pointer if it contains the address of an element in DATA. This means that P is able to store the memory address of a specific element within the DATA. By storing this address, the pointer allows for indirect access to the element itself, making it a valuable tool in programming for manipulating and referencing data.

    Rate this question:

  • 12. 

    When new data are to be inserted into a data structure, but there is no available space; this situation is usually called

    • A.

      Underflow

    • B.

      Overflow

    • C.

      Housefull

    • D.

      Saturated

    Correct Answer
    B. Overflow
    Explanation
    When new data needs to be inserted into a data structure, but there is no available space, this situation is referred to as "overflow." Overflow occurs when the data structure reaches its maximum capacity and cannot accommodate any more data. It is the opposite of underflow, which occurs when data is removed from the structure and there is no remaining data. "Housefull" and "saturated" are not commonly used terms in computer science to describe this situation.

    Rate this question:

  • 13. 

    Which of the following name does not relate to stacks?

    • A.

      FIFO lists

    • B.

      LIFO list

    • C.

      Piles

    • D.

      Push-down lists

    Correct Answer
    A. FIFO lists
    Explanation
    The term "FIFO" stands for "First-In-First-Out," which is a principle used in queue data structures, not in stacks. Stacks follow the principle of "Last-In-First-Out" (LIFO). The other options, LIFO list, Piles, and Push-down lists, all relate to stacks as they represent different ways of implementing or visualizing stack data structures.

    Rate this question:

  • 14. 

    A data structure where elements can be added or removed at either end but not in the middle

    • A.

      Linked lists

    • B.

      Stacks

    • C.

      Queues

    • D.

      Deque

    Correct Answer
    D. Deque
    Explanation
    A deque, also known as a double-ended queue, is a data structure where elements can be added or removed at either end but not in the middle. This means that elements can be inserted or deleted from both the front and the rear of the deque. Linked lists, stacks, and queues also allow for adding and removing elements, but they do not support insertion or deletion from both ends. Therefore, the correct answer is deque.

    Rate this question:

  • 15. 

    The postfix form of the expression (A+ B)*(C*D- E)*F / G is?

    • A.

      AB+ CD*E - FG /**

    • B.

      AB + CD* E - F **G /

    • C.

      AB + CD* E - *F *G /

    • D.

      AB + CDE * - * F *G /

    Correct Answer
    A. AB+ CD*E - FG /**
    Explanation
    The given expression is in infix form. To convert it to postfix form, we need to rearrange the operators and operands. The conversion follows the rule of placing operators after their operands. The expression in postfix form would be "AB+ CD*E - FG /**".

    Rate this question:

  • 16. 

    The data structure required to check whether an expression contains balanced parenthesis is?

    • A.

      Stack

    • B.

      Queue

    • C.

      Array

    • D.

      Tree

    Correct Answer
    A. Stack
    Explanation
    A stack is the appropriate data structure to check whether an expression contains balanced parentheses. This is because a stack follows the Last-In-First-Out (LIFO) principle, which is ideal for checking the order of opening and closing parentheses. When encountering an opening parenthesis, it is pushed onto the stack, and when encountering a closing parenthesis, it is compared to the top element of the stack. If they match, the opening parenthesis is popped from the stack. If at the end of the expression the stack is empty, it means that all parentheses were balanced.

    Rate this question:

  • 17. 

    Which of the following statement(s) about stack data structure is/are NOT correct?

    • A.

      Stack data structure can be implemented using linked list

    • B.

      New node can only be added at the top of the stack

    • C.

      Stack is the FIFO data structure

    • D.

      The last node at the bottom of the stack has a NULL link

    Correct Answer
    C. Stack is the FIFO data structure
    Explanation
    The statement "Stack is the FIFO data structure" is not correct. A stack is actually a LIFO (Last-In-First-Out) data structure, meaning that the last element added to the stack is the first one to be removed. In contrast, a FIFO (First-In-First-Out) data structure, such as a queue, follows the principle that the first element added is the first one to be removed.

    Rate this question:

  • 18. 

    Consider the following array implementation of stack:#define MAX 10Struct STACK{Int arr [MAX];Int top = -1;}If the array index starts with 0, the maximum value of top which does not cause stack overflow is? 

    • A.

      8

    • B.

      9

    • C.

      10

    • D.

      11

    Correct Answer
    A. 8
    Explanation
    The maximum value of top which does not cause stack overflow is 8 because the array index starts with 0. In this implementation, the top variable represents the index of the top element in the stack. Since the array index starts with 0, the maximum index value that can be used without causing a stack overflow is 9. However, since the initial value of top is -1, we need to add 1 to the maximum index value, resulting in a maximum value of top equal to 8. This ensures that the stack remains within the bounds of the array.

    Rate this question:

  • 19. 

    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 ?

    • A.

      Queue

    • B.

      Stack

    • C.

      Tree

    • D.

      Linked List

    Correct Answer
    A. Queue
    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 - FIFO). This data structure is commonly used in scenarios where elements need to be processed in the order they were added, such as scheduling tasks or handling requests.

    Rate this question:

  • 20. 

    Let the following circular queue can accommodate maximum six elements with the following datafront = 2 rear = 4queue = _______; L, M, N, ___, ___What will happen after ADD O operation takes place?

    • A.

      Front = 2 rear = 5 queue = ______; L, M, N, O, ___

    • B.

      Front = 3 rear = 5 queue = L, M, N, O, ___

    • C.

      Front = 3 rear = 4 queue = ______; L, M, N, O, ___

    • D.

      Front = 2 rear = 4 queue = L, M, N, O, ___

    Correct Answer
    A. Front = 2 rear = 5 queue = ______; L, M, N, O, ___
    Explanation
    After the ADD O operation takes place, the element O will be added to the circular queue. The front remains the same at 2, and the rear is updated to 5. The queue will now be L, M, N, O, with two empty spaces after O.

    Rate this question:

  • 21. 

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

    • A.

      At the head of link list

    • B.

      At the tail of the link list

    • C.

      At the center position in the link list

    • D.

      None

    Correct Answer
    B. At the tail of the link list
    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 therefore will be the last one to be removed when dequeuing.

    Rate this question:

  • 22. 

    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? 

    • A.

      Rear=(rear%1)+MAX_SIZE

    • B.

      Rear=rear%(MAX_SIZE+1)

    • C.

      Rear=(rear+1)%MAX_SIZE

    • D.

      Rear=rear+(1%MAX_SIZE)

    Correct Answer
    C. Rear=(rear+1)%MAX_SIZE
    Explanation
    When inserting an element in the queue, the rear is manipulated using the expression rear=(rear+1)%MAX_SIZE. This expression increments the value of rear by 1 and then takes the modulo of MAX_SIZE to ensure that the rear remains within the valid range of indices for the array used in the circular queue implementation. This allows the rear to wrap around to the beginning of the array when it reaches the end, effectively creating a circular behavior.

    Rate this question:

  • 23. 

    A circular queue is implemented using an array of size 10. The array index starts with 0, front is 6, and rear is 9. The insertion of next element takes place at the array index.

    • A.

      0

    • B.

      7

    • C.

      9

    • D.

      10

    Correct Answer
    A. 0
    Explanation
    In a circular queue, the front and rear pointers indicate the positions of the first and last elements in the queue respectively. The array index where the insertion of the next element takes place is determined by the value of the rear pointer. Since the rear pointer is at index 9, the next element will be inserted at index 0, as the array is circular and wraps around.

    Rate this question:

  • 24. 

    The following C Function takes a singly- linked list of integers as a parameter and rearrangesthe elements of the lists. The function is called with the list containing the integers 1,2,3,4,5,6,7 in the given order. What will be the contents of the list after the function completes execution?struct node{int value;struct node* next;};void rearrange (struct node* list){struct node *p,q;int temp;if (! List || ! list->next) return;p->list; q=list->next;while(q){temp=p->value; p->value=q->value;q->value=temp;p=q->next;q=p?p->next:0;}} 

    • A.

      1, 2, 3, 4, 5, 6, 7

    • B.

      2, 1, 4, 3, 6, 5, 7

    • C.

      1, 3, 2, 5, 4, 7, 6

    • D.

      2, 3, 4, 5, 6, 7, 1

    Correct Answer
    B. 2, 1, 4, 3, 6, 5, 7
    Explanation
    The function rearranges the elements of the linked list by swapping the values of each pair of adjacent nodes. It starts with the first node and swaps its value with the value of the next node. Then it moves to the next pair of nodes and continues swapping their values. This process continues until the end of the list is reached. Therefore, the contents of the list after the function completes execution will be 2, 1, 4, 3, 6, 5, 7.

    Rate this question:

  • 25. 

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

    • A.

      Deleting a node whose location in given

    • B.

      Searching of an unsorted list for a given item

    • C.

      Inverting a node after the node with given location

    • D.

      Traversing a list to process each node

    Correct Answer
    A. Deleting a node whose location in given
    Explanation
    Deleting a node whose location is given is performed more efficiently by a doubly linked list than by a singly linked list. In a doubly linked list, each node contains references to both the previous and next nodes, allowing for easier deletion of a node at a given location. This is because in a singly linked list, to delete a node at a given location, we need to traverse the list from the beginning to find the node before the desired location, which takes more time. However, in a doubly linked list, we can directly access the node at the given location and update the references of the previous and next nodes, making the deletion process faster.

    Rate this question:

  • 26. 

    Which of the following statements about linked list data structure is/are TRUE?

    • A.

      Addition and deletion of an item to/ from the linked list require modification of the existing pointers

    • B.

      The linked list pointers do not provide an efficient way to search an item in the linked list

    • C.

      Linked list pointers always maintain the list in ascending order

    • D.

      The linked list data structure provides an efficient way to find kth element in the list

    Correct Answer
    B. The linked list pointers do not provide an efficient way to search an item in the linked list
    Explanation
    The linked list pointers do not provide an efficient way to search an item in the linked list. This is because in a linked list, each node only contains a pointer to the next node in the list, making it necessary to traverse the entire list from the beginning in order to find a specific item. This linear search process can be time-consuming, especially for large lists.

    Rate this question:

Quiz Review Timeline +

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
  • Jul 11, 2016
    Quiz Created by
    Rmkumar
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.