TypeScript MCQ Question answer

TypeScript MCQ Question answer

1.What is TypeScript?

a) A programming language

b) A framework

c) A library

d) A text editor

Answer: a) A programming language

2.What is the file extension for TypeScript files?

a) .ts

b) .js

c) .tsx

d) .tss

Answer: a) .ts

3.What is the main benefit of using TypeScript over JavaScript?

a) Improved performance

b) better code organization

c) Improved error handling

d) Better compatibility

Answer: c) Improved error handling

4.What is the difference between TypeScript and JavaScript?

a) TypeScript is a newer version of JavaScript

b) TypeScript is a completely different language

c) TypeScript is a strict superset of JavaScript

d) TypeScript is a subset of JavaScript

Answer: c) TypeScript is a strict superset of JavaScript

5.Can TypeScript be used in both front-end and back-end development?

a) Yes

b) No

Answer: a) Yes

6.What is a type in TypeScript?

a) A variable

b) A class

c) A function

d) A data type

Answer: d) A data type

7.What is the TypeScript compiler?

a) A tool that converts TypeScript code into JavaScript

b) A tool that checks for errors in TypeScript code

c) A tool that optimizes TypeScript code

d) A tool that runs TypeScript code

Answer: a) A tool that converts TypeScript code into JavaScript

8.What is type inference in TypeScript?

a) The process of automatically determining the type of a variable

b) The process of manually defining the type of a variable

c) The process of optimizing TypeScript code

d) The process of debugging TypeScript code

Answer: a) The process of automatically determining the type of a variable

9.What is the purpose of interfaces in TypeScript?

a) To define the shape of an object

b) To define the behavior of a class

c) To define the scope of a variable

d) To define the return type of a function

Answer: a) To define the shape of an object

10.What is a decorator in TypeScript?

a) A special syntax for defining class properties

b) A special syntax for defining

c) A decorator classes

d) Better compatibility

Answer: a) A special syntax for defining class properties

Read More: – Typescript Superset of JavaScript Fresco Play Hands-on Answer