Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q51: What data type should be used to store the age of a student in the program?
- A: int
- B: float
- C: double
- D: char
View Answer
A
Q52: How many variables are used to store the age of ten students in the provided program?
- A: 5
- B: 10
- C: 15
- D: 20
View Answer
B
Q53: What is the purpose of the cin statement in the C++ program?
- A: To display output on the screen
- B: To perform arithmetic operations
- C: To get input from the user
- D: To exit the program
View Answer
C
Q54: Which of the following is the correct statement to calculate the average age of 10 students?
- A: AverageAge = TotalAge / 10;
- B: AverageAge = TotalAge * 10;
- C: AverageAge = TotalAge + 10;
- D: AverageAge = TotalAge - 10;
View Answer
A
Q55: What will be the output of the program if the average age is 12.3 but the variables are of type int?
- A: 12.3
- B: 12
- C: 13
- D: Error
View Answer
B
Q56: Which operator is used to get the last digit of a number in the program that separates digits of a 4-digit number?
- A: /
- B: %
- C: *
- D: +
View Answer
B
Q57: In the expression x = a * (x + b * (y + c * z * z)), which operation is performed first?
- A: a * x
- B: b * (y + c * z * z)
- C: (y + c * z * z)
- D: c * z * z
View Answer
D
Q58: Which function is used to display text and variables on the screen in C++?
- A: cin
- B: printf
- C: cout
- D: scanf
View Answer
C
Q59: What is the value of TotalAge if the ages of the students are 12, 13, 14, 15, 16, 17, 18, 19, 20, and 21?
- A: 155
- B: 160
- C: 165
- D: 170
View Answer
C
Q60: How do you calculate the diameter of a circle in the given program?
- A: diameter = radius * 3.14;
- B: diameter = radius + radius;
- C: diameter = radius * 2;
- D: diameter = 2 * 3.14 * radius;
View Answer
C