Closures interview questions

15 Closures questions from the Swift bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Free to start: the 2-minute IT readiness check — six questions and a result.

Take the free IT readiness check

or take a mock interview set up for this area

1. What is Closure?

Junior
  1. A.the way a block grabs and retains outside constants and variables it references
  2. B.a self-contained block of code that can be passed around and captures references from its surrounding scope
  3. C.the default for a block guaranteed to run before the enclosing function returns, allowing optimizations
  4. D.syntax that moves a function's final block argument outside the parentheses for readability

Answer + AI explanation with Pro

2. Which term means: "a self-contained block of code that can be passed around and captures references from its surrounding scope"?

Junior
  1. A.Trailing closure
  2. B.Variable capture
  3. C.non-escaping
  4. D.Closure

Answer + AI explanation with Pro

3. Which statement is correct?

Junior
  1. A.Closure — an attribute marking a block that may be stored and called after the function it was passed to returns
  2. B.Closure — a self-contained block of code that can be passed around and captures references from its surrounding scope
  3. C.Closure — syntax that moves a function's final block argument outside the parentheses for readability
  4. D.Closure — the way a block grabs and retains outside constants and variables it references

Answer + AI explanation with Pro

4. What is Trailing closure?

Mid
  1. A.a self-contained block of code that can be passed around and captures references from its surrounding scope
  2. B.the default for a block guaranteed to run before the enclosing function returns, allowing optimizations
  3. C.syntax that moves a function's final block argument outside the parentheses for readability
  4. D.an attribute marking a block that may be stored and called after the function it was passed to returns

Answer + AI explanation with Pro

5. Which term means: "syntax that moves a function's final block argument outside the parentheses for readability"?

Mid
  1. A.escaping
  2. B.non-escaping
  3. C.Trailing closure
  4. D.Closure

Answer + AI explanation with Pro

6. Which statement is correct?

Mid
  1. A.Trailing closure — an attribute marking a block that may be stored and called after the function it was passed to returns
  2. B.Trailing closure — the default for a block guaranteed to run before the enclosing function returns, allowing optimizations
  3. C.Trailing closure — syntax that moves a function's final block argument outside the parentheses for readability
  4. D.Trailing closure — a self-contained block of code that can be passed around and captures references from its surrounding scope

Answer + AI explanation with Pro

7. What is escaping?

Senior
  1. A.syntax that moves a function's final block argument outside the parentheses for readability
  2. B.the way a block grabs and retains outside constants and variables it references
  3. C.an attribute marking a block that may be stored and called after the function it was passed to returns
  4. D.the default for a block guaranteed to run before the enclosing function returns, allowing optimizations

Answer + AI explanation with Pro

8. Which term means: "an attribute marking a block that may be stored and called after the function it was passed to returns"?

Senior
  1. A.escaping
  2. B.Closure
  3. C.Trailing closure
  4. D.non-escaping

Answer + AI explanation with Pro

9. Which statement is correct?

Senior
  1. A.escaping — an attribute marking a block that may be stored and called after the function it was passed to returns
  2. B.escaping — the way a block grabs and retains outside constants and variables it references
  3. C.escaping — the default for a block guaranteed to run before the enclosing function returns, allowing optimizations
  4. D.escaping — a self-contained block of code that can be passed around and captures references from its surrounding scope

Answer + AI explanation with Pro

10. What is non-escaping?

Senior
  1. A.a self-contained block of code that can be passed around and captures references from its surrounding scope
  2. B.the default for a block guaranteed to run before the enclosing function returns, allowing optimizations
  3. C.syntax that moves a function's final block argument outside the parentheses for readability
  4. D.the way a block grabs and retains outside constants and variables it references

Answer + AI explanation with Pro

11. Which term means: "the default for a block guaranteed to run before the enclosing function returns, allowing optimizations"?

Senior
  1. A.non-escaping
  2. B.Closure
  3. C.Variable capture
  4. D.escaping

Answer + AI explanation with Pro

12. Which statement is correct?

Senior
  1. A.non-escaping — syntax that moves a function's final block argument outside the parentheses for readability
  2. B.non-escaping — the way a block grabs and retains outside constants and variables it references
  3. C.non-escaping — an attribute marking a block that may be stored and called after the function it was passed to returns
  4. D.non-escaping — the default for a block guaranteed to run before the enclosing function returns, allowing optimizations

Answer + AI explanation with Pro

13. What is Variable capture?

Mid
  1. A.the default for a block guaranteed to run before the enclosing function returns, allowing optimizations
  2. B.the way a block grabs and retains outside constants and variables it references
  3. C.syntax that moves a function's final block argument outside the parentheses for readability
  4. D.an attribute marking a block that may be stored and called after the function it was passed to returns

Answer + AI explanation with Pro

14. Which term means: "the way a block grabs and retains outside constants and variables it references"?

Mid
  1. A.Trailing closure
  2. B.Closure
  3. C.escaping
  4. D.Variable capture

Answer + AI explanation with Pro

15. Which statement is correct?

Mid
  1. A.Variable capture — the default for a block guaranteed to run before the enclosing function returns, allowing optimizations
  2. B.Variable capture — the way a block grabs and retains outside constants and variables it references
  3. C.Variable capture — syntax that moves a function's final block argument outside the parentheses for readability
  4. D.Variable capture — a self-contained block of code that can be passed around and captures references from its surrounding scope

Answer + AI explanation with Pro

Free to start

Start with a free readiness check

Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Closures question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers