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

C++ Questions

The document provides a comprehensive list of basic C++ programming questions and exercises, categorized into various topics such as very basic programs, variables and data types, input using cin, operators, conditional statements, switch statements, looping statements, pattern programs, functions, arrays, and short theory/viva questions. Each category includes multiple programming tasks aimed at reinforcing fundamental C++ concepts. This resource serves as a guide for beginners to practice and enhance their C++ programming skills.

Uploaded by

hagyi157
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)
4 views4 pages

C++ Questions

The document provides a comprehensive list of basic C++ programming questions and exercises, categorized into various topics such as very basic programs, variables and data types, input using cin, operators, conditional statements, switch statements, looping statements, pattern programs, functions, arrays, and short theory/viva questions. Each category includes multiple programming tasks aimed at reinforcing fundamental C++ concepts. This resource serves as a guide for beginners to practice and enhance their C++ programming skills.

Uploaded by

hagyi157
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

BASIC C++ PROGRAMMING

QUESTIONS
1. Very Basic Programs (Starter Level)
1. Write a C++ program to print “Hello World”.
2. Write a program to display your name, roll number, and branch.
3. Write a program to demonstrate the use of cout.
4. Write a program to display two lines of text using a single cout statement.
5. Write a program to print numbers from 1 to 10.

2. Variables and Data Types


6. Write a C++ program to declare and print an integer, float, and character variable.
7. Write a program to find the sum of two integers.
8. Write a program to find the average of three numbers.
9. Write a program to calculate simple interest.
10. Write a program to calculate the area of a circle.

3. Input Using cin


11. Write a program to accept two numbers using cin and display their sum.
12. Write a program to input a number and display its square and cube.
13. Write a program to input length and breadth and find the area of a rectangle.
14. Write a program to accept marks of a student and display them.
15. Write a program to input temperature in Celsius and convert it to Fahrenheit.

4. Operators
16. Write a program to demonstrate arithmetic operators.
17. Write a program to demonstrate relational operators.
18. Write a program to demonstrate logical operators.
19. Write a program to check whether a number is positive or negative.
20. Write a program to check whether a number is even or odd.
5. Conditional Statements (if / if-else)
21. Write a program to find the greater of two numbers.
22. Write a program to find the largest of three numbers.
23. Write a program to check whether a student has passed or failed.
24. Write a program to check whether a year is a leap year.
25. Write a program to check whether a number is divisible by 5 and 11.

6. switch Statement
26. Write a program to implement a simple calculator using switch.
27. Write a program to display day of the week using switch.
28. Write a program to display month name based on month number.
29. Write a program to perform menu-driven operations using switch.

7. Looping Statements
for Loop

30. Write a program to print numbers from 1 to 10 using a for loop.


31. Write a program to print even numbers up to 100.
32. Write a program to find the sum of first n natural numbers.
33. Write a program to print the multiplication table of a number.

while Loop

34. Write a program to print numbers from 10 to 1 using a while loop.


35. Write a program to find the sum of digits of a number.
36. Write a program to count the number of digits in a number.

do-while Loop

37. Write a program to print numbers from 1 to 5 using do-while loop.


38. Write a program to display a menu until user exits.

8. Pattern Programs (Very Common in Exams)


39. Print the following pattern:
*
**
***
****

40. Print the following pattern:

1
12
123
1234

41. Print the following pattern:

****
***
**
*

9. Functions (Basics)
42. Write a C++ program to define and call a simple function.
43. Write a program to find the sum of two numbers using a function.
44. Write a program to find the factorial of a number using a function.
45. Write a program to check whether a number is prime using a function.
46. Write a program to demonstrate function with arguments and return value.

10. Arrays (Basic)


47. Write a program to store and display elements of an array.
48. Write a program to find the sum of array elements.
49. Write a program to find the largest element in an array.
50. Write a program to count even and odd elements in an array.

11. Short Theory / Viva Questions


51. What is C++?
52. What are tokens in C++?
53. What is the difference between cin and cout?
54. What is the purpose of using namespace std;?
55. What is the role of main() function?
56. What are data types?
57. What is a loop?
58. Difference between while and do-while loop.
59. What is a function?
60. Difference between C and C++.

You might also like