Data Structures And Algorithms Practice Test!

32 Questions | Total Attempts: 765

SettingsSettingsSettings
Data Structures And Algorithms Practice Test! - Quiz

Below are data structures and algorithms practice tests! Data structures are sets of data that are prepared in a certain way so as to make it easier for them to be processed. The quiz below is designed to test out just how much you know about different algorithms, order, and preorder of data. Do check it out and keep a lookout for others like it!


Questions and Answers
  • 1. 
    Check all statements that are true. (Some are false.)
    • A. 

      Swift has Optionals, whereas Java 7 does not.

    • B. 

      Swift has Structs, whereas Java 7 does not.

    • C. 

      Swift Classes are value types, unlike Java Classes, which are reference types.

    • D. 

      Swift and Java both have primitives.

    • E. 

      Swift has enums, whereas Java does not.

    • F. 

      Swift has Type Inferencing, while Java does not.

    • G. 

      Both Swift and Java allow you to use tuples as parameters.

    • H. 

      Strings are references types in both Java and Swift.

    • I. 

      A regular Array in Swift is mutable if you declare it using var, while a regular Array in Java is immutable regardless of how you declare it.

  • 2. 
    In building the code for the Linked List, what main "cases" did you have to consider? Check all that apply. 
    • A. 

      The given Node belongs at the beginning and should replace the head because it is less than the head.

    • B. 

      The given Node belongs at the end.

    • C. 

      The given Node does not belong anywhere.

    • D. 

      The given Node belongs in the middle.

    • E. 

      The given Node cannot be inserted because the Linked List is full.

    • F. 

      Error checking in case the given Node is entered incorrectly.

  • 3. 
    Which of the following options best characterizes inOrder?
    • A. 

      Left, Head, Right

    • B. 

      Head, Left, Right

    • C. 

      Right, Left, Head

    • D. 

      Right, Head, Left

  • 4. 
    Which of the following best characterizes preOrder?
    • A. 

      Right, Head, Left

    • B. 

      Head, Right, Left

    • C. 

      Left, Right, Head

    • D. 

      Head, Left, Right

  • 5. 
    Which of the following best characterizes postOrder?
    • A. 

      Left, Head, Right

    • B. 

      Right, Head, Left

    • C. 

      Left, Right, Head

    • D. 

      Head, Left, Right

  • 6. 
    Recursion is always the best way to code programs and create functions. 
    • A. 

      True

    • B. 

      False

  • 7. 
    A Linked List is a [Blank] data structure. 
  • 8. 
    Each element of a Linked List is called a [Blank]. 
  • 9. 
    Each of the elements of a Linked List is made up of [Blank] and [Blank]. 
  • 10. 
    The last element of the list has a reference to [Blank].
  • 11. 
    The reference to the first element of the list is called the [Blank]. 
  • 12. 
    The primary advantage of a Linked List is that it can both [Blank]. 
  • 13. 
    One disadvantage of a Linked List is that you cannot [Blank] the elements directly. 
  • 14. 
    What is the Big O notation for a search operation in a Linked List?
    • A. 

      Big O of n

    • B. 

      Big O of n^2

    • C. 

      Big O of logn

    • D. 

      Big O of nlogn

  • 15. 
    What is the Big O notation of an insertion operation in a Linked List at the head and at the tail?
    • A. 

      Head: Big O of n Tail: Big O of logn

    • B. 

      Head: Big O of 1 Tail: Big O of n

    • C. 

      Head: Big O of 2n Tail: Big O of nlogn

    • D. 

      Head; Big O of n^3 Tail: Big O of n^5

  • 16. 
    What is the Big O notation of removing an element from the Linked List?
    • A. 

      Big O of logn

    • B. 

      BigO of n + n

    • C. 

      Big O of nlogn

    • D. 

      Big O of n

  • 17. 
    The value of all the nodes in the left sub-tree of a Binary Search Tree that DOES NOT handle duplicates must be [Blank] the root node.
  • 18. 
    The value of all the nodes in the right subtree of a Binary Seach Tree must be [Blank] the root node. 
  • 19. 
    What is the Big O notation of searching through a Binary Search Tree that is balanced (meaning that for all nodes, the difference in heights between left and right subtrees is at most 1)? If confused, just refer to the image for an example of a BALANCED Binary Search Tree. 
    • A. 

      Big O of n^3

    • B. 

      Big O of n

    • C. 

      Big O of logn

    • D. 

      Big O of nlogn

  • 20. 
    Perform an inOrder transversal. Which of the following would be the correct result?
    • A. 

      12 10 8 15 25 16 20

    • B. 

      You cannot perform an inOrder transversal.

    • C. 

      8 10 12 15 16 20 25

    • D. 

      25 16 20 15 12 10 8

  • 21. 
    Which of the following options successfully completes the fibonacci sequence function?
    • A. 

      Return fib (n - 2) + fib(n - 3)

    • B. 

      Return fib(n - 1) + fib(n - 2)

    • C. 

      Return fib(n - 1) * fib(n - 2)

    • D. 

      Return fib(n)

  • 22. 
    The Big O notation for the put operation of an UnsortedMap is [Blank].
  • 23. 
    The Big O notation for the get operation of an UnsortedMap is [Blank].
  • 24. 
    The Big O notation for the get operation of a SortedMap is [Blank]. 
  • 25. 
    The Big O notation for the put operation of a SortedMap is [Blank]. 
Back to Top Back to top