Unit5 - Subjective Questions

INT219 • Practice Questions with Detailed Answers

1

What is TypeScript and how does it relate to JavaScript?

2

Explain the key benefits of using TypeScript in front-end development.

3

Describe the concept of Type Annotations in TypeScript with examples.

4

Differentiate between the any, unknown, and void types in TypeScript.

5

What is a Tuple in TypeScript and how is it different from an Array?

6

Explain the concept of Interfaces in TypeScript. How do optional and readonly properties work within an interface?

7

Compare and contrast Interfaces and Type Aliases.

8

Describe Union Types in TypeScript. Provide a scenario where they are useful.

9

What are Intersection Types? How are they represented syntactically?

10

Explain the concept of Generics in TypeScript. Why are they considered a crucial feature for reusable code?

11

Write a TypeScript function using Generics to create a generic class Box that can store a value of any type.

12

Explain Generic Constraints using the extends keyword.

13

What is Type Inference in TypeScript? Give examples of when it occurs.

14

Explain Type Narrowing and describe how typeof and instanceof are used as Type Guards.

15

What are Discriminated Unions? How do they aid in type narrowing?

16

Describe the TypeScript Compilation Workflow.

17

What is the role of tsconfig.json? List and explain three common compiler options.

18

Explain the significance of the strictNullChecks flag in TypeScript configuration.

19

How do Enum types work in TypeScript? Provide an example of a numeric enum.

20

Explain the concept of Literal Types and how they relate to Union types.