0% found this document useful (0 votes)
27 views5 pages

Sadhana Events Lists

Uploaded by

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

Sadhana Events Lists

Uploaded by

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

Scenarios based questions about coding in any programming languages

1. Reverse a String
Scenario: You are building a simple text reversal feature for a document editor.
Question: Write a function to reverse a given string.

2. Palindrome Check
Scenario: You are building a username validation feature and need to ensure the
username is not a palindrome.
Question: Write a function to check if a given string is a palindrome.

3. Count Numerical Digits in a String


Scenario: A text-based tool requires counting all numerical digits in a string.
Question: Write a function to count how many numerical digits are in a string.

4. Character Frequency Count


Scenario: You are developing an email content scanner that needs to count the
frequency of characters in a message.
Question: Write a function to count the occurrence of a specific character in a
string.

5. Find the Longest Word in a Sentence


Scenario: You are developing a word analyzer tool, and you need to find the longest
word in a given sentence.
Question: Write a function to find the longest word in a sentence.

6. Anagram Check
Scenario: You are developing a word game where the user has to unscramble an
anagram.
Question: Write a function to check if two strings are anagrams.

7. Count Vowels and Consonants


Scenario: You are building a language learning app that counts vowels and
consonants in a word.
Question: Write a function to count the number of vowels and consonants in a
string.

8. Find Maximum Element in an Array


Scenario: You are developing a program to find the largest number in a list of test
scores.
Question: Write a function to find the maximum element in an array of integers.

9. Sort an Array of Integers in Ascending Order


Scenario: You are building an app that sorts a list of user-submitted numbers.
Question: Write a function to sort an array of integers in ascending order.

10. Check if a Number is Prime


Scenario: You need to check if a number is prime for a math quiz application.
Question: Write a function to check if a number is prime.

11. Sum of Integers in an Array


Scenario: You need to calculate the total sum of elements in an array of prices.
Question: Write a function to find the sum of all integers in an array.

12. Find the Second Largest Element in an Array


Scenario: You need to find the second largest value in a series of test scores.
Question: Write a function to find the second largest element in an array.

13. Find the Missing Number in a Sequence


Scenario: You are building an app where users enter a series of numbers, and you
need to find the missing number.
Question: Write a function to find the missing number in an array of consecutive
numbers.

14. Reverse an Array


Scenario: You are creating a program that reverses the order of elements in an
array.
Question: Write a function to reverse an array.

15. Check if a String is an Empty String


Scenario: You are building a form validation system that checks if a user input
field is empty.
Question: Write a function to check if a string is empty.

16. Find the Common Elements Between Two Arrays


Scenario: You need to find the common items between two lists in a shopping cart.
Question: Write a function to find the common elements between two arrays.

17. Multiply All Elements in an Array


Scenario: You are building a simple calculator that multiplies all elements in an
array.
Question: Write a function to find the product of all elements in an array.

18. Check if a Number is Even or Odd


Scenario: You are creating a utility to classify numbers as even or odd for a
report.
Question: Write a function to check if a number is even or odd.

19. Print a Fibonacci Sequence


Scenario: You are building a number pattern generator that prints the Fibonacci
sequence.
Question: Write a function to print the first n Fibonacci numbers.

20. Find the Maximum Occurring Character


Scenario: You need to find the most frequently occurring character in a string.
Question: Write a function to find the maximum occurring character in a string.

21. Find the Factorial of a Number


Scenario: You need to implement a function that calculates the factorial of a given
number for a math tool.
Question: Write a function to calculate the factorial of a number.

22. Check for Balanced Parentheses


Scenario: You are building a simple calculator and need to validate if parentheses
are balanced in the expression.
Question: Write a function to check if the parentheses in a string are balanced.

23. Count the Occurrence of Words in a Sentence


Scenario: You are developing a content analysis tool that counts the frequency of
words in a sentence.
Question: Write a function to count the occurrence of each word in a sentence.

24. Find the Index of a Character in a String


Scenario: You need to locate the first occurrence of a character in a string for a
search functionality.
Question: Write a function to find the index of the first occurrence of a character
in a string.
25. Print a Pyramid Pattern
Scenario: You are building a program that generates a pyramid of stars for a
printing feature.
Question: Write a function to print a pyramid pattern of stars.

26. Find the Length of a String


Scenario: You are building a string manipulation tool that calculates the length of
the input.
Question: Write a function to find the length of a string without using the built-
in len() function.

27. Check if a String Contains a Substring


Scenario: You need to check if a specific word is part of a sentence in a search
engine.
Question: Write a function to check if a string contains a given substring.

28. Remove Duplicates from a List


Scenario: You need to remove duplicate items from a list of product IDs.
Question: Write a function to remove duplicates from an array.

29. Find the Smallest Element in an Array


Scenario: You are building a number analysis tool that finds the smallest value in
an array of numbers.
Question: Write a function to find the smallest element in an array.

30. Check if a String is a Valid Email


Scenario: You are building an email validation tool that checks if a string matches
a valid email pattern.
Question: Write a function to check if a string is a valid email address.

31. Merge Two Sorted Arrays


Scenario: You are building a merge function that combines two sorted arrays into
one sorted array.
Question: Write a function to merge two sorted arrays into a single sorted array.

32. Find the Frequency of Each Element in an Array


Scenario: You need to count how many times each number occurs in an array of
temperatures.
Question: Write a function to find the frequency of each element in an array.

33. Find the Common Elements in Three Arrays


Scenario: You need to find the common items in three shopping carts to prepare a
list of shared products.
Question: Write a function to find the common elements in three arrays.

34. Implement a Simple Calculator (Addition)


Scenario: You need to create a calculator that performs the addition of two
numbers.
Question: Write a function to add two numbers.

35. Sum of Digits in a Number


Scenario: You are building a number analysis tool to find the sum of digits in a
given number.
Question: Write a function to calculate the sum of digits of a number.

36. Print a Right-Angle Triangle Pattern


Scenario: You are designing a number pattern tool that prints a right-angle
triangle of stars.
Question: Write a function to print a right-angle triangle pattern of stars.
37. Check if Two Strings are Equal
Scenario: You are building a comparison tool that checks if two strings are
identical.
Question: Write a function to check if two strings are equal.

38. Remove All Whitespaces from a String


Scenario: You need to clean up user input by removing all spaces from a string.
Question: Write a function to remove all whitespaces from a string.

39. Convert a String to an Integer


Scenario: You need to implement a function that converts a string representing a
number into its integer equivalent.
Question: Write a function to convert a string to an integer.

40. Check if a Year is a Leap Year


Scenario: You are creating a calendar app and need to check if a year is a leap
year.
Question: Write a function to check if a given year is a leap year.

41. Sum of Even Numbers in an Array


Scenario: You need to calculate the sum of all even numbers in an array of
integers.
Question: Write a function to calculate the sum of even numbers in an array.

42. Find the GCD (Greatest Common Divisor)


Scenario: You need to calculate the greatest common divisor of two numbers for a
math application.
Question: Write a function to calculate the GCD of two numbers.

43. Find the Average of Numbers in an Array


Scenario: You are building a statistics calculator that finds the average of an
array of numbers.
Question: Write a function to calculate the average of numbers in an array.

44. Calculate the Power of a Number


Scenario: You need to calculate the result of raising a number to a certain power
for a math tool.
Question: Write a function to calculate the power of a number.

45. Find the Maximum Product of Two Numbers in an Array


Scenario: You need to find the maximum product of two numbers in an array for a
financial analysis tool.
Question: Write a function to find the maximum product of two numbers in an array.

46. Find the Missing Character in a String


Scenario: You need to identify the missing letter in a sequence of characters for a
game.
Question: Write a function to find the missing character in a given string.

47. Check for an Armstrong Number


Scenario: You are creating a number puzzle and need to check if a number is an
Armstrong number.
Question: Write a function to check if a number is an Armstrong number.

48. Find the Intersection of Two Lists


Scenario: You are merging two shopping carts and need to find the products common
to both.
Question: Write a function to find the intersection of two lists.
49. Rotate an Array by K Positions
Scenario: You need to rotate a list of numbers to the right by a given number of
positions for a circular buffer.
Question: Write a function to rotate an array by K positions.

50. Find the Sum of First N Natural Numbers


Scenario: You need to compute the sum of the first N natural numbers for a basic
arithmetic tool.
Question: Write a function to calculate the sum of the first N natural numbers.

You might also like