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.
A.narrowing a value to a class type using the instanceof operator
B.a union of object types sharing a literal tag property that the compiler uses to narrow between them
C.narrowing by checking whether a given property key exists on an object
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
A.Type narrowing
B.in operator guard
C.User-defined type guard
D.Discriminated union
Answer + AI explanation with Pro
3. Which statement is correct?
Mid
A.Type narrowing — narrowing a union by checking a value's primitive type with typeof
B.Type narrowing — a union of object types sharing a literal tag property that the compiler uses to narrow between them
C.Type narrowing — narrowing by checking whether a given property key exists on an object
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
A.narrowing by checking whether a given property key exists on an object
B.narrowing a value to a class type using the instanceof operator
C.a union of object types sharing a literal tag property that the compiler uses to narrow between them
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
A.instanceof guard
B.typeof guard
C.in operator guard
D.Type narrowing
Answer + AI explanation with Pro
6. Which statement is correct?
Junior
A.typeof guard — refining a broader type to a more specific one within a particular code branch
B.typeof guard — narrowing a union by checking a value's primitive type with typeof
C.typeof guard — narrowing a value to a class type using the instanceof operator
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
A.refining a broader type to a more specific one within a particular code branch
B.narrowing a value to a class type using the instanceof operator
C.narrowing a union by checking a value's primitive type with typeof
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
A.typeof guard
B.Type narrowing
C.instanceof guard
D.Discriminated union
Answer + AI explanation with Pro
9. Which statement is correct?
Mid
A.instanceof guard — a union of object types sharing a literal tag property that the compiler uses to narrow between them
B.instanceof guard — a function whose return type is arg is T, telling the compiler the argument is a specific type
C.instanceof guard — narrowing a value to a class type using the instanceof operator
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
A.narrowing a union by checking a value's primitive type with typeof
B.narrowing a value to a class type using the instanceof operator
C.a function whose return type is arg is T, telling the compiler the argument is a specific type
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
A.instanceof guard
B.in operator guard
C.typeof guard
D.User-defined type guard
Answer + AI explanation with Pro
12. Which statement is correct?
Mid
A.in operator guard — narrowing a union by checking a value's primitive type with typeof
B.in operator guard — narrowing by checking whether a given property key exists on an object
C.in operator guard — refining a broader type to a more specific one within a particular code branch
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
A.a function whose return type is arg is T, telling the compiler the argument is a specific type
B.narrowing a value to a class type using the instanceof operator
C.a union of object types sharing a literal tag property that the compiler uses to narrow between them
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
A.instanceof guard
B.in operator guard
C.User-defined type guard
D.Discriminated union
Answer + AI explanation with Pro
15. Which statement is correct?
Senior
A.Discriminated union — a union of object types sharing a literal tag property that the compiler uses to narrow between them
B.Discriminated union — refining a broader type to a more specific one within a particular code branch
C.Discriminated union — a function whose return type is arg is T, telling the compiler the argument is a specific type
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
A.a union of object types sharing a literal tag property that the compiler uses to narrow between them
B.narrowing a union by checking a value's primitive type with typeof
C.a function whose return type is arg is T, telling the compiler the argument is a specific type
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
A.instanceof guard
B.Discriminated union
C.in operator guard
D.User-defined type guard
Answer + AI explanation with Pro
18. Which statement is correct?
Senior
A.User-defined type guard — narrowing a union by checking a value's primitive type with typeof
B.User-defined type guard — a function whose return type is arg is T, telling the compiler the argument is a specific type
C.User-defined type guard — a union of object types sharing a literal tag property that the compiler uses to narrow between them
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.