Data Structures (Dummy 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 Seelak123
S
Seelak123
Community Contributor
Quizzes Created: 1 | Total Attempts: 229
Questions: 10 | Attempts: 230

SettingsSettingsSettings
Data Structure Quizzes & Trivia

.


Questions and Answers
  • 1. 

    A Stack follows the principle of

    • A.

      LIFO

    • B.

      FIFO

    • C.

      BOTH A and B

    • D.

      None

    Correct Answer
    A. LIFO
    Explanation
    A stack follows the principle of LIFO (Last In, First Out), which means that the last element added to the stack will be the first one to be removed. This is similar to a stack of plates, where the last plate placed on top is the first one to be taken off. In a stack data structure, elements are added and removed from one end only, called the top. When a new element is added, it is pushed onto the top of the stack, and when an element is removed, it is popped off from the top.

    Rate this question:

  • 2. 

    Which one is the Application of Stack

    • A.

      Polished Notations

    • B.

      Storing return addresses of function calls

    • C.

      Reversing a String

    • D.

      Recursion

    • E.

      All of the Above

    Correct Answer
    E. All of the Above
    Explanation
    All of the given options are applications of a stack.

    - Polished notations, such as infix, postfix, and prefix, can be evaluated using stacks to store operators and operands.
    - Storing return addresses of function calls is a common use of a stack in computer programming. When a function is called, the address of the instruction following the function call is stored on the stack, allowing the program to return to that point after the function execution is complete.
    - Reversing a string can be done using a stack by pushing each character onto the stack and then popping them off in reverse order.
    - Recursion, which is a programming technique where a function calls itself, often relies on a stack to keep track of the function calls and their return addresses.

    Therefore, all of the given options are valid applications of a stack.

    Rate this question:

  • 3. 

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

    • A.

      70

    • B.

      80

    • C.

      150

    • D.

      0

    • E.

      1500

    Correct Answer
    A. 70
    Explanation
    The given postfix expression is "ABCD ^*-". In this expression, "^" represents exponentiation, "*" represents multiplication, and "-" represents subtraction. The values of A, B, C, and D are given as A=150, B=10, C=2, and D=3.

    First, the exponentiation operation is performed, which is A^B = 150^10 = 1500000000000000000000.
    Then, the multiplication operation is performed, which is (1500000000000000000000) * C = 1500000000000000000000 * 2 = 3000000000000000000000.
    Finally, the subtraction operation is performed, which is (3000000000000000000000) - D = 3000000000000000000000 - 3 = 2999999999999999999997.

    Therefore, the value of the postfix expression is 2999999999999999999997, which is not one of the given answer choices. Hence, the correct answer cannot be determined from the given options.

    Rate this question:

  • 4. 

    What is the advantage of linear search

    • A.

      Fast

    • B.

      Time consuming

    • C.

      Needs a sorted array

    • D.

      Does not needs a sorted array

    • E.

      ALL

    Correct Answer
    D. Does not needs a sorted array
    Explanation
    The advantage of linear search is that it does not require the array to be sorted. This means that it can be used on unsorted data, making it more flexible and versatile compared to other search algorithms that require a sorted array. Linear search sequentially checks each element in the array until a match is found, which allows it to work efficiently regardless of the order of the elements.

    Rate this question:

  • 5. 

    What is the disadvantage of a binary search

    • A.

      Fast

    • B.

      Time consuming

    • C.

      Needs a sorted array

    • D.

      Does not needs a sorted array

    • E.

      ALL

    Correct Answer
    C. Needs a sorted array
    Explanation
    The disadvantage of a binary search is that it requires the array to be sorted. This means that if the array is not already sorted, it would need to be sorted first before performing the binary search. This extra step of sorting the array can be time-consuming and may require additional resources.

    Rate this question:

  • 6. 

    Two main measures for the efficiency of an algorithm are

    • A.

      Processor and memory

    • B.

      Complexity and capacity

    • C.

      Time and space

    • D.

      Data and space

    Correct Answer
    C. Time and space
    Explanation
    The efficiency of an algorithm is typically measured by considering the amount of time it takes to execute and the amount of space it requires. Time refers to the execution time of the algorithm, which measures how long it takes for the algorithm to complete its task. Space refers to the memory space required by the algorithm, which measures how much memory the algorithm needs to store its data and variables. Therefore, the correct answer is "Time and space" as these two measures are commonly used to evaluate the efficiency of an algorithm.

    Rate this question:

  • 7. 

    Which of the following case does not exist in complexity theory

    • A.

      Best case

    • B.

      Worst case

    • C.

      Average case

    • D.

      Null case

    Correct Answer
    D. Null case
    Explanation
    The null case does not exist in complexity theory because it refers to a scenario where there are no inputs or operations to be analyzed. Complexity theory focuses on analyzing the performance of algorithms and the relationship between input size and computational resources required. In the null case, there is no input or operation to analyze, making it irrelevant in the context of complexity theory.

    Rate this question:

  • 8. 

    The Average case occur in linear search algorithm

    • A.

      When Item is somewhere in the middle of the array

    • B.

      When Item is not in the array at all

    • C.

      When Item is the last element in the array

    • D.

      When Item is the last element in the array or is not there at all

    Correct Answer
    A. When Item is somewhere in the middle of the array
    Explanation
    In linear search algorithm, the average case occurs when the item being searched for is somewhere in the middle of the array. This means that on average, the algorithm will need to iterate through half of the array elements before finding the desired item. The time complexity for the average case in linear search is O(n/2), which simplifies to O(n).

    Rate this question:

  • 9. 

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

    • A.

      /*+ABCD

    • B.

      +/*ABCD

    • C.

      +/*BCDA

    • D.

      +A/*BCD

    • E.

      /*+BDCA

    Correct Answer
    C. +/*BCDA
    Explanation
    The given expression is "A + B * C / D". The prefix notation of this expression is "+ / * B C D A". In prefix notation, the operator is placed before its operands. Therefore, the correct answer is "+ / * B C D A".

    Rate this question:

  • 10. 

    What is the correct sequence of data structures used in BFS and DFS?

    • A.

      Array,stack

    • B.

      Stack,queue

    • C.

      Queue,stack

    • D.

      Stack,linked list

    • E.

      None

    Correct Answer
    C. Queue,stack
    Explanation
    BFS (Breadth-First Search) and DFS (Depth-First Search) are graph traversal algorithms. In BFS, we explore all the vertices at the same level before moving to the next level. This can be efficiently implemented using a queue data structure, where we enqueue the vertices as we visit them. On the other hand, DFS explores a path until it reaches a dead end before backtracking. This can be implemented using a stack data structure, where we push the vertices onto the stack as we visit them. Therefore, the correct sequence of data structures used in BFS and DFS is queue, stack.

    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
  • Aug 23, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 02, 2015
    Quiz Created by
    Seelak123
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.