The Data Structure Trivia Exam: 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 Raj_daoo
R
Raj_daoo
Community Contributor
Quizzes Created: 1 | Total Attempts: 9,033
| Attempts: 9,033 | Questions: 20
Please wait...
Question 1 / 20
0 %
0/100
Score 0/100
1. An Array is what kind of data structure.

Explanation

An array is a linear data structure because it stores elements in a contiguous memory location. Each element in the array can be accessed using its index value, which represents its position in the array. The elements are stored in a sequential manner, allowing for efficient traversal and access. Therefore, the correct answer is "Linear."

Submit
Please wait...
About This Quiz
The Data Structure Trivia Exam: Quiz! - Quiz


Do you have any idea what the data structure is? Data structure is a method that applies the appropriate structure and syntax to store and organize information. This... see morequiz asks you what an array is, how to delete an item from an array which loop is correct, how to identify the underflow condition for a stack, and how to identify the correct set of statements. This great quiz will assist you with learning about data structure. see less

2. A Stack follows the principle of

Explanation

A stack follows the principle of LIFO, which stands for "Last In, First Out." This means that the last element added to the stack will be the first one to be removed. It is similar to a stack of plates, where you can only remove the topmost plate. In a stack data structure, items are added and removed from the same end, known as the top of the stack. This principle allows for efficient insertion and deletion operations, making it useful in various applications like function calls, expression evaluation, and backtracking algorithms.

Submit
3. With every push in the stack the   top

Explanation

In a stack, the "top" refers to the position of the most recently added element. When a new element is pushed onto the stack, it becomes the new top element, causing the top position to increment by one. Therefore, the correct answer is "increments by one".

Submit
4. Which data structure is best suited to print the documents in the printer

Explanation

Queues are the best suited data structure for printing documents in a printer because they follow the First-In-First-Out (FIFO) principle. When multiple documents are sent to the printer, the documents are printed in the order they were received, just like how people stand in a queue and are served in the same order. This ensures that the documents are printed in a fair and orderly manner, without any document being skipped or delayed. Stacks, on the other hand, follow the Last-In-First-Out (LIFO) principle, which is not suitable for printing documents in the desired order. Arrays can be used, but queues provide a more efficient and logical approach for this specific task.

Submit
5. What is the disadvantage of a binary search?

Explanation

The disadvantage of a binary search is that it requires a sorted array. This means that before performing the search, the array must be sorted, which can be time-consuming and may require additional space. If the array is not already sorted, it would need to be sorted first, which adds an extra step and potentially increases the overall time complexity of the search algorithm.

Submit
6. Identify the UnderFlow condition for a Stack

Explanation

The correct answer is "if( top

Submit
7. Which Data structure is best suited for the UNDO operation in Windows

Explanation

The UNDO operation in Windows requires a data structure that follows the Last-In-First-Out (LIFO) principle, where the most recently performed action is undone first. A stack is the best-suited data structure for this purpose as it allows elements to be added and removed from only one end, the top. When an action needs to be undone, it can be easily popped off the stack, reversing the order of operations. Therefore, a stack is the most appropriate data structure for implementing the UNDO operation in Windows.

Submit
8. Identify the OverFlow condition for a Queue

Explanation

The correct answer is "if(REAR > N)". This condition checks if the rear of the queue is greater than the maximum size of the queue (N). If this condition is true, it indicates that the queue has reached its maximum capacity and cannot accept any more elements. This is known as an overflow condition in a queue.

Submit
9. Which one is the Application of Stack

Explanation

The application of a stack includes all of the above options. Polished notations, such as postfix or prefix notations, can be evaluated using a stack. Storing return addresses of function calls is another common use of a stack in programming languages. Reversing a string can be achieved by pushing each character onto a stack and then popping them off in reverse order. Recursion, which involves calling a function within itself, can also be implemented using a stack to keep track of function calls. Therefore, all of the given options are valid applications of a stack.

Submit
10. To Delete an item from a Queue identify the correct set of statements :-

Explanation

The correct set of statements to delete an item from a Queue is "item = Q[FRONT]; FRONT++;" This is because in a Queue, the element that has been in the queue for the longest time is always at the front. So, to delete an item, we need to first assign the value of the item at the front of the queue to the variable "item" and then increment the value of the "FRONT" pointer to move it to the next element in the queue.

Submit
11. What is the contents of the array after the execution of the following program :-
int a[] = {10,30, 20, 10, 30, 40};
for(i=1;i<=6;i++)
 {
   for(j=i+1 ; j<= 6; j++)
   {
      if(a[i] == a[j])
      {
         a[j] = 0;
      }
}

Explanation

The program iterates through the array and checks for duplicate elements. If a duplicate element is found, it sets the value of that element to 0. In this case, the initial array is {10, 30, 20, 10, 30, 40}. After executing the program, the duplicate elements 10 and 30 are replaced with 0. Therefore, the resulting array is {10, 30, 20, 0, 0, 40}.

Submit
12. What is the advantage of a linear search?

Explanation

The advantage of a linear search is that it does not require the array to be sorted. This means that the elements can be in any order and the linear search will still be able to find the desired element. This makes it a flexible and versatile search algorithm that can be used in various scenarios.

Submit
13. Find the value of the postfix expression :- ABCD ^*-  (IF A = 150, B=10, C=2 D=3)

Explanation

The given postfix expression "ABCD ^*- " can be evaluated as follows:
1. The symbol "^" represents the exponentiation operation. So, "C ^ D" means C raised to the power of D, which is equal to 2^3 = 8.
2. The symbol "*" represents the multiplication operation. So, "A * B" means A multiplied by B, which is equal to 150 * 10 = 1500.
3. The symbol "-" represents the subtraction operation. So, "A - B" means A minus B, which is equal to 1500 - 8 = 1492.
Therefore, the value of the postfix expression is 1492.

Submit
14. To Insert an item from a stack identify the correct set of statements :-

Explanation

The correct set of statements to insert an item from a stack is "top++; S[top] = Item;". This set of statements first increments the top pointer to create space for the new item in the stack, and then assigns the item to the position pointed by the top pointer in the stack array.

Submit
15. Write the postfix notation of A + B * C / D

Explanation

The given expression is A + B * C / D. In postfix notation, the operators are placed after their operands. To convert the expression to postfix, we start by placing A and B as operands. Then, we encounter the multiplication operator * and place it after B. Next, we encounter the division operator / and place it after C. Finally, we encounter the addition operator + and place it after the previous two operands and operator. Hence, the postfix notation of A + B * C / D is ABC*D/+.

Submit
16. Find the postfix expression of the following :- A OR B AND !C

Explanation

The postfix expression of "A OR B AND !C" is "ABC! AND OR". In postfix notation, the operators are placed after their operands. Here, the expression "!C" is evaluated first because of the "!" operator. Then, "B AND !C" is evaluated because of the "AND" operator. Finally, "A OR (B AND !C)" is evaluated because of the "OR" operator.

Submit
17. While inserting an item in an array of integers which loop is right, where pos is the pos at which insertion is to be made(assume array starts from 1 and N is the max no. of items in the array.)

Explanation

The correct answer is "for(i=N; i>=pos;i--) { A[i+1] = A[i] }". This loop starts from the last element of the array and moves towards the position where the insertion is to be made. It shifts each element one position to the right, creating space for the new element to be inserted at the desired position.

Submit
18. Write the prefix notation of A + B * C / D

Explanation

The given prefix notation is "+/*BCDA". This notation represents the expression A + (B * (C / D)). In prefix notation, the operator comes before the operands. Here, the "+" operator is applied to the result of the "*" operator, which in turn is applied to the result of the "/" operator. The operands A, B, C, and D represent variables or values.

Submit
19. To delete an item from an array which loop is correct, where p is the position of deletion( assume array starts from 1 and N is the max no. of items in the array.)

Explanation

The correct loop to delete an item from an array at position p is "for(i=pos;i

Submit
20. If the search item lies in the upper half in case of binary search which is the correct set of statements.

Explanation

In binary search, the search item lies in the upper half when the value at the middle index is less than the search item. In this case, the correct set of statements is "bot = mid - 1;". This statement updates the lower bound of the search range to be one less than the middle index, effectively narrowing down the search range to the upper half.

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
  • May 11, 2010
    Quiz Created by
    Raj_daoo
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
An Array is what kind of data structure.
A Stack follows the principle of
With every push in the stack the   top
Which data structure is best suited to print the documents in the...
What is the disadvantage of a binary search?
Identify the UnderFlow condition for a Stack
Which Data structure is best suited for the UNDO operation in Windows
Identify the OverFlow condition for a Queue
Which one is the Application of Stack
To Delete an item from a Queue identify the correct set of statements...
What is the contents of the array after the execution of the...
What is the advantage of a linear search?
Find the value of the postfix expression :- ABCD ^*-  (IF A =...
To Insert an item from a stack identify the correct set of statements...
Write the postfix notation of A + B * C / D
Find the postfix expression of the following :- A OR B AND !C
While inserting an item in an array of integers which loop is right,...
Write the prefix notation of A + B * C / D
To delete an item from an array which loop is correct, where p is the...
If the search item lies in the upper half in case of binary search...
Alert!

Advertisement