1. What is TypeScript?
a) A framework
b) A markup language
c) A typed superset of JavaScript
d) A database query language
2. Which command compiles TypeScript to JavaScript?
a) ts-run
b) tsc
c) tscompile
d) npm run ts
3. Which file extension is used for TypeScript files?
a) .js
b) .ts
c) .tsx
d) .typescript
4. How do you specify a variable that can only be a number in TypeScript?
a) let num: Number
b) let num = number
c) let num: number
d) let num: int
5. Which of these is NOT a valid TypeScript data type?
a) number
b) boolean
c) float
d) any
6. What does the any type in TypeScript mean?
a) Variable must be a string
b) Can be any type
c) Only numbers allowed
d) Must be an object
7. Which keyword is used to define a class in TypeScript?
a) function
b) module
c) class
d) type
8. What is the purpose of interfaces in TypeScript?
a) Define object types
b) Control flow
c) Perform calculations
d) Handle exceptions
9. Which keyword is used to inherit a class in TypeScript?
a) inherits
b) extends
c) implements
d) super
10. What does readonly keyword do in TypeScript?
a) Makes a variable private
b) Makes a variable immutable after initialization
c) Allows writing only once per loop
d) Prevents redeclaration
11. How do you define an array of numbers in TypeScript?
a) let arr: [number]
b) let arr: number[]
c) let arr: array<number>
d) let arr: numbers
12. Which of the following allows you to create reusable type-safe components in TypeScript?
a) Modules
b) Namespaces
c) Generics
d) Inheritance
Sign in to your account