Introduction to Computing MCQs with Answers
Practice important Introduction to Computing MCQs with answers and explanations.
Multiple Choice Questions
Q1751: Fill in the blank: The statement if (marks >= 50) { print("You have passed"); } else { print("You have failed"); } will print "You have failed" if ______.
- A: marks is greater than 50
- B: marks is less than 50
- C: marks is equal to 50
- D: marks is greater than or equal to 50
View Answer
B
Q1752: Which part of the if-else statement is executed when the condition is true?
- A: The else block
- B: Both StatementA and StatementB
- C: The if block
- D: None of the blocks
View Answer
C
Q1753: Fill in the blank: The if (condition) StatementA else StatementB construct is used to ______.
- A: Declare functions
- B: Handle conditional logic
- C: Initialize variables
- D: Import modules
View Answer
B
Q1754: What will happen if the condition in an if-else statement is false?
- A: StatementA will be executed
- B: StatementB will be executed
- C: Both statements will be executed
- D: The program will terminate
View Answer
B
Q1755: In the if-else statement, what happens if the condition is not met?
- A: StatementA is executed
- B: The program stops
- C: StatementB is executed
- D: The condition is reassessed
View Answer
C
Q1756: What is the result of the following pseudocode if marks is 45? if (marks>=50) { print("Pass"); } else { print("Fail"); }
- A: "Pass"
- B: "Fail"
- C: "marks is not valid"
- D: No output
View Answer
B
Q1757: What will be the output if CGPA is 2.9 in the following code: if (CGPA>=3.0) { cout<<"Give Scholarship"; } else { cout<<"Sorry you do not qualify for the scholarship"; }?
- A: "Give Scholarship"
- B: "Sorry you do not qualify for the scholarship"
- C: "Scholarship granted"
- D: "No output"
View Answer
B
Q1758: Fill in the blank: In the statement if (CGPA >= 3.0) { cout<<"Give Scholarship"; } else { cout<<"Sorry you do not qualify for the scholarship"; }, CGPA >= 3.0 is used to ______.
- A: Assign a value to CGPA
- B: Compare CGPA with 3.0
- C: Print a message
- D: Declare CGPA variable
View Answer
B
Q1759: What will be printed if CGPA is 3.5 in the provided code?
- A: "Give Scholarship"
- B: "Sorry you do not qualify for the scholarship"
- C: "Scholarship approved"
- D: "Scholarship not applicable"
View Answer
A
Q1760: Fill in the blank: The statement float f = 3.5; is used to ______.
- A: Declare a variable
- B: Compare values
- C: Print messages
- D: Assign scholarship eligibility
View Answer
A