wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Typescript class 02

Total questions: 26

Worksheet time: 9mins

Name
Class
Date
1.

What does TypeScript add to JavaScript that makes it more robust?

a)

Strongly-typed variables

b)

Dynamic typing

c)

Automatic memory management

d)

Built-in debugging tools

2.

What is the purpose of TypeScript's "Type Declaration"?

a)

To define the types of data a variable can hold

b)

To declare a new variable

c)

To perform type casting

d)

To add comments to the code

3.

Typescript is

a)

interpreted language

b)

compiled language

4.

What does TypeScript add to JavaScript to help catch errors at compile time?

a)

Static typing

b)

Dynamic typing

c)

Runtime checks

d)

Enhanced performance

5.

In TypeScript, which keyword is used to declare a variable?

a)

let

b)

const

c)

var

d)

type

e)

variable

6.

Which of the following is used to indicate the type of a variable in TypeScript?

a)

typeOf

b)

isType

c)

:

d)

#

7.

What tool can you use to transpile TypeScript code into JavaScript code?

a)

TypeScript Compiler (tsc)

b)

JavaScript Transformer (jst)

c)

TypeScript Formatter (tsf)

d)

JavaScript Linter (eslint)

8.

Javascript is a subset of Typescript

a)

True

b)

False

9.

JSON is

a)

Used to store data

b)

Used to transfer Data

c)

File format

d)

Used to maintain the version of packages

e)

Used for Configuration setting

10.

Our project is dependent on some packages (called as dependencies) and these packages are dependent on some other dependencies and those dependencies are further dependent on some other dependencies and so on these are called as

(a)  

11.

What is node module in our project?

a)

store your all packages

b)

all the dependencies are inside the node module

c)

it manage the version of our project

d)

it lock all the packages

e)

None of above

12.

What is the shortest program of javascript?

(a)  

13.

What is an output of this code?
const a = "Quiz 1"

a = "Quiz cancel"

a = "Quiz postponed"

console.log(a)

a)

Quiz 1

b)

Quiz cancel

c)

Quiz postponed

d)

Error

14.

What is an output of this code?
let var1 = "Typescript Cheety"

var1 = "23"

console.log(var1)

a)

Type Number is not assignable to Type string

b)

23

c)

Typescript Cheety

d)

Error

15.

Below code is in Typescript file and is an example of ?
let var1 = "Typescript Cheety"

var1 = "Python Cheety"

console.log(var1)

a)

Type Inferance

b)

Explicit Typing

c)

Dynamic Typing

d)

None of Above

16.

The JSON object is written inside curly braces { }

a)

True

b)

False

17.

JSON object is only used in javascript and typescript language.

a)

True

b)

False

18.

JSON is similar to Javascript object.

a)

True

b)

False

19.

As JSON is similar to javscript object so we can access it using dot notation

a)

True

b)

False

20.

What is an output of this code?

let var1 : string = "Pakistani Developers "

let var2 : string = "are number "

let var3 : string = "1"


console.log(var1 + var2 + var3)

a)

Number is not assignable to type string

b)

Error: Strings cannot be added together

c)

Pakistani Developers are number 1

d)

None of above

21.

What is an output of this code?

let var1 : string = "Welcome to programming"

var1 = 101

console.log(var1)

a)

Welcome to programming

b)

101

c)

Welcome to programming 101

d)

Type number is not assignable to type string

22.

We can reassign value to a variable that initialize with const

a)

True

b)

False

23.

We can reassign value to a variable that initialize with let

a)

True

b)

False

24.

What is an output of this code in typescript file?

let var1;

var1 = "Welcome to typescript class"

var1 = 23

var1 = false

console.log(var1)

a)

Welcome to typescript class

b)

23

c)

false

d)

Error

25.

What typescript compiler infer the datatype in below code

let value = null;

a)

Unknown

b)

void

c)

any

d)

undefined

e)

null

26.

What is an output of below code?

let value : null = 101;

console.log(value)

a)

101

b)

null

c)

undefined

d)

Error