-
How do you declare a variable in TypeScript?
a) var x = 10;
b) let x = 10;
c) const x = 10;
-
What is the output of the following TypeScript code snippet?
let x: number = 10;
console.log(typeof x);
x = "hello";
console.log(typeof x);
a) number and string
b) string and number
c) number and any
-
Which TypeScript loop is used to iterate over the elements of an array?
a) for
b) while
c) for...of
-
In TypeScript, what is used to handle error conditions and exceptions?
a) try
b) catch
c) throw
-
What keyword is used in TypeScript to specify the type of a variable?
a) type
b) typeof
c) as
-
Which TypeScript module is used for date and time operations?
a) Date
b) datetime
c) moment
-
In which programming language is TypeScript primarily implemented?
a) JavaScript
b) Java
c) TypeScript
-
What will be the output of the following TypeScript code?
let a: number[] = [1, 2, 3];
let b: number[] = a;
b[0] = 5;
console.log(a.join(" "));
a) 1 2 3
b) 5 2 3
c) 1 5 3