1) A JavaScript file cannot be renamed to a TypeScript file.
i) True
ii) False
Answer : False
2) TypeScript is a __________.
i) Dynamically type-checked language
ii) New version of JavaScript
iii) Compiler
iv) Super-set of JavaScript
Answer :Super-set of JavaScript
3) Typescript compiler tsc converts code to _________.
i) AngularJS
ii) JavaScript
iii) Machine Language
iv) Assembly Language
Answer: Machine Language
4) The value of TypeScript is writing _________.
i) Less code
ii) Safer code
5) TypeScript was made public by __________.
i) Oracle
ii) Microsoft --
iii) ECMA
iv) Sun
Answer: ii) Microsoft
6) During run time, _______ checking is done.
i) Dynamic Type
ii) Static Type
Answer: Dynamic Type
7) Annotations can be implemented as __________.
i) length=12
ii) static length=12
iii) length: number
iv) var lengthC='1'
Answer: length: number
8) Which type is assigned to variables with null type?
i) any
ii) boolean
iii) None of the options
iv) string
Answer: None of the options
9) Type Annotations allow us to _______.
i) Reassign the type of data
ii) Record the intended contract of the function or variable
iii) Cast to a supertype
iv) Cast a reference of a base class to one of its derived classes
Answer: Record the intended contract of the function or variable
10) A type system is a set of ________.
i) Predefined Functions
ii) Rules
iii) Data
iv) Variables
Answer: Rules
11) Static type checking is done at ________.
i) Compilation time
ii) Run time
Answer: Compilation time
12) Generics allows accepting arguments of _________.
i) Different types
ii) None of the options
iii) Only one type
Answer: i) Different types
13) Generics allows accepting arguments of _________.
i) Only one type
ii) None of the options
iii) Different types
Answer: iii) Different types
14) Which of the following is the right way of defining enum?
i) const enum DNA {}
ii) declare enum Enum {}
iii) enum Enum {}
iv) All the options
Answer: iv) All the options
15) Generics is a/an _______.
i) Template
ii) Object
iii) Functions
iv) Class
Answer: i) Template
16) " var jarvis = function (x: number, y?: number): number {} " showcases _________.
i) Both the options
ii) Defining Parameter
iii) Type annotation
Answer: i) Both the options
17) Inheritance is implemented by using the ________ keyword.
i) None of the options
ii) extends
iii) implements
iv) namespace
Answer: ii) extends
18) Syntax for a decorator is _________.
i) ?symbol{}
ii) @symbol
iii) #symbol
iv) *(symbol)
Answer: ii) @symbol
19) The following are correct ways of defining variables in TypeScript, except _________.
i) var DNA:string
ii) var NumberOfDNA=10231
iii) var 10231
iv) var DNA:string= "CGATAATCGGGGAATTTCAG"
Answer: iii) var 10231
20) value && typeof value == "DataType" is used for _________.
i) Inheritance
ii) Overriding
iii) Type annotation
iv) Overloading
Answer: iv) Overloading
21) Which of the options is used appropriately in JavaScript code?
i) function reverse(s: string) : string;
ii) function reverse (s: String) : String;
Answer: i) function reverse(s: string) : string;
22) TypeScript uses prototypical inheritance instead of classical inheritance.
i) False
ii) True
Answer: i) False
23) Which keyword is used to access base class properties?
i) extends
ii) implements
iii) super
iv) base
Answer: iv) base
24) The code snippet " if (value && typeof value == "string") {}; is used for ______________.
i) Parameterising
ii) Inheritance add-on
iii) Overriding
iv) Overloading
Answer: iv) Overloading
25) Which keyword is used for Inheritance in TypeScript?
i) implements
ii) defines
iii) extends
iv) follows
Answer: iii) extends
26) Which of the following is/are inherited from base class?
i) variables
ii) Both the options
iii) method
Answer: ii) Both the options
27) _________ in the command line enables experimental support for decorators.
i) "experimentalDecorators": true XXX
ii) "compilerOptions": {}
iii) "target": "ES5"
iv) " tsc –target ES5 –experimentalDecorators "
Answer: iv) " tsc –target ES5 –experimentalDecorators "
28) What is the form associated with @expression?
i) None of the options
ii) Decorators
iii) Module initialisation
iv) Constructors
Answer: ii) Decorators
29) The optional parameter can be defined by using "?".
i) False
ii) True
Answer: ii) True
Type System is a _____________.
i) Scripting Language
ii) Programming Language
iii) Compiler
iv) Set of rules
Answer: iv) Set of rules
30) The following are ways to declare a variable in TypeScript, except ________.
i) var 2
ii) var lengthB:string
iii) var localLength=13
iv) var lengthA:string = "meter"
Answer: i) var 2
31) Accessing a class of a module from outside is impossible in TypeScript.
i) False
ii) True
Answer: i) False
32) Decorators provide a way for ________________.
i) None of the options
ii) Both the options
iii) Meta-programming syntax
iv) Annotation
Answer: ii) Both the options
33) What is true about Mixins in TypeScript?
i) Each class is focused on a particular activity
ii) All the options
iii) They are mixed together to form a new class
iv) They are partial classes
Answer: ii) All the options
34) Which of the following demonstrates function overloading, if possible, in TypeScript?
i) var a = function (n1: number, n3?: number) : number{}
ii) if (value && typeof value == "number"){}
iii) var f = 0;
iv) get len():string
Answer: ii) if (value && typeof value == "number"){}
The following types are supported by TypeScript, except
35) The following types are supported by TypeScript, except ______.
i) enum
ii) string
iii) boolean
iv) integer
Answer: iv) integer
36) Enum organizes a _______.
i) Set of un-related values
ii) Set of related values
Answer: ii) Set of related values
37) Generics allows accepting arguments of _________.
i) Different types
ii) None of the options
iii) Only one type
38) TypeScript is an open source programming language.
i) False
ii) True
Answer: ii) True
39) Contextual typing in TypeScript is a form of ___________.
i) Type Inference
ii) Inheritence
iii) Type Checking
iv) It does not exist
Answer: i) Type Inference
40) Why are optional parameters added?
i) To assure that value is always assigned to the variable
ii) To add more than three parameters
iii) To avoid assigning value for parameterised variable
iv) To avoid confusion
Answer: iii) To avoid assigning value for parameterised variable
41) During compilation, TypeScript code gets converted to assembly language.
i) False
ii) True
Answer: i) False
42) We can rename a .js file to .ts file generally.
i) False
ii) True
Answer : ii) True