TypeScript - JavaScript's Superset Fresco Play MCQs Answers
All Question of the Quiz Present Below for Ease Use Ctrl + F to find the Question.
Quiz on Introduction to TypeScript
1.We can rename a .js file to .ts file generally.
- False
- True
Answer: 2)True
2.TypeScript is a __________.
- New version of JavaScript
- Compiler
- Dynamically type-checked language
- Super-set of JavaScript
Answer: 4)Super-set of JavaScript
3.A JavaScript file cannot be renamed to a TypeScript file.
- False
- True
Answer: 1)False
4.The value of TypeScript is writing _________.
- Safer code
- Less code
Answer: 1)Safer code
5.A JavaScript file cannot be renamed to a TypeScript file.
- False
- True
Answer: 1)False
6.Typescript compiler tsc converts code to _________.
- Assembly Language
- JavaScript
- Machine Language
- AngularJS
Answer: 2)JavaScript
7.TypeScript was made public by __________.
- Sun
- Microsoft
- Oracle
- ECMA
Answer: 2)Microsoft
8.TypeScript is __________.
- Functional
- Object Oriented
- Symbolic
- Procedural
Answer: 2)Object Oriented
Quiz on TypeScript Grammar
1.Static type checking is done at ________.
- Run time
- Compilation time
Answer: 2)Compilation time
2.Generics allows accepting arguments of _________.
- Only one type
- None of the options
- Different types
Answer: 3)Different types
3.Annotations can be implemented as __________.
- length: number
- length=12
- static length=12
- var lengthC='1'
Answer: 1)length: number
4.Which type is assigned to variables with null type?
- string
- None of the options
- boolean
- any
Answer: 2)None of the options
5.Type Annotations allow us to _______.
- Cast a reference of a base class to one of its derived classes
- Record the intended contract of the function or variable
- Cast to a supertype
- Reassign the type of data
Answer: 2)Record the intended contract of the function or variable
6.During run time, _______ checking is done.
- Dynamic Type
- Static Type
Answer: 1)Dynamic Type
7.A type system is a set of ________.
- Predefined Functions
- Data
- Rules
- Variables
Answer: 3)Rules
Quiz on Data Types
1.Generics is a/an _______.
- Class
- Object
- Template
- Functions
Answer: 3)Template
2.Which of the following is the right way of defining enum?
- enum Enum {}
- const enum DNA {}
- declare enum Enum {}
- All the options
Answer: 4)All the options
Quiz on Object Oriented Way of Approach
1.The following are correct ways of defining variables in TypeScript, except _________.
- var NumberOfDNA=10231
- var DNA:string
- var DNA:string= "CGATAATCGGGGAATTTCAG"
- var 10231
Answer: 4)var 10231
2.Inheritance is implemented by using the ________ keyword.
- implements
- extends
- namespace
- None of the options
Answer: 2)extends
3." var jarvis = function (x: number, y?: number): number {} " showcases _________.
- Defining Parameter
- Both the options
- Type annotation
Answer: 2)Both the options
4.Syntax for a decorator is _________.
- @symbol
- ?symbol{}
- *(symbol)
- #symbol
Answer: 1)@symbol
5.Which of the options is used appropriately in JavaScript code?
- function reverse(s: string) : string;
- function reverse (s: String) : String;
Answer: 1)function reverse(s: string) : string;
6.value && typeof value == "DataType" is used for _________.
- Overloading
- Type annotation
- Overriding
- Inheritance
Answer: 1)Overloading
7.Which of the two is used appropriately in JavaScript code:
- function reverse(s: string) : string;
- function reverse (s: String) : String;
Answer: 1)function reverse(s: string) : string;
Quiz on Inheritance & Polymorphism
1.Which keyword is used for Inheritance in TypeScript?
- follows
- extends
- defines
- implements
Answer: 2)extends
2.Which keyword is used to access base class properties?
- super
- extends
- base
- implements
Answer: 1)super
3.TypeScript uses prototypical inheritance instead of classical inheritance.
- True
- False
Answer: 2)False
4.Which of the following is/are inherited from base class?
- method
- Both the options
- variables
Answer: 2)Both the options
5.The code snippet " if (value && typeof value == "string") {}; is used for ______________.
- Parameterising
- Inheritance add-on
- Overriding
- Overloading
Answer: 4)Overloading
TypeScript Final Assessment
1.Accessing a class of a module from outside is impossible in TypeScript.
- False
- True
Answer: 1)False
2.How can we access a class of module from outside?
- namespace classToBeExported{}
- It is not possible in TypeScript due to safety concerns
- By using implements
- By using export
Answer: 4)By using export
3.How can we access a class from a module from outside?
- By using import
- By using export
- By using module
- By using namespace
Answer: 2)By using export
4.Why are optional parameters added?
- To assure that value is always assigned to the variable
- To avoid confusion
- To avoid assigning value for parameterised variable
- To add more than three parameters
Answer: 4)To add more than three parameters
5.What is the form associated with @expression?
- None of the options
- Constructors
- Module initialisation
- Decorators
Answer: 4)Decorators
6.The following types are supported by TypeScript, except ______.
- boolean
- enum
- string
- integer
Answer: 4)integer
7.Compiled .js of .ts containing class will also have class.
- False
- True
Answer: 1)False
8.What does " function f(l: number, w: number){} " demonstrate?
- Type annotation
- Reassigning data type
- Namespace
- Modules
Answer: 1)Type annotation
9.Contextual typing in TypeScript is a form of ___________.
- It does not exist
- Type Inference
- Type Checking
- Inheritence
Answer: 2)Type Inference
10._________ in the command line enables experimental support for decorators.
- "target": "ES5"
- "experimentalDecorators": true
- "compilerOptions": {}
- "tsc --target ES5 --experimentalDecorators"
Answer: 4)"tsc --target ES5 --experimentalDecorators"
11.During compilation time, ________ checking is done.
- Static type
- Dynamic type
Answer: 1)Static type
12.Decorators provide a way for ________________.
- None of the options
- Annotation
- Meta-programming syntax
- Both the options
Answer: 4)Both the options
13.At most, how many decorators can be applied to a declaration?
- Only one per declaration
- Three
- Multiple
- Only one in a single line
Answer: 2)Three
14.Type System is a _____________.
- Compiler
- Scripting Language
- Programming Language
- Set of rules
Answer: 4)Set of rules
15.any type is assigned to the variable in case of _____________________.
- not initialising nor defining the type of variable
- not initialising the variable
- "Zero" or "0" assigned to the variable
- null value assigned to the variable
Answer: 1)not initialising nor defining the type of variable
16.Dynamic type checking is done at __________.
- Compilation time
- Run time
Answer: 2)Run time
17.Which of the following demonstrates function overloading, if possible, in TypeScript?
- if (value && typeof value == "number"){}
- get len():string
- var f = 0;
- var a = function (n1: number, n3?: number) : number{}
Answer: 1)if (value && typeof value == "number"){}
18.Enum organizes a _______.
- Set of un-related values
- Set of related values
Answer: 2)Set of related values
19.What is true about Mixins in TypeScript?
- They are mixed together to form a new class
- They are partial classes
- All the options
- Each class is focused on a particular activity
Answer: 3)All the options
20.Which of the options is used appropriately in JavaScript code?
- function reverse(s: string) : string;
- function reverse (s: String) : String;
Answer: 2)function reverse (s: String) : String;
21.The interface of TypeScript is usually converted to JavaScript.
- False
- True
Answer: 1)False
22.TypeScript provides access to private members through ___________.
- finally block
- get and set
- try and catch block
- set only
Answer: 2)get and set
23.The optional parameter can be defined by using "?".
- True
- False
Answer: 1)True
24.During compilation, TypeScript code gets converted to assembly language.
- True
- False
Answer: 2)False
25.The following are ways to declare a variable in TypeScript, except ________.
- var lengthB:string
- var localLength=13
- var lengthA:string = "meter"
- var 2
Answer: 4)var 2
26.TypeScript is an open source programming language.
- True
- False
Answer: 1)True