HomeSubjectsUniversityBlogAbout

Algorithms & Flow Control

Topic in Problem Solving & Analytical Skills

210 total MCQsShowing 30 with explanations10 Easy10 Medium10 Hard

About This Topic

An algorithm is a finite, unambiguous sequence of steps that solves a problem, and flow control decides the order in which those steps execute. Questions focus on flowchart symbols, pseudocode, the three basic structures of sequence, selection and iteration, and the behaviour of if-else chains, switch statements and nested conditions. You will also trace loops, compare pre-test (while) and post-test (do-while) loops, spot infinite loops caused by a termination condition that is never met, and reason about break, continue and recursion. Advanced items touch control flow graphs in compiler optimization, exception-driven flow and continuations.

Below are 30 practice questions from a pool of 210 Algorithms & Flow Control MCQs, one of 16 topics in Problem Solving & Analytical Skills. Each shows the correct answer with an explanation; when you are ready, take a timed quiz to test recall under exam conditions.

Practice Questions

Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.

Algorithms & Flow ControlEasy

Q1. What is a flowchart for?

  1. A.Creating user interface layouts
  2. B.Designing database table schemas
  3. C.Visually representing algorithm steps✓ Correct
  4. D.Writing executable source code

Explanation

Visual representation of algorithm steps.

Report an error in this question

Algorithms & Flow ControlEasy

Q2. Which symbol is a decision?

  1. A.Diamond✓ Correct
  2. B.Parallelogram
  3. C.Rectangle
  4. D.Oval

Explanation

Diamond = decision.

Report an error in this question

Algorithms & Flow ControlEasy

Q3. Which symbol is a process?

  1. A.Arrow
  2. B.Oval
  3. C.Diamond
  4. D.Rectangle✓ Correct

Explanation

Rectangle = process.

Report an error in this question

Algorithms & Flow ControlEasy

Q4. What does an oval represent?

  1. A.Process
  2. B.Decision
  3. C.Start or End✓ Correct
  4. D.Input/Output

Explanation

Oval = terminal.

Report an error in this question

Algorithms & Flow ControlEasy

Q5. What is pseudocode?

  1. A.A specific programming language
  2. B.Informal high-level algorithm description✓ Correct
  3. C.Machine-readable binary code
  4. D.Directly executable source code

Explanation

Informal algorithm description.

Report an error in this question

Algorithms & Flow ControlEasy

Q6. Three basic control structures?

  1. A.Start, Process, End
  2. B.Create, Read, Delete
  3. C.Sequence, Selection, Iteration✓ Correct
  4. D.Input, Output, Storage

Explanation

Sequence, selection, iteration.

Report an error in this question

Algorithms & Flow ControlEasy

Q7. What is sequence?

  1. A.Skipping steps entirely
  2. B.Repeating a set of steps
  3. C.Steps in random order
  4. D.Steps one after another in order✓ Correct

Explanation

Sequential execution in order.

Report an error in this question

Algorithms & Flow ControlEasy

Q8. What does selection do?

  1. A.Skips all code entirely
  2. B.Executes all paths at once
  3. C.Chooses paths based on condition✓ Correct
  4. D.Repeats code multiple times

Explanation

Chooses paths based on conditions.

Report an error in this question

Algorithms & Flow ControlEasy

Q9. What does iteration do?

  1. A.Stops the program entirely
  2. B.Deletes all variable values
  3. C.Executes code only once
  4. D.Repeats while condition is true✓ Correct

Explanation

Repeats code while condition holds.

Report an error in this question

Algorithms & Flow ControlEasy

Q10. Which symbol is input/output?

  1. A.Circle
  2. B.Parallelogram✓ Correct
  3. C.Rectangle
  4. D.Diamond

Explanation

Parallelogram = I/O.

Report an error in this question

Algorithms & Flow ControlMedium

Q11. While vs do-while?

  1. A.While only runs the loop body once
  2. B.Do-while never actually executes code
  3. C.While checks first; do-while runs once✓ Correct
  4. D.They are exactly the same construct

Explanation

While pre-tests; do-while post-tests.

Report an error in this question

Algorithms & Flow ControlMedium

Q12. Connector symbol indicates?

  1. A.A terminal or endpoint state
  2. B.Continuation on another page✓ Correct
  3. C.A decision point in the flow
  4. D.An input or output operation

Explanation

Flowchart continues elsewhere.

Report an error in this question

Algorithms & Flow ControlMedium

Q13. What is a nested loop?

  1. A.A loop inside another loop✓ Correct
  2. B.A loop that runs just once
  3. C.A loop with no condition
  4. D.A loop that never ends

Explanation

Inner loop completes per outer iteration.

Report an error in this question

Algorithms & Flow ControlMedium

Q14. for i=1 to 5 executes how many times?

  1. A.5 times✓ Correct
  2. B.6 times
  3. C.0 times
  4. D.4 times

Explanation

1 to 5 inclusive = 5.

Report an error in this question

Algorithms & Flow ControlMedium

Q15. What is an infinite loop?

  1. A.Condition never becomes false✓ Correct
  2. B.A very fast loop execution
  3. C.A loop that runs just twice
  4. D.A loop with an empty body

Explanation

Condition never met for termination.

Report an error in this question

Algorithms & Flow ControlMedium

Q16. What is a sentinel value?

  1. A.A random value in the data
  2. B.Special value signaling end of input✓ Correct
  3. C.An error code returned by functions
  4. D.A variable name in the program

Explanation

Signals loop termination.

Report an error in this question

Algorithms & Flow ControlMedium

Q17. What does break do?

  1. A.Skips to the next iteration
  2. B.Restarts the loop from start
  3. C.Pauses the loop temporarily
  4. D.Immediately exits the loop✓ Correct

Explanation

Exits the innermost loop.

Report an error in this question

Algorithms & Flow ControlMedium

Q18. What does continue do?

  1. A.Breaks out of all nested loops
  2. B.Skips rest, goes to next iteration✓ Correct
  3. C.Restarts the entire program run
  4. D.Exits the loop entirely now

Explanation

Skips to next iteration.

Report an error in this question

Algorithms & Flow ControlMedium

Q19. What is switch-case for?

  1. A.Handling errors and exceptions
  2. B.Selecting blocks based on a value✓ Correct
  3. C.Iterating through a collection
  4. D.Managing memory allocation tasks

Explanation

Selects code blocks by value.

Report an error in this question

Algorithms & Flow ControlMedium

Q20. x=0; while x<3: print x; x=x+1. Output?

  1. A.1 2 3
  2. B.1 2
  3. C.0 1 2 3
  4. D.0 1 2✓ Correct

Explanation

Prints 0,1,2 then x=3 fails condition.

Report an error in this question

Algorithms & Flow ControlHard

Q21. for i=1..3, j=1..2: print(i*j). Output?

  1. A.1 1 2 2 3 3
  2. B.1 2 2 4 3 6✓ Correct
  3. C.1 2 3 4 5 6
  4. D.2 4 6 8 10 12

Explanation

i=1:1,2; i=2:2,4; i=3:3,6.

Report an error in this question

Algorithms & Flow ControlHard

Q22. What is tail recursion?

  1. A.A recursion that never ends at all
  2. B.Last operation is the recursive call✓ Correct
  3. C.Recursion with multiple base cases
  4. D.A specific type of iterative loop

Explanation

Compiler can optimize to avoid stack overflow.

Report an error in this question

Algorithms & Flow ControlHard

Q23. Recursion vs iteration relationship?

  1. A.They are completely unrelated concepts
  2. B.Only recursion works for any problem
  3. C.Every recursive can become iterative✓ Correct
  4. D.Iteration is always faster than recursion

Explanation

Computationally equivalent.

Report an error in this question

Algorithms & Flow ControlHard

Q24. Factorial base case?

  1. A.n * factorial(n-1) recursive call
  2. B.factorial(n)=n for all values
  3. C.factorial(0)=1 or factorial(1)=1✓ Correct
  4. D.No base case is ever needed

Explanation

Stops the recursion.

Report an error in this question

Algorithms & Flow ControlHard

Q25. No base case means?

  1. A.The function runs much faster
  2. B.Stack overflow from infinite recursion✓ Correct
  3. C.The function gives correct results
  4. D.The function returns zero always

Explanation

Infinite recursion = stack overflow.

Report an error in this question

Algorithms & Flow ControlHard

Q26. What is mutual recursion?

  1. A.A function calling only itself
  2. B.Functions calling each other cyclically✓ Correct
  3. C.A loop nested inside a function
  4. D.Recursion without any base case

Explanation

Functions call each other in a cycle.

Report an error in this question

Algorithms & Flow ControlHard

Q27. Max depth for naive fibonacci(n)?

  1. A.n/2
  2. B.log n
  3. C.2^n
  4. D.n✓ Correct

Explanation

Deepest branch has depth n.

Report an error in this question

Algorithms & Flow ControlHard

Q28. What is a coroutine?

  1. A.A specific type of loop construct
  2. B.Can suspend and resume execution✓ Correct
  3. C.A normal sequential function call
  4. D.An error handler for exceptions

Explanation

Enables cooperative multitasking.

Report an error in this question

Algorithms & Flow ControlHard

Q29. What is short-circuit evaluation?

  1. A.Evaluating expressions in reverse order
  2. B.A hardware electrical circuit fault
  3. C.Always evaluate all operands fully
  4. D.Stop evaluating when result is known✓ Correct

Explanation

Stops when result is known.

Report an error in this question

Algorithms & Flow ControlHard

Q30. What is a basic block?

  1. A.A class definition in a program
  2. B.A function definition in code
  3. C.One entry, one exit, no branches✓ Correct
  4. D.Any arbitrary piece of code

Explanation

Straight-line sequence with single entry/exit.

Report an error in this question

Ready to test yourself on Algorithms & Flow Control?

Take a timed quiz drawn from 210+ questions on this topic. No signup required — your progress saves in your browser.

Start Algorithms & Flow Control Quiz