0% found this document useful (0 votes)
8 views4 pages

40 Programming Questions

The document provides a list of programming tasks along with their inputs and expected outputs. It covers various topics such as number manipulation, string operations, array handling, and recursion. Each task is presented in a clear format, showcasing the functionality of different algorithms.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

40 Programming Questions

The document provides a list of programming tasks along with their inputs and expected outputs. It covers various topics such as number manipulation, string operations, array handling, and recursion. Each task is presented in a clear format, showcasing the functionality of different algorithms.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Reverse a Number
Input:
12345
Output:
54321

2. Check Palindrome Number


Input:
121
Output:
Palindrome

3. Armstrong Number
Input:
153
Output:
Armstrong

4. Factorial of a Number
Input:
5
Output:
120

5. Fibonacci Series (N terms)


Input:
6
Output:
0 1 1 2 3 5

6. Prime Number Check


Input:
7
Output:
Prime

7. Count Digits in Number


Input:
123456
Output:
6

8. Sum of Digits
Input:
1234
Output:
10

9. Swap Two Numbers Without Temp


Input:
a = 5
b = 10
Output:
a = 10
b = 5

10. Strong Number


Input:
145
Output:
Strong Number

11. Reverse a String


Input:
hello
Output:
olleh

12. Check Palindrome String


Input:
madam
Output:
Palindrome

13. Count Vowels and Consonants


Input:
hello
Output:
Vowels: 2
Consonants: 3

14. Remove Spaces From String


Input:
hello world
Output:
helloworld

15. Count Character Frequency


Input:
banana
Output:
b:1
a:3
n:2

16. Check Anagram


Input:
listen
silent
Output:
Anagram

17. Convert Lowercase to Uppercase


Input:
hello
Output:
HELLO

18. First Non-Repeating Character


Input:
swiss
Output:
w

19. Remove Duplicate Characters


Input:
programming
Output:
progamin

20. Count Words in String


Input:
Hello world from Java
Output:
4

21. Find Largest Element


Input:
[3,5,7,2,8]
Output:
8

22. Find Second Largest Element


Input:
[10,20,4,45,99]
Output:
45

23. Reverse an Array


Input:
[1,2,3,4,5]
Output:
[5,4,3,2,1]

24. Sum of Array Elements


Input:
[1,2,3,4]
Output:
10

25. Find Duplicate Elements


Input:
[1,2,3,2,4,5,1]
Output:
1 2

26. Sort Array (Ascending)


Input:
[5,3,8,1]
Output:
[1,3,5,8]

27. Find Missing Number


Input:
[1,2,3,5]
Output:
4

28. Merge Two Arrays


Input:
[1,2,3]
[4,5,6]
Output:
[1,2,3,4,5,6]

29. Remove Duplicates From Array


Input:
[1,1,2,3,3,4]
Output:
[1,2,3,4]

30. Find Minimum Element


Input:
[7,2,5,1,9]
Output:
1

31. Factorial using Recursion


Input:
5
Output:
120

32. Fibonacci using Recursion


Input:
5
Output:
0 1 1 2 3

33. Sum of Natural Numbers


Input:
5
Output:
15

34. Power of Number


Input:
2 3
Output:
8

35. Reverse String using Recursion


Input:
hello
Output:
olleh

36. Print Number Pattern (Right Triangle)


Input:
5
Output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

37. Print Reverse Number Pattern


Input:
5
Output:
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

38. Sum of Digits using Recursion


Input:
123
Output:
6

39. Check Palindrome using Recursion


Input:
madam
Output:
Palindrome

40. Binary Search using Recursion


Input:
Array: [1,2,3,4,5]
Key: 4
Output:
Found at index 3

You might also like