Skip to main content

Introduction to Programming MCQs with Answers

Practice important Introduction to Programming MCQs with answers and explanations.

Multiple Choice Questions

Q81: Which logical operator has a higher precedence in C?
  • A: ||
  • B: &&
  • C: ! (NOT)
  • D: != (NOT equal)
View Answer
B

Q82: What is the output if 'AmerAge' is 16 and 'AmaraAge' is 14, given the code 'if (AmerAge > AmaraAge) cout << "Amer is older than Amara";'?
  • A: Amer is younger than Amara
  • B: Amer is older than Amara
  • C: No output will be displayed
  • D: Syntax error
View Answer
B

Q83: If the amount is greater than 5000, which discount percentage is applied in the sample program?
  • A: 10%
  • B: 15%
  • C: 5%
  • D: 0%
View Answer
B

Q84: Why should you use '15.0' instead of '15' when calculating the discount in C?
  • A: To ensure correct integer division
  • B: To avoid truncation in the division result
  • C: To make the code more readable
  • D: To avoid division by zero
View Answer
B

Q85: What will happen if you don’t use braces { } after an 'if' statement in C?
  • A: The code may give an error
  • B: Only the first statement after 'if' will execute
  • C: All the statements after 'if' will execute
  • D: None of the statements will execute
View Answer
B

Q86: Which statement correctly initializes a variable in C?
  • A: int x;
  • B: float x;
  • C: int x = 0;
  • D: char x = 'A';
View Answer
C

Q87: What is the purpose of the 'else' block in an if/else structure?
  • A: To define an alternative action if the 'if' condition is false
  • B: To execute only when the 'if' condition is true
  • C: To execute only when both conditions are true
  • D: To check multiple conditions
View Answer
A

Q88: What does 'cin >>' do in C?
  • A: It takes input from the user
  • B: It displays output on the screen
  • C: It compares two values
  • D: It assigns a value to a variable
View Answer
A

Q89: What is the correct way to check if a value is not equal to 5 in C?
  • A: if (x == 5)
  • B: if (x != 5)
  • C: if (x = 5)
  • D: if (x => 5)
View Answer
B

Q90: Which of the following is an example of repetition in real life?
  • A: Days and nights repeating monthly
  • B: Seasons replacing each other yearly
  • C: Payroll system procedures
  • D: All of the above
View Answer
D

Test Your Knowledge

Take a timed quiz on Introduction to Programming

🚀 Start Quiz Now