Narrowing & Guards interview questions

18 Narrowing & Guards questions from the TypeScript 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 Type narrowing?

Mid
  1. A.narrowing a value to a class type using the instanceof operator
  2. B.a union of object types sharing a literal tag property that the compiler uses to narrow between them
  3. C.narrowing by checking whether a given property key exists on an object
  4. D.refining a broader type to a more specific one within a particular code branch

Answer + AI explanation with Pro

2. Which term means: "refining a broader type to a more specific one within a particular code branch"?

Mid
  1. A.Type narrowing
  2. B.in operator guard
  3. C.User-defined type guard
  4. D.Discriminated union

Answer + AI explanation with Pro

3. Which statement is correct?

Mid
  1. A.Type narrowing — narrowing a union by checking a value's primitive type with typeof
  2. B.Type narrowing — a union of object types sharing a literal tag property that the compiler uses to narrow between them
  3. C.Type narrowing — narrowing by checking whether a given property key exists on an object
  4. D.Type narrowing — refining a broader type to a more specific one within a particular code branch

Answer + AI explanation with Pro

4. What is typeof guard?

Junior
  1. A.narrowing by checking whether a given property key exists on an object
  2. B.narrowing a value to a class type using the instanceof operator
  3. C.a union of object types sharing a literal tag property that the compiler uses to narrow between them
  4. D.narrowing a union by checking a value's primitive type with typeof

Answer + AI explanation with Pro

5. Which term means: "narrowing a union by checking a value's primitive type with typeof"?

Junior
  1. A.instanceof guard
  2. B.typeof guard
  3. C.in operator guard
  4. D.Type narrowing

Answer + AI explanation with Pro

6. Which statement is correct?

Junior
  1. A.typeof guard — refining a broader type to a more specific one within a particular code branch
  2. B.typeof guard — narrowing a union by checking a value's primitive type with typeof
  3. C.typeof guard — narrowing a value to a class type using the instanceof operator
  4. D.typeof guard — a union of object types sharing a literal tag property that the compiler uses to narrow between them

Answer + AI explanation with Pro

7. What is instanceof guard?

Mid
  1. A.refining a broader type to a more specific one within a particular code branch
  2. B.narrowing a value to a class type using the instanceof operator
  3. C.narrowing a union by checking a value's primitive type with typeof
  4. D.a function whose return type is arg is T, telling the compiler the argument is a specific type

Answer + AI explanation with Pro

8. Which term means: "narrowing a value to a class type using the instanceof operator"?

Mid
  1. A.typeof guard
  2. B.Type narrowing
  3. C.instanceof guard
  4. D.Discriminated union

Answer + AI explanation with Pro

9. Which statement is correct?

Mid
  1. A.instanceof guard — a union of object types sharing a literal tag property that the compiler uses to narrow between them
  2. B.instanceof guard — a function whose return type is arg is T, telling the compiler the argument is a specific type
  3. C.instanceof guard — narrowing a value to a class type using the instanceof operator
  4. D.instanceof guard — narrowing a union by checking a value's primitive type with typeof

Answer + AI explanation with Pro

10. What is in operator guard?

Mid
  1. A.narrowing a union by checking a value's primitive type with typeof
  2. B.narrowing a value to a class type using the instanceof operator
  3. C.a function whose return type is arg is T, telling the compiler the argument is a specific type
  4. D.narrowing by checking whether a given property key exists on an object

Answer + AI explanation with Pro

11. Which term means: "narrowing by checking whether a given property key exists on an object"?

Mid
  1. A.instanceof guard
  2. B.in operator guard
  3. C.typeof guard
  4. D.User-defined type guard

Answer + AI explanation with Pro

12. Which statement is correct?

Mid
  1. A.in operator guard — narrowing a union by checking a value's primitive type with typeof
  2. B.in operator guard — narrowing by checking whether a given property key exists on an object
  3. C.in operator guard — refining a broader type to a more specific one within a particular code branch
  4. D.in operator guard — narrowing a value to a class type using the instanceof operator

Answer + AI explanation with Pro

13. What is Discriminated union?

Senior
  1. A.a function whose return type is arg is T, telling the compiler the argument is a specific type
  2. B.narrowing a value to a class type using the instanceof operator
  3. C.a union of object types sharing a literal tag property that the compiler uses to narrow between them
  4. D.narrowing a union by checking a value's primitive type with typeof

Answer + AI explanation with Pro

14. Which term means: "a union of object types sharing a literal tag property that the compiler uses to narrow between them"?

Senior
  1. A.instanceof guard
  2. B.in operator guard
  3. C.User-defined type guard
  4. D.Discriminated union

Answer + AI explanation with Pro

15. Which statement is correct?

Senior
  1. A.Discriminated union — a union of object types sharing a literal tag property that the compiler uses to narrow between them
  2. B.Discriminated union — refining a broader type to a more specific one within a particular code branch
  3. C.Discriminated union — a function whose return type is arg is T, telling the compiler the argument is a specific type
  4. D.Discriminated union — narrowing a value to a class type using the instanceof operator

Answer + AI explanation with Pro

16. What is User-defined type guard?

Senior
  1. A.a union of object types sharing a literal tag property that the compiler uses to narrow between them
  2. B.narrowing a union by checking a value's primitive type with typeof
  3. C.a function whose return type is arg is T, telling the compiler the argument is a specific type
  4. D.narrowing a value to a class type using the instanceof operator

Answer + AI explanation with Pro

17. Which term means: "a function whose return type is arg is T, telling the compiler the argument is a specific type"?

Senior
  1. A.instanceof guard
  2. B.Discriminated union
  3. C.in operator guard
  4. D.User-defined type guard

Answer + AI explanation with Pro

18. Which statement is correct?

Senior
  1. A.User-defined type guard — narrowing a union by checking a value's primitive type with typeof
  2. B.User-defined type guard — a function whose return type is arg is T, telling the compiler the argument is a specific type
  3. C.User-defined type guard — a union of object types sharing a literal tag property that the compiler uses to narrow between them
  4. D.User-defined type guard — narrowing a value to a class type using the instanceof operator

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 Narrowing & Guards 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