Randomized Programming Questions
37. Write a program to calculate the sum and average of elements in an array.
21. Write a function to calculate the greatest common divisor (GCD) of two numbers.
25. Write a function to count the number of vowels in a given string.
6. Write a program to find the largest of three numbers using if-else statements.
34. Write a program to count the number of set bits in an integer.
41. Write a program to add two vectors element-wise.
9. Write a program to classify a character as a vowel or a consonant.
36. Write a program to find the largest and smallest elements in an array.
44. Write a program to remove duplicates from a vector.
26. Write a program to convert a decimal number to binary.
46. Write a program to find the second largest element in an array using a loop.
22. Write a function to check if a number is palindrome.
5. Demonstrate type conversion (implicit and explicit) with examples.
1. Write a program to swap two variables without using a third variable.
45. Write a program to find the frequency of each element in a vector.
19. Write a program to print a Pascal's triangle pattern.
32. Write a program to check if a number is a power of 2 using bitwise operators.
17. Write a program to print a diamond pattern of stars.
2. Define a constant and demonstrate its usage in a program.
11. Write a program to print the first 10 natural numbers using a for loop.
48. Write a program to count the occurrences of each vowel in a given string.
35. Write a program to find the bitwise AND, OR, and XOR of two numbers.
30. Write a program to find the XOR of two binary numbers.
49. Write a program to print the binary representation of numbers from 1 to 10.
42. Write a program to find the dot product of two vectors.
29. Write a program to check if a binary number is a palindrome.
33. Write a program to swap two numbers using bitwise XOR.
15. Write a program to check if a number is a prime number.
14. Write a program to generate a multiplication table for a given number.
39. Write a program to check if an array is sorted in ascending order.
7. Write a program to check whether a number is even or odd.
16. Write a program to print a pyramid pattern of stars.
43. Write a program to sort a vector in descending order.
10. Write a program to check if a number is positive, negative, or zero.
18. Write a program to print an inverted right triangle pattern of numbers.
4. Write a program to print the size of various data types in your programming language.
3. Write a program to check if a given number is an integer or a floating-point number.
50. Write a program to generate all prime numbers less than a given number.
24. Write a function to find the sum of digits of a number.
20. Write a program to print a hollow square pattern.
28. Write a program to count the number of 1's in the binary representation of a number.
31. Write a program to toggle the bits of an integer.
47. Write a program to implement a calculator using functions.
23. Write a function to calculate the nth Fibonacci number.
40. Write a program to merge two sorted arrays into a single sorted array.
27. Write a program to perform binary addition of two numbers.
8. Write a program to determine if a year is a leap year.
12. Write a program to calculate the factorial of a number using a while loop.
13. Write a program to reverse a number using a loop.
38. Write a program to reverse an array.