Level 1 – Beginner (Basic Understanding and Application) – 25 Questions
1. Print "Hello, World!" to the console.
2. Input two numbers and print their sum.
3. Check whether a number is even or odd.
4. Calculate the area of a circle given its radius.
5. Create a basic calculator (add, subtract, multiply, divide).
6. Check if a year is a leap year.
7. Find the largest among three numbers.
8. Compute the sum of the first N natural numbers.
9. Print the multiplication table of a given number.
10. Find the factorial of a number using a loop.
11. Find the maximum number in a list.
12. Reverse a given string.
13. Count the number of vowels in a string.
14. Remove duplicates from a list.
15. Find the sum of list elements using a function.
16. Write a string into a file.
17. Read and display contents of a file.
18. Count the number of words in a file.
19. Handle division by zero using exception handling.
20. Use try-except to catch invalid input.
21. Define a function to add two numbers.
22. Use the math module to compute a square root.
23. Define a class Student with attributes and a method to display details.
24. Add a constructor to initialize attributes in the Student class.
25. Create a Rectangle class to calculate area.
Level 2 – Moderate (Intermediate Problem-Solving) – 15 Questions
1. Write a function getprimes(start, end) that returns a list of prime numbers between two
integers using the Sieve of Eratosthenes.
2.Write a function to check if a given string is a palindrome, ignoring spaces and case.
3. Write a program that takes a string as input and returns a dictionary showing the frequency
of each character.
4. Write a function that takes a matrix (2D list) and returns its transpose.
5. Create a menu-driven program to: Insert element, Delete element, Display list, Search an
element. Use exception handling for invalid inputs.
6.Write a program that stores student data (name, age, grades) in a JSON file and reads it
back to display.
7. Create a class Bank Account with attributes: account number, name, balance. Add methods
for deposit, withdraw, and display balance. Use exception handling to avoid negative balance.
8. Take input coefficients a, b, and c and solve the quadratic equation using the quadratic
formula. Handle cases when a=0 or discriminant is negative.
9. Write a function to search for a word in a text file and return how many times it appears.
10.Implement a class Calculator with methods for add, subtract, multiply, divide, and
modulo. Raise exceptions for invalid operations.
11. Given a list of student records (name, age, marks), sort them by marks using lambda or
itemgetter.
12. Ask user for marks in 5 subjects. Validate inputs using exception handling. Calculate
average and
assign grade (A/B/C/Fail).
13.Read all lines from a text file and write them in reverse order to a new file.
14.Write a function that validates a password based on these rules: Minimum 8 characters, At
least one uppercase, one lowercase, one digit, one special character.
15. Create a class Person with name and age. Inherit Employee from Person and add
employee ID and salary. Implement methods to display full info.
Level 3 – Expert (Advanced Application and Logic) – 10 Questions
1. Implement the Sieve of Eratosthenes to generate prime numbers up to N.
2. Build a file logger class that appends logs with timestamps to a log file.
3. Write a program that raises and handles a custom exception class InvalidAgeError.
4. Create and import a custom module that implements matrix addition and
multiplication.
5. Implement a generic stack ADT with error handling and method encapsulation.
6. Design a class hierarchy: Shape (base), Rectangle, Circle, with area() as abstract
method.
7. Overload arithmetic operators (+, -, *) in a Vector2D class.
8. Build a student grading system with inheritance and use of super().
9. Design an ADT to support modular addition and multiplication. Ensure only integers
are accepted, and use assert to validate modulus > 0.
10. Create a class that implements multiple inheritance and resolves method conflicts
using super().
Level 4 – Competitive Coding – Beginner (Entry-Level Platform Problems) –
25 Questions
1. Check if a number is prime using Sieve of Eratosthenes .
2. Given a string, check if it's a valid palindrome ignoring non-alphanumeric characters.
3. Remove duplicates from a sorted list.
4. Find the intersection of two arrays.
5. Find the first non-repeating character in a string.
6. Implement binary search on a sorted array.
7. Calculate factorial using recursion.
8. Find GCD of two numbers using Euclidean algorithm.
9. Return the count of set bits in an integer.
10. Reverse the words in a given sentence.
11. Check if two strings are anagrams.
12. Merge two sorted arrays into a single sorted array.
13. Find the missing number in an array of size N with values from 0 to N.
14. Calculate the power of a number using iterative multiplication.
15. Sort an array using bubble sort.
16. Implement queue using two stacks.
17. Find the second largest element in a list.
18. Determine if a year is a leap year.
19. Remove vowels from a string.
20. Count the number of words in a paragraph.
21. Convert a string to title case.
22. Return the maximum occurring character in a string.
23. Find the longest word in a given list of words.
24. Check if a list is a palindrome.
25. Print the multiplication table for numbers 1 to 10.
Level 5 – Competitive Coding – Moderate – 15 Questions
1. Find the longest substring without repeating characters.
2. Rotate a matrix by 90 degrees clockwise.
3. Implement Kadane’s Algorithm for maximum subarray sum.
4. Check if a string can be rearranged to form a palindrome.
5. Count the number of islands in a binary matrix using DFS.
6. Detect a cycle in a directed graph using DFS.
7. Implement Dijkstra’s algorithm for shortest path.
8. Evaluate an arithmetic expression using stack (Infix to Postfix conversion).
9. Implement LRU Cache using OrderedDict.
10. Perform level-order traversal of a binary tree.
11. Find the Kth largest element using heap.
12. Count number of 1s in a sorted binary array using binary search.
13. Solve the N-Queens problem (basic backtracking).
14. Use prefix sum technique to find subarray with a given sum.
15. Implement a basic file compressor using Run Length Encoding.
Level 6 – Competitive Coding – Expert – 10 Questions
1. Implement a Trie with insert(word), search(word), and startsWith(prefix)
methods.
Test Case:
trie = Trie()
trie.insert("apple")
assert trie.search("apple") == True
assert trie.search("app") == False
assert trie.startsWith("app") == True
trie.insert("app")
assert trie.search("app") == True
2. Given two words and a dictionary, return the length of the shortest transformation
sequence.
Test Case:
beginWord = "hit"
endWord = "cog"
wordList = ["hot","dot","dog","lot","log","cog"]
assert ladderLength(beginWord, endWord, wordList) == 5
3. Implement Disjoint Set Union (DSU) with path compression and union by rank.
Test Case:
uf = UnionFind(5)
uf.union(0, 1)
uf.union(1, 2)
assert uf.find(0) == uf.find(2)
assert uf.find(3) != uf.find(2)
4. Given weighted edges, return the weight of the MST.
Test Case:
n = 4
edges = [(0, 1, 10), (0, 2, 6), (0, 3, 5), (1, 3, 15), (2, 3, 4)]
assert kruskalMST(n, edges) == 19
5. Given edges, detect if the graph has a cycle.
Test Case:
edges = [(0, 1), (1, 2), (2, 0)]
assert hasCycle(3, edges) == True
6. Implement a segment tree to answer sum queries in range [l, r].
Test Case:
arr = [1, 3, 5]
st = SegmentTree(arr)
assert st.range_sum(0, 2) == 9
st.update(1, 2)
assert st.range_sum(0, 2) == 8
7. Given a partially filled Sudoku board, complete it.
Test Case: Sudoku board input as 2D list with '.' for blanks.
8. Implement the KMP algorithm to find if pattern exists in text.
Test Case:
assert kmp_search("abxabcabcaby", "abcaby") == True
9. Return minimum number of operations to convert word1 to word2.
Test Case:
assert minDistance("horse", "ros") == 3
10. Create a decorator to log execution time of a function.
Test Case: Decorate a sleep-based function and print its duration.