Loops interview questions

15 real Loops questions from the Bash bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is For loop?

Junior
  1. A.a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
  2. B.a construct that repeats its body until a guarding command first succeeds, the logical inverse of the success-driven repeating loop
  3. C.an iteration construct that walks through a list of words one at a time, binding each to a loop variable for the body
  4. D.a line-by-line iteration pattern that pipes or redirects input into a builtin which assigns each line to variables for processing
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.For loop — a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
  2. B.For loop — a three-expression iteration form with initialization, a continuation condition, and an increment, enclosed in double parentheses
  3. C.For loop — an iteration construct that walks through a list of words one at a time, binding each to a loop variable for the body
  4. D.For loop — a line-by-line iteration pattern that pipes or redirects input into a builtin which assigns each line to variables for processing
Reveal the answer + AI explanation — free account

4. What is While loop?

Junior
  1. A.a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
  2. B.an iteration construct that walks through a list of words one at a time, binding each to a loop variable for the body
  3. C.a construct that repeats its body until a guarding command first succeeds, the logical inverse of the success-driven repeating loop
  4. D.a three-expression iteration form with initialization, a continuation condition, and an increment, enclosed in double parentheses
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.While loop — a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
  2. B.While loop — a construct that repeats its body until a guarding command first succeeds, the logical inverse of the success-driven repeating loop
  3. C.While loop — a line-by-line iteration pattern that pipes or redirects input into a builtin which assigns each line to variables for processing
  4. D.While loop — an iteration construct that walks through a list of words one at a time, binding each to a loop variable for the body
Reveal the answer + AI explanation — free account

7. What is Until loop?

Mid
  1. A.a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
  2. B.a three-expression iteration form with initialization, a continuation condition, and an increment, enclosed in double parentheses
  3. C.a line-by-line iteration pattern that pipes or redirects input into a builtin which assigns each line to variables for processing
  4. D.a construct that repeats its body until a guarding command first succeeds, the logical inverse of the success-driven repeating loop
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.Until loop — a line-by-line iteration pattern that pipes or redirects input into a builtin which assigns each line to variables for processing
  2. B.Until loop — an iteration construct that walks through a list of words one at a time, binding each to a loop variable for the body
  3. C.Until loop — a construct that repeats its body until a guarding command first succeeds, the logical inverse of the success-driven repeating loop
  4. D.Until loop — a three-expression iteration form with initialization, a continuation condition, and an increment, enclosed in double parentheses
Reveal the answer + AI explanation — free account

10. What is Read loop?

Mid
  1. A.a three-expression iteration form with initialization, a continuation condition, and an increment, enclosed in double parentheses
  2. B.a line-by-line iteration pattern that pipes or redirects input into a builtin which assigns each line to variables for processing
  3. C.a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
  4. D.a construct that repeats its body until a guarding command first succeeds, the logical inverse of the success-driven repeating loop
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.Read loop — a three-expression iteration form with initialization, a continuation condition, and an increment, enclosed in double parentheses
  2. B.Read loop — a line-by-line iteration pattern that pipes or redirects input into a builtin which assigns each line to variables for processing
  3. C.Read loop — a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
  4. D.Read loop — an iteration construct that walks through a list of words one at a time, binding each to a loop variable for the body
Reveal the answer + AI explanation — free account

13. What is C-style loop?

Senior
  1. A.a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
  2. B.a construct that repeats its body until a guarding command first succeeds, the logical inverse of the success-driven repeating loop
  3. C.an iteration construct that walks through a list of words one at a time, binding each to a loop variable for the body
  4. D.a three-expression iteration form with initialization, a continuation condition, and an increment, enclosed in double parentheses
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Senior
  1. A.C-style loop — an iteration construct that walks through a list of words one at a time, binding each to a loop variable for the body
  2. B.C-style loop — a three-expression iteration form with initialization, a continuation condition, and an increment, enclosed in double parentheses
  3. C.C-style loop — a line-by-line iteration pattern that pipes or redirects input into a builtin which assigns each line to variables for processing
  4. D.C-style loop — a construct that repeatedly runs its body for as long as a guarding command keeps returning a successful exit status
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Loops free