Skip to main content

Introduction to Programming MCQs with Answers

Practice important Introduction to Programming MCQs with answers and explanations.

Multiple Choice Questions

Q101: What will happen if the value of the variable used in the 'while' condition does not change?
  • A: The loop becomes an infinite loop
  • B: The loop will execute only once
  • C: The loop will execute zero times
  • D: The loop will produce an error
View Answer
A

Q102: What is the output of the sample program if the user inputs 10 as the upper limit?
  • A: The sum of even numbers is 30
  • B: The sum of even numbers is 25
  • C: The sum of even numbers is 20
  • D: The sum of even numbers is 15
View Answer
A

Q103: Which of the following is NOT true about the 'while' loop?
  • A: 'while' loop can only execute more than once
  • B: 'while' loop must have a fixed number of repetitions
  • C: 'while' loop may execute zero times
  • D: 'while' loop executes exactly once
View Answer
C

Q104: How can you calculate the factorial of a given number in C?
  • A: By using a 'while' loop that multiplies decremented values of the number
  • B: By using a 'for' loop that multiplies decremented values of the number
  • C: By using a 'do-while' loop
  • D: By using a recursive function
View Answer
A

Q105: What is the significance of indentation in a 'while' loop?
  • A: To make the code easy to understand
  • B: To increase the execution speed
  • C: To reduce the number of statements
  • D: To make the code execute faster
View Answer
A

Q106: What is the result of the statement 'number = number + 1' in a loop?
  • A: It generates the next integer
  • B: It resets the loop
  • C: It decreases the number by 1
  • D: It multiplies the number by 1
View Answer
C

Q107: In a flowchart, which symbol represents a decision or condition?
  • A: Rectangle
  • B: Diamond
  • C: Circle
  • D: Triangle
View Answer
B

Q108: What should be done first, according to the text: coding the program or drawing the flowchart?
  • A: Coding the program
  • B: Drawing the flowchart
  • C: Both can be done simultaneously
  • D: Neither is necessary
View Answer
B

Q109: In a do-while loop, when is the condition evaluated?
  • A: Before the loop body executes
  • B: After the loop body executes
  • C: During each iteration of the loop
  • D: It is not evaluated
View Answer
B

Q110: What will the following do-while loop print if c is 'z' and tryNum is initially 0?
  • A: "Congratulations, Your guess is correct"
  • B: No output
  • C: The character 'z'
  • D: "Please enter a character between a-z"
View Answer
A

Test Your Knowledge

Take a timed quiz on Introduction to Programming

🚀 Start Quiz Now