TypeScript - JavaScript's Superset | Fresco Play

TypeScript - JavaScript's Superset | Fresco Play

Monday, May 22, 2023
~ 5 min read
TypeScript - JavaScript's Superset | Fresco Play

Question 1: Typescript compiler tsc converts code to

Answer: JavaScript


Question 2: TypeScript is

Answer: Object Oriented


Question 3: TypeScript is a -

Answer: Super-set of JavaScript


Question 4: We can rename a .js file to .ts file generally

Answer: True


Question 5: The value of TypeScript is writing

Answer: Safer code


Question 6: TypeScript was made public by

Answer: Microsoft


Question 7: A JavaScript file cannot be renamed to a TypeScript file

Answer: False


Question 8: During run time, __checking is done

Answer: Dynamic Type


Question 9: Which type is assigned to variables with null type

Answer: None of these


Question 10: Annotations can be implemented as

Answer: length: number


Question 11: Generics allows to accept arguments of

Answer: Different types


Question 12: Type Annotations allows us to

Answer: Record the intended contract of the function or variable.


Question 13: A type system is a set of

Answer: Rules


Question 14: Static type checking is done at

Answer: Compilation time


Question 15: Generics are _

Answer: Template


Question 16: Which of the following is the right way of defining enum?

Answer: All of these


Question 17: Syntax for a decorator is

Answer: @symbol


Question 18: Which of the two is used appropriately in JavaScript code:

Answer: function reverse(s: string) : string;


Question 19: var jarvis = function (x: number, y?: number): number {} showcases

Answer: Both


Question 20: Inheritance is implemented by using which keyword?

Answer: extends


Question 21: Which of the following is the wrong way of defining variables in TypeScript

Answer: var 10231


Question 22: Which keyword is used for Inheritance in TypeScript?

Answer: extends


Question 23: Which of the following are inherited from base class?

Answer: all of these


Question 24: Which keywork is used to access base class properties?

Answer: super


Question 25: The code snippet " if (value && typeof value == "string") {}; is used for _

Answer: Overloading


Question 26: TypeScript uses prototypical inheritance instead of classical inheritance.

Answer: False


Question 27: Compiled .js of .ts containing class will also have class.

Answer: False


Question 28: Accessing a class of a module from outside is impossible in TypeScript.

Answer: False


Question 29: Likewise other elements, Interface of TypeScript is usually converted to JavaScript.

Answer: False


Question 30: Contextual typing in TypeScript is a form of

Answer: Type Inference


Question 31: Decorators provides a way for

Answer: Both


Question 32: Which of the following is a wrong way to declare the variable in TypeScript?

Answer: var 2


Question 33: What is the form associated with @expression?

Answer: Decorators


Question 34: Optional parameter can be defined by using "?".

Answer: True


Question 35: Which one of the following code snippet is safer?

Answer: function fn(x: () => void) { x(); }


Question 36: How can we access a class of module from outside?

Answer: By using "export"


Question 37: Enum organises

Answer: Set of related values


Question 38: During compilation, TypeScript code gets converted to assembly language.

Answer: False


Question 39: _ in command line enables experimental support for decorators.

Answer: " tsc –target ES5 –experimentalDecorators "


Question 40: Type System is a

Answer: Set of Rules


Question 41: Which is not a type that TypeScript supports

Answer: integer


Question 42: What is true about Mixins in TypeScript?

Answer: All


Question 43: Why optional parameters are added?

Answer: not To avoid assigning value for parameterised variable


Question 44: “any” is type of generic.

Answer: False


Question 45: any type is assigned to the variable in case of

Answer: "Zero" or "0" assigned to the variable


Question 46: Which is not a type that TypeScript supports?

Answer: enum (wrong anser)


Question 47: During compilation time, _______checking is done.

Answer: static


Question 48: TypeScript is a open source programming language.

Answer: TRUE


Question 49: To a declaration, at most how many decorators can be applied?

Answer: Only one per declaration


Question 50: Which of the following demonstrates function overloading, if possible, in TypeScript?

Answer: var a = function (n1: number, n3?: number) : number{}


Question 51: What type of checking does Java programming language use?

Answer: static


Question 52: value && typeof value == "DataType" is used for

Answer: Overloading


Question 53: What does " function f(l: number, w: number){} " demonstrate?

Answer: Type annotation


Question 54: Dynamic type checking is done at __________.

Answer: Run time


Post a comment

Comments

Join the conversation and share your thoughts! Leave the first comment.

Get your FREE PDF on "100 Ways to Try ChatGPT Today"

Generating link, please wait for: 60 seconds

Checkout all hot deals now 🔥

Search blogs

No blog posts found