Typescript Programming Language

595 questions in the bank
Are you ready to take quiz?
Explore more
Logo
About the Quiz

Quiz will ask 20 randomly selected questions with allotted time of . You can take the quiz more than once. Once you submit the quiz, you can review how you have done, the correct the answers for each questions and the explanation for the correct the answer.

Quiz Topics

11 Modules

Basic Types

10 topics
1.

Any

10 questions
2.

Array

10 questions
3.

Boolean

10 questions
4.

Enum

10 questions
5.

Never

10 questions
6.

Null and Undefined

10 questions
7.

Number

10 questions
8.

String

10 questions
9.

Tuple

10 questions
10.

Void

10 questions

Functions

6 topics

Interfaces

6 topics

Classes

6 topics

Generics

5 topics

Modules

5 topics

Type Inference

4 topics

Advanced Types

6 topics

Decorators

5 topics

Error Handling

3 topics

Tooling and Best Practices

5 topics
Sample questions

Which of the following statements correctly defines a variable of type 'number' in TypeScript?

let num: number = '5';

let num: number = 5;

let num: number = 5.0;

let num: number = true;

What will be the output of the following code snippet: let a: number = 5; let b: number = 10; console.log(a + b);?

15

510

NaN

undefined

Which of the following is NOT a valid way to declare a number in TypeScript?

let num = 42;

let num: number = 42;

let num: number = '42';

let num: number | null = null;

What will be the result of the following expression in TypeScript: let x: number = 5; let y: number = 2; console.log(x / y);?

2.5

2

NaN

undefined

Which of the following statements about the 'number' type in TypeScript is true?

The 'number' type can represent both integer and floating-point numbers.

The 'number' type can represent only integers.

The 'number' type can represent NaN and Infinity.

The 'number' type cannot represent negative values.

Quiz Topics

11 Modules

Basic Types
10 topics
1.
Any
10 questions
2.
Array
10 questions
3.
Boolean
10 questions
4.
Enum
10 questions
5.
Never
10 questions
6.
Null and Undefined
10 questions
7.
Number
10 questions
8.
String
10 questions
9.
Tuple
10 questions
10.
Void
10 questions
Functions
6 topics
Interfaces
6 topics
Classes
6 topics
Generics
5 topics
Modules
5 topics
Type Inference
4 topics
Advanced Types
6 topics
Decorators
5 topics
Error Handling
3 topics
Tooling and Best Practices
5 topics