[go: up one dir, main page]

0% found this document useful (0 votes)
3 views3 pages

Unit 3

Uploaded by

Khushboo Garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Unit 3

Uploaded by

Khushboo Garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Level 1 – Beginner (Basic understanding and application) – 25 Questions

1. Write a function to return the sum of two numbers.


2. Define a function that prints "Hello, World!".
3. Write a function to find the length of a string.
4. Concatenate two strings using a function.
5. Write a program to repeat a string 3 times using * operator.
6. Use indexing to print the first and last character of a string.
7. Use slicing to print the substring "gram" from the string "Programming".
8. Write a function that takes two numbers and returns their product.
9. Create a tuple with 3 elements and print it.
10. Unpack a tuple (10, 20, 30) into three variables.
11. Create a list of 5 elements and print it.
12. Append an element to a list.
13. Remove the last element from a list.
14. Create a set and add an element to it.
15. Create a dictionary with 2 key-value pairs.
16. Access the value of a specific key in a dictionary.
17. Write a function that checks if a number is even or odd.
18. Write a function with a default argument for greeting someone.
19. Demonstrate local vs global variable using a small example.
20. Find all occurrences of the word “is” using regular expression.
21. Create a list using list comprehension for numbers from 1 to 10.
22. Define a lambda function that adds 5 to a given number.
23. Use a lambda function with map to square a list of numbers.
24. Write a function that accepts another function as argument and calls it.
25. Create and print an empty list, tuple, dictionary, and set.

Level 2 – Moderate (Intermediate problem-solving) – 15 Questions

1. Write a function that returns the factorial of a number.


2. Write a function to reverse a string using slicing.
3. Count the number of vowels in a string using a function.
4. Write a program to remove duplicates from a list using sets.
5. Merge two dictionaries and print the result.
6. Write a function that returns True if a string is a palindrome.
7. Use filter() with lambda to get even numbers from a list.
8. Use map() and lambda to capitalize all words in a list.
9. Write a function to return the nth Fibonacci number.
10. Extract domain names from a list of email addresses using regex.
11. Write a function with variable number of keyword arguments.
12. Demonstrate how scope affects variable resolution with an example.
13. Create a list of squares of all odd numbers between 1 to 20.
14. Sort a dictionary by its values in descending order.
15. Demonstrate tuple unpacking in a loop of coordinates.
Level 3 – Expert (Advanced application and logic) – 10 Questions

1. Write a function to validate an email address using regular expressions.


2. Create a decorator that logs the execution time of a function.
3. Write a function to count word frequency in a string using dictionaries.
4. Simulate a shopping cart using a dictionary of items and quantities.
5. Implement a function that flattens a list of nested lists.
6. Use regular expressions to find dates in dd-mm-yyyy format in a string.
7. Write a higher-order function that returns a function to raise numbers to a power.
8. Implement LRU (Least Recently Used) cache using dictionary and list.
9. Use list comprehension with conditionals to filter prime numbers.
10. Create a function that returns another function to calculate area of shapes.

Level 4 – Competitive Coding – Beginner (Entry-level platform problems) – 25


Questions

1. Two Sum – Find two numbers that add up to a target.


2. Check if a string is a pangram.
3. Find the smallest missing positive integer in a list.
4. Print first non-repeating character in a string.
5. Merge two sorted lists.
6. Anagram check using dictionaries.
7. Count the frequency of elements in a list.
8. Convert a list of tuples into a dictionary.
9. Find common elements in two sets.
10. Write a regex pattern to extract phone numbers from a text.
11. Find all palindromic substrings in a given string.
12. Remove stopwords from a sentence using a list.
13. Find maximum occurring character in a string.
14. Implement custom sort of a list based on string length.
15. Flatten a dictionary with nested dictionaries.
16. Implement the Caesar cipher for encoding a string.
17. Determine if two words are anagrams using dictionary comparison.
18. Extract hashtags from a tweet using regular expressions.
19. Create a frequency table from a paragraph using dict.
20. Write a function to remove vowels from a string.
21. Write a function to find the intersection of two lists.
22. Generate Fibonacci series using list comprehension.
23. Simulate a basic calculator with keyword arguments.
24. Rotate a list by n positions.
25. Write a regex to extract all capitalized words.
Level 5 – Competitive Coding – Moderate – 15 Questions

1. Longest substring without repeating characters.


2. Count pairs with given sum using hashing.
3. Regular expression to validate password rules (length, digit, uppercase).
4. Implement caching with a dictionary (basic memoization).
5. Write a function to group words that are anagrams.
6. Implement recursive function with memoization for Fibonacci.
7. Create a function to serialize and deserialize a dictionary.
8. Find common prefixes in a list of strings.
9. Calculate number of unique substrings of a string.
10. Generate combinations of k elements from a list (without itertools).
11. Write a function to convert Roman numerals to integers.
12. Given a list of tasks with cooldown, schedule them with minimum time.
13. Design a lambda-based custom sort function for tuples by multiple keys.
14. Extract all valid IPv4 addresses using regex.
15. Write a function that returns a list of prime numbers using list comprehension.

Level 6 – Competitive Coding – Expert – 10 Questions

1. Regular Expression Matching (with support for . and *).


2. Build a mini Regex engine that supports ^, $, . and character classes.
3. Implement a Trie with prefix matching.
4. Develop a memoized recursive function for solving knapsack problem.
5. Write a program to generate all possible valid expressions with given digits and target
value.
6. Create a function that finds all regex matches and returns their spans in text.
7. Use closures to create a dynamic scoring function (adjustable weights).
8. Build a function chaining mechanism using lambdas.
9. Optimize dictionary lookups with a custom hash function.
10. Implement a regex engine to parse and evaluate arithmetic expressions.

You might also like