Comp.
Science - 11th IB Holiday Homework
Name _____________________________ Sec _________________ Date ________________
Solve all questions in your notebook.
Section 1: Basic Programming Logic (15 Questions)
1. Write a program to find the sum of the first 10 natural numbers.
2. Write a program to find the product of digits of a given number.
3. Write a program to reverse a number (e.g., input: 123, output: 321).
4. Write a program to check whether a number is a palindrome.
5. Write a program to find the factorial of a number using a loop.
6. Write a program to print the multiplication table of a given number.
7. Write a program to find the sum of squares of the first N numbers.
8. Write a program to count the number of digits in a number.
9. Write a program to print all even numbers from 1 to 100.
10. Write a program to print the first N odd numbers.
11. Write a program to find the largest digit in a number.
12. Write a program to calculate the average of N numbers entered by the user.
13. Write a program to check whether a number is Armstrong (e.g., 153).
14. Write a program to print a right-angle triangle pattern using numbers.
15. Write a program to print a pyramid of stars (*) for N rows.
Section 2: String Manipulation (20 Questions)
16. Write a program to count the number of vowels in a string.
17. Write a program to count the number of consonants in a string.
18. Write a program to reverse a string.
19. Write a program to convert a string to uppercase.
20. Write a program to convert a string to lowercase.
21. Write a program to count the number of words in a sentence.
22. Write a program to check whether a string is a palindrome.
23. Write a program to find the number of digits in a string.
24. Write a program to count the frequency of a particular character in a string.
25. Write a program to print each character of the string on a new line.
26. Write a program to extract and print only the vowels from a string.
27. Write a program to replace all spaces in a string with hyphens.
28. Write a program to print the ASCII value of each character in a string.
29. Write a program to check if a string contains only alphabets.
30. Write a program to count the number of uppercase and lowercase letters in a string.
31. Write a program to remove all spaces from a string.
32. Write a program to count how many times each vowel occurs in a string.
33. Write a program to find the first and last characters of a string.
34. Write a program to concatenate two strings without using built-in functions.
35. Write a program to print characters at even positions in a string.
Section 3: Loops with Strings and Numbers (15 Questions)
36. Write a program to print all prime numbers from 1 to 100.
37. Write a program to check if a given number is prime.
38. Write a program to print the Fibonacci series up to N terms.
39. Write a program to find the sum of digits of a number using a while loop.
40. Write a program to check if a string contains both uppercase and lowercase letters.
41. Write a program to print characters between 'A' and 'Z' using a loop.
42. Write a program to print a string character by character using a for loop.
43. Write a program to print all factors of a given number.
44. Write a program to convert a sentence to title case (first letter capital of each word).
45. Write a program to count the number of punctuation marks in a string.
46. Write a program to count the number of white spaces in a string.
47. Write a program to print characters of a string in reverse order using a loop.
48. Write a program to count the number of times the word “the” appears in a sentence.
49. Write a program to convert all vowels in a string to uppercase and the rest to lowercase.
50. Write a program to check if all characters in a string are the same.