Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views

Programming_Questions

PQ

Uploaded by

fihacaj811
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)
14 views

Programming_Questions

PQ

Uploaded by

fihacaj811
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
You are on page 1/ 3

Programming Questions

1. Write a program to swap two variables without using a third variable.

2. Define a constant and demonstrate its usage in a program.

3. Write a program to check if a given number is an integer or a floating-point number.

4. Write a program to print the size of various data types in your programming language.

5. Demonstrate type conversion (implicit and explicit) with examples.

6. Write a program to find the largest of three numbers using if-else statements.

7. Write a program to check whether a number is even or odd.

8. Write a program to determine if a year is a leap year.

9. Write a program to classify a character as a vowel or a consonant.

10. Write a program to check if a number is positive, negative, or zero.

11. Write a program to print the first 10 natural numbers using a for loop.

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.

14. Write a program to generate a multiplication table for a given number.

15. Write a program to check if a number is a prime number.

16. Write a program to print a pyramid pattern of stars.

17. Write a program to print a diamond pattern of stars.

18. Write a program to print an inverted right triangle pattern of numbers.

19. Write a program to print a Pascal's triangle pattern.

20. Write a program to print a hollow square pattern.

21. Write a function to calculate the greatest common divisor (GCD) of two numbers.
22. Write a function to check if a number is palindrome.

23. Write a function to calculate the nth Fibonacci number.

24. Write a function to find the sum of digits of a number.

25. Write a function to count the number of vowels in a given string.

26. Write a program to convert a decimal number to binary.

27. Write a program to perform binary addition of two numbers.

28. Write a program to count the number of 1's in the binary representation of a number.

29. Write a program to check if a binary number is a palindrome.

30. Write a program to find the XOR of two binary numbers.

31. Write a program to toggle the bits of an integer.

32. Write a program to check if a number is a power of 2 using bitwise operators.

33. Write a program to swap two numbers using bitwise XOR.

34. Write a program to count the number of set bits in an integer.

35. Write a program to find the bitwise AND, OR, and XOR of two numbers.

36. Write a program to find the largest and smallest elements in an array.

37. Write a program to calculate the sum and average of elements in an array.

38. Write a program to reverse an array.

39. Write a program to check if an array is sorted in ascending order.

40. Write a program to merge two sorted arrays into a single sorted array.

41. Write a program to add two vectors element-wise.

42. Write a program to find the dot product of two vectors.

43. Write a program to sort a vector in descending order.


44. Write a program to remove duplicates from a vector.

45. Write a program to find the frequency of each element in a vector.

46. Write a program to find the second largest element in an array using a loop.

47. Write a program to implement a calculator using functions.

48. Write a program to count the occurrences of each vowel in a given string.

49. Write a program to print the binary representation of numbers from 1 to 10.

50. Write a program to generate all prime numbers less than a given number.

You might also like