40 Practice Questions for Test-1
1. Find Second Largest Element
Write a C program to find the second largest element in an array.
2. Reverse a String
Write a C program to reverse a given string.
3. Find GCD and LCM
Write a C program to compute the Greatest Common Divisor (GCD) and Least Common
Multiple (LCM) of two numbers.
4. Convert Decimal to Binary
Write a C program to convert a decimal number to binary.
5. Count Vowels and Consonants
Write a C program to count the number of vowels and consonants in a given string.
6. Reverse Words in a Sentence
Write a C program to reverse the words in a given sentence.
7. Find First Non-Repeating Character
Write a C program to find the first non-repeating character in a given string.
8. Student Marksheet
Write a C program to generate a student's marksheet, calculate the total, percentage, and
grade, and determine if the student has passed.
9. Remove Spaces from String
Write a C program to remove all spaces from a given string.
10. Find Sum of an Array
Write a C program to compute the sum of all elements in an array.
11. Check Prime Number
Write a C program to check whether a given number is prime or not.
12. Convert Binary to Decimal
Write a C program to convert a binary number to decimal.
13. Check Palindrome Number
Write a C program to check whether a given number is a palindrome.
14. Find Largest Element in Array
Write a C program to find the largest element in an array.
15. Check Armstrong Number
Write a C program to check if a given number is an Armstrong number.
16. Sort an Array
Write a C program to sort an array using the bubble sort algorithm.
17. Fibonacci Series
Write a C program to print the first N Fibonacci numbers.
18. Find Missing Number in Array
Write a C program to find the missing number in an array of N natural numbers.
19. Factorial of a Number
Write a C program to find the factorial of a given number using recursion.
20. Remove Duplicates from Array
Write a C program to remove duplicate elements from an array.
21. Count Pairs with Even Sum
Write a C program to count the number of pairs in an array whose sum is divisible by 2.
22. Matrix Multiplication
Write a C program to multiply two matrices.
23. Rotate Array to Left
Write a C program to rotate an array left by K positions.
24. Check Leap Year
Write a C program to check whether a given year is a leap year or not.
25. Matrix Addition
Write a C program to add two matrices.
26. Find Duplicate Number
Write a C program to find the duplicate number in an array.
27. Sum of First N Even Numbers
Write a C program to calculate the sum of the first N even numbers starting from 2.
28. Simple Calculator
Write a C program to implement a simple calculator that performs addition, subtraction,
multiplication, and division.
29. Transpose of a Matrix
Write a C program to find the transpose of a given matrix.
30. Check Palindrome String
Write a C program to check if a given string is a palindrome.
31. Find Substring in a String
Write a C program to find whether a given substring exists in a string.
32. Square Pattern with 1s and 0s
Write a C program to print an N × N square pattern where the border consists of 1s and
the inner elements are 0s.
33. Reverse an Array
Write a C program to reverse the elements of an array.
34. Merge Two Arrays
Write a C program to merge two sorted arrays into a single sorted array.
35. Convert Uppercase to Lowercase
Write a C program to convert all uppercase letters of a string to lowercase.
36. Rotate Array to Right
Write a C program to rotate an array right by K positions.
37. Find Sum of Digits
Write a C program to compute the sum of the digits of a given number.
38. Check Symmetric Matrix
Write a C program to check if a given matrix is symmetric.
39. String is Anagram
Write a C program to check whether two given strings are anagrams of each other.
40. Count Words in a String
Write a C program to count the number of words in a given sentence.