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. EasyComplexity Analysis

    Priya keeps 10 lakh order IDs in a Python list called orders. What is the time complexity of reading orders[500000]?

    • O(1)
    • O(n^2)
    • O(n)
    • O(log n)
    Show the answer

    Answer: O(1). A Python list is a dynamic array of references stored side by side, so the position of item i is worked out directly from i. Nothing is scanned, so indexing takes the same time for 10 items or 10 lakh items.

  2. MediumSorting and Searching

    A Surat textile trader sends boxes weighing 4, 8, 2, 7, 5, 3, 6 kg in this order. Each day the truck takes the next boxes until the next one would not fit, and all must go within 3 days. What is the smallest truck capacity that works?

    • 14
    • 8
    • 12
    • 35
    Show the answer

    Answer: 14. Capacity 14 works: the days carry 4 + 8 + 2; 7 + 5; 3 + 6. One kg less needs a 4th day. Binary search on capacity between the heaviest box (8) and the total (35) finds this, since more capacity never needs more days.

  3. HardHeaps

    What does this code print? Each option lists the two printed lines in order.

    import heapq
    
    a = [5, 9, 3, 7, 1]
    b = []
    for x in a:
        heapq.heappush(b, x)
    heapq.heapify(a)
    print(a)
    print(b)
    • [1, 5, 3, 7, 9] then [1, 3, 5, 9, 7]
    • [1, 5, 3, 7, 9] then [1, 5, 3, 7, 9]
    • [1, 3, 5, 9, 7] then [1, 5, 3, 7, 9]
    • [1, 3, 5, 7, 9] then [1, 3, 5, 7, 9]
    Show the answer

    Answer: [1, 5, 3, 7, 9] then [1, 3, 5, 9, 7]. Both lists are valid min-heaps with 1 at the root, but they differ: pushing one by one sifts each new value up, while heapify sifts parents down from the bottom. A heap's layout depends on how it was built; only the parent-child rule is fixed.

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