CoreHRx Jobs

Apply in one click, save jobs and take free mock tests.

Register free Log in
Hiring? Post jobs with CoreHRx
My account
user

View & update profile

Data Structures and Algorithms mock test: free online practice

15 to 30 random questions in 15 to 30 minutes, by the level you choose: big-o, arrays, linked lists, trees, graphs, dp, greedy and sorting. After you submit you get your score, your strong and weak topics, and the right answer with an explanation for every question.

Want to revise first? Read the Data Structures and Algorithms interview questions and answers.

Choose your level

Free with a CoreHRx Jobs account: you will be asked to sign in or create one first.

What does the Data Structures and Algorithms mock test cover?

The test covers 13 topics across three levels. Each attempt picks 15 to 30 questions at random, by the level you choose, so every attempt is different.

  • Graphs
  • Dynamic Programming
  • Sorting and Searching
  • Trees and BST
  • Recursion and Backtracking
  • Complexity Analysis
  • Stacks and Queues
  • Arrays and Strings
  • Hashing
  • Two Pointers and Sliding Window
  • Greedy Algorithms
  • Heaps
  • Linked Lists

Sample Data Structures and Algorithms mock test questions

One question from each level, the way they appear in the test. A new set comes on the 1st of every month. Try it, then open the answer.

  1. EasyTrees and BST

    Keys 10, 5, 15, 3, 7, 6 are inserted into an empty BST. What is the height of the tree, counted in edges on the longest root-to-leaf path?

    • 4
    • 3
    • 5
    • 2
    Show the answer

    Answer: 3. 6 goes left of 10, right of 5 and left of 7, so the path 10 -> 5 -> 7 -> 6 has 3 edges, the longest in the tree. Counting nodes instead of edges would give 4, so always check which convention a question uses.

  2. MediumStacks and Queues

    A queue is built from two stacks: enqueue pushes onto stack IN; dequeue pops from stack OUT and, only when OUT is empty, first moves every item from IN to OUT. For enqueue 1, 2, 3, dequeue, enqueue 4, 5, then three dequeues, how many items move from IN to OUT in total?

    • 5
    • 8
    • 10
    • 3
    Show the answer

    Answer: 5. The first dequeue moves 1, 2, 3 (3 moves) and returns 1. The next two dequeues pop 2 and 3 straight from OUT. The last one finds OUT empty and moves 4 and 5. That is 5 moves for 5 items; no item ever moves twice.

  3. HardSorting and Searching

    Quick sort slows down to O(n^2) on a list where most values are equal. Which change fixes this?

    • Reversing the list before sorting
    • Three-way partitioning into less than, equal to and greater than the pivot
    • Switching to bubble sort for equal values
    • Always choosing the first element as the pivot
    Show the answer

    Answer: Three-way partitioning into less than, equal to and greater than the pivot. With a two-way partition, equal keys all land on one side, so each step removes only the pivot. Three-way partitioning gathers every copy of the pivot in the middle and never recurses on them, so all-equal input takes one O(n) pass.

Take the full Data Structures and Algorithms mock test: 15 to 30 questions and 15 to 30 minutes, by level.

How is the Data Structures and Algorithms mock test scored?

A question counts as right only when you pick exactly the right option, or all the right options where it says so; a question left blank counts as wrong. Your score is the share of the test's questions you got right (15 to 30, by level). The result also scores every topic, so you know what to revise before the interview.

  • 75% or more in a topica strength
  • 50% to 74%worth a revision
  • Under 50%a topic to work on

Data Structures and Algorithms mock test: questions people ask

Is the Data Structures and Algorithms mock test free?

Yes. The Data Structures and Algorithms mock test is free. You need a free CoreHRx Jobs account to start it, so your score and the topics to work on are saved.

How many questions are in the Data Structures and Algorithms mock test?

It depends on the level: Easy has 15 questions in 15 minutes, Medium has 20 questions in 20 minutes, Hard has 30 questions in 30 minutes. They are multiple-choice questions picked at random from a larger bank of Data Structures and Algorithms questions at your level, so every attempt is different.

Which Data Structures and Algorithms topics does the test cover?

The questions cover Graphs, Dynamic Programming, Sorting and Searching, Trees and BST, Recursion and Backtracking, Complexity Analysis, Stacks and Queues, Arrays and Strings, Hashing, Two Pointers and Sliding Window, Greedy Algorithms, Heaps, Linked Lists. Your result shows how you did in each topic.

Which level should I choose?

Easy: Arrays, strings, hashing, stacks, queues and Big-O basics. Medium: Trees, heaps, recursion, sorting and the patterns most coding rounds use. Hard: Graphs, dynamic programming and greedy choices, for top scores. Start with Easy and move up.

Can employers see my Data Structures and Algorithms score?

Only your best Data Structures and Algorithms score, and only when it is 60% or more. It shows on the job applications you send on CoreHRx. Lower scores stay private.

Can I take the Data Structures and Algorithms mock test again?

Yes, up to 10 tests a day. Each attempt picks questions you have not seen recently first.

All mock tests