Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q61: What value of π (pi) is used in the circle calculation program?
- A: 3.14159
- B: 3.14
- C: 3.142
- D: 3.1
View Answer
B
Q62: Which C++ header file is included at the beginning of the provided programs?
- A:
- B:
- C:
- D:
View Answer
B
Q63: In the context of operator precedence, which of the following has the highest precedence?
- A: *
- B: +
- C: %
- D: /
View Answer
A
Q64: Which of the following is a valid statement to get input for a variable named age1 in C++?
- A: cin << age1;
- B: cin >> age1;
- C: cout >> age1;
- D: cout << age1;
View Answer
B
Q65: What is the purpose of using parentheses in complex arithmetic expressions in C++?
- A: To ignore the precedence of operators
- B: To decrease code readability
- C: To ensure correct order of evaluation
- D: To increase the number of operations
View Answer
C
Q66: If the user inputs the number 7531, what will be the first digit displayed by the program that separates digits of a 4-digit number?
- A: 1
- B: 7
- C: 3
- D: 5
View Answer
B
Q67: Which of the following statements correctly computes the area of a circle in the circle calculation program?
- A: area = 3.14 * radius * radius;
- B: area = 2 * radius * 3.14;
- C: area = 2 * 3.14 * radius;
- D: area = radius * radius * 2;
View Answer
A
Q68: What is the purpose of the modulus operator % in C++?
- A: Division
- B: Multiplication
- C: To find the remainder after division
- D: Addition
View Answer
C
Q69: Which of the following is NOT a recommended practice mentioned in the tips?
- A: Use descriptive names for variables
- B: Indent the code for better readability
- C: Use parentheses unnecessarily
- D: Reuse variables for better memory usage
View Answer
C
Q70: How is a variable reassigned a new value based on its previous value?
- A: By using the assignment operator =
- B: By using the equality operator ==
- C: By using cin
- D: By using cout
View Answer
A