Introduction to Computing MCQs with Answers
Practice important Introduction to Computing MCQs with answers and explanations.
Multiple Choice Questions
Q1761: Which line in the example code executes when CGPA is less than 3.0?
- A: cout << "Give Scholarship";
- B: cout << "Sorry you do not qualify for the scholarship";
- C: float f = 3.5;
- D: The entire if-else block
View Answer
B
Q1762: What will be the output of the code if CGPA is exactly 3.0?
- A: "Give Scholarship"
- B: "Sorry you do not qualify for the scholarship"
- C: "Scholarship granted"
- D: "No output"
View Answer
A
Q1763: Fill in the blank: The if-else statement in the code is used to ______ based on the CGPA value.
- A: Print different messages
- B: Declare different variables
- C: Change the value of CGPA
- D: Execute a loop
View Answer
A
Q1764: What is the role of the else block in the example?
- A: To print "Give Scholarship"
- B: To handle cases where the if condition is false
- C: To initialize the CGPA variable
- D: To execute a loop
View Answer
B
Q1765: In the example code, what would happen if cout was replaced with printf?
- A: The output would be formatted differently
- B: The code would result in an error
- C: The output would remain the same
- D: printf would not be recognized
View Answer
A
Q1766: What does the while loop in the example code do?
- A: It prints numbers from 1 to 5
- B: It increments the value of i only once
- C: It initializes the value of i to 5
- D: It exits immediately after the first iteration
View Answer
A
Q1767: How many times will the while loop execute in the given code?
- A: 4
- B: 5
- C: 6
- D: 7
View Answer
B
Q1768: Fill in the blank: In the while loop example, the loop terminates when the value of i ______.
- A: Is greater than 5
- B: Is less than 5
- C: Equals 5
- D: Is equal to 6
View Answer
A
Q1769: Which line of code increments the value of i in the while loop example?
- A: i = i + 1;
- B: cout << i;
- C: while(i <= 5)
- D: int i = 1;
View Answer
A
Q1770: What will be printed by the code in the while loop when i reaches 6?
- A: "1 2 3 4 5"
- B: "1 2 3 4 5 6"
- C: "1 2 3 4 5 6 "
- D: "6"
View Answer
A