0 votes
in TypeScript - JavaScript's Superset by

TypeScript - JavaScript's Superset FrescoPlay MCQs Answers

TypeScript Quiz on TypeScript Grammar

TypeScript Quiz on Data Types

javascript-interview-questions,

typescript-programming-questions,

typescript-practice-problems,

typescript-interview-questions-github,

typescript-tutorial,

typescript-quiz,

angular-interview-questions,

typescript-interview-questions-and-answers-2021

1 Answer

0 votes
by

TypeScript - JavaScript's Superset FrescoPlay MCQs Answers

Quiz on TypeScript Grammar

Q1.Static type checking is done at ________.

a) Run time

b) Compilation time

Ans:-  2)Compilation time

Q2.Generics allows accepting arguments of _________.

a) Only one type

b) None of the options

c) Different types

Ans:-  3)Different types

Q3.Annotations can be implemented as __________.

a) length: number

b) length=12

c) static length=12

d) var lengthC='1'

Ans:-  1)length: number

Q4.Which type is assigned to variables with null type?

a) string

b) None of the options

c) boolean

d) any

Ans:-  2)None of the options

Q5.Type Annotations allow us to _______.

a) Cast a reference of a base class to one of its derived classes

b) Record the intended contract of the function or variable

c) Cast to a supertype

d) Reassign the type of data

Ans:-  2)Record the intended contract of the function or variable

Q6.During run time, _______ checking is done.

a) Dynamic Type

b) Static Type

Ans:-  1)Dynamic Type

Q7.A type system is a set of ________.

a) Predefined Functions

b) Data

c) Rules

d) Variables

Ans:-  3)Rules

Quiz on Data Types

Q1.Generics is a/an _______.

a) Class

b) Object

c) Template

d) Functions

Ans:-  3)Template

Q2.Which of the following is the right way of defining enum?

a) enum Enum {}

b) const enum DNA {}

c) declare enum Enum {}

d) All the options

Ans:-  4)All the options

Quiz on Object Oriented Way of Approach

Q1.The following are correct ways of defining variables in TypeScript, except _________.

a) var NumberOfDNA=10231

b) var DNA:string

c) var DNA:string= "CGATAATCGGGGAATTTCAG"

d) var 10231

Ans:-  4)var 10231

Q2.Inheritance is implemented by using the ________ keyword.

a) implements

b) extends

c) namespace

d) None of the options

Ans:-  2)extends

Q3." var jarvis = function (x: number, y?: number): number {} " showcases _________.

a) Defining Parameter

b) Both the options

c) Type annotation

Ans:-  2)Both the options

Q4.Syntax for a decorator is _________.

a) @symbol

b) ?symbol{}

c) *(symbol)

d) #symbol

Ans:-  1)@symbol

Q5.Which of the options is used appropriately in JavaScript code?

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

b) function reverse (s: String) : String;

Ans:-  1)function reverse(s: string) : string;

Q6.value && typeof value == "DataType" is used for _________.

a) Overloading

b) Type annotation

c) Overriding

d) Inheritance

Ans:-  1)Overloading

Q7.Which of the two is used appropriately in JavaScript code:

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

b) function reverse (s: String) : String;

Ans:-  1)function reverse(s: string) : string;

Quiz on Introduction to TypeScript

Q1.We can rename a .js file to .ts file generally.

a) False

b) True

Ans:-  2)True

Q2.TypeScript is a __________.

a) New version of JavaScript

b) Compiler

c) Dynamically type-checked language

d) Super-set of JavaScript

Ans:-  4)Super-set of JavaScript

Q3.A JavaScript file cannot be renamed to a TypeScript file.

a) False

b) True

Ans:-  1)False

Q4.The value of TypeScript is writing _________.

a) Safer code

b) Less code

Ans:-  1)Safer code

Q5.A JavaScript file cannot be renamed to a TypeScript file.

a) False

b) True

Ans:-  1)False

Q6.Typescript compiler tsc converts code to _________.

a) Assembly Language

b) JavaScript

c) Machine Language

d) AngularJS

Ans:-  2)JavaScript

Q7.TypeScript was made public by __________.

a) Sun

b) Microsoft

c) Oracle

d) ECMA

Ans:-  2)Microsoft

Q8.TypeScript is __________.

a) Functional

b) Object Oriented

c) Symbolic

d) Procedural

Ans:-  2)Object Oriented

Quiz on Inheritance & Polymorphism

Q1.Which keyword is used for Inheritance in TypeScript?

a) follows

b) extends

c) defines

d) implements

Ans:-  2)extends

Q2.Which keyword is used to access base class properties?

a) super

b) extends

c) base

d) implements

Ans:-  1)super

Q3.TypeScript uses prototypical inheritance instead of classical inheritance.

a) True

b) False

Ans:-  2)False

Q4.Which of the following is/are inherited from base class?

a) method

b) Both the options

c) variables

Ans:-  2)Both the options

Q5.The code snippet " if (value && typeof value == "string") {}; is used for ______________.

a) Parameterising

b) Inheritance add-on

c) Overriding

d) Overloading

Ans:-  4)Overloading

TypeScript Final Assessment

Q1.Accessing a class of a module from outside is impossible in TypeScript.

a) False

b) True

Ans:-  1)False

Q2.How can we access a class of module from outside?

a) namespace classToBeExported{}

b) It is not possible in TypeScript due to safety concerns

c) By using implements

d) By using export

Ans:-  4)By using export

Q3.How can we access a class from a module from outside?

a) By using import

b) By using export

c) By using module

d) By using namespace

Ans:-  2)By using export

Q4.Why are optional parameters added?

a) To assure that value is always assigned to the variable

b) To avoid confusion

c) To avoid assigning value for parameterised variable

d) To add more than three parameters

Ans:-  4)To add more than three parameters

Q5.What is the form associated with @expression?

a) None of the options

b) Constructors

c) Module initialisation

d) Decorators

Ans:-  4)Decorators

Q6.The following types are supported by TypeScript, except ______.

a) boolean

b) enum

c) string

d) integer

Ans:-  4)integer

Q7.Compiled .js of .ts containing class will also have class.

a) False

b) True

Ans:-  1)False

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

a) Type annotation

b) Reassigning data type

c) Namespace

d) Modules

Ans:-  1)Type annotation

Q9.Contextual typing in TypeScript is a form of ___________.

a) It does not exist

b) Type Inference

c) Type Checking

d) Inheritence

Ans:-  2)Type Inference

Q10._________ in the command line enables experimental support for decorators.

a) "target": "ES5"

b) "experimentalDecorators": true

c) "compilerOptions": {}

d) "tsc --target ES5 --experimentalDecorators"

Ans:-  4)"tsc --target ES5 --experimentalDecorators"

Q11.During compilation time, ________ checking is done.

a) Static type

b) Dynamic type

Ans:-  1)Static type

Q12.Decorators provide a way for ________________.

a) None of the options

b) Annotation

c) Meta-programming syntax

d) Both the options

Ans:-  4)Both the options

Q13.At most, how many decorators can be applied to a declaration?

a) Only one per declaration

b) Three

c) Multiple

d) Only one in a single line

Ans:-  2)Three

Q14.Type System is a _____________.

a) Compiler

b) Scripting Language

c) Programming Language

d) Set of rules

Ans:-  4)Set of rules

Q15.any type is assigned to the variable in case of _____________________.

a) not initialising nor defining the type of variable

b) not initialising the variable

c) "Zero" or "0" assigned to the variable

d) null value assigned to the variable

Ans:-  1)not initialising nor defining the type of variable

Q16.Dynamic type checking is done at __________.

a) Compilation time

b) Run time

Ans:-  2)Run time

Q17.Which of the following demonstrates function overloading, if possible, in TypeScript?

a) if (value && typeof value == "number"){}

b) get len():string

c) var f = 0;

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

Ans:-  1)if (value && typeof value == "number"){}

Q18.Enum organizes a _______.

a) Set of un-related values

b) Set of related values

Ans:-  2)Set of related values

Q19.What is true about Mixins in TypeScript?

a) They are mixed together to form a new class

b) They are partial classes

c) All the options

d) Each class is focused on a particular activity

Ans:-  3)All the options

Q20.Which of the options is used appropriately in JavaScript code?

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

b) function reverse (s: String) : String;

Ans:-  2)function reverse (s: String) : String;

21.The interface of TypeScript is usually converted to JavaScript.

a) False

b) True

Ans:-  1)False

Q22.TypeScript provides access to private members through ___________.

a) finally block

b) get and set

c) try and catch block

d) set only

Ans:-  2)get and set

Q23.The optional parameter can be defined by using "?".

a) True

b) False

Ans:-  1)True

Q24.During compilation, TypeScript code gets converted to assembly language.

a) True

b) False

Ans:-  2)False

Q25.The following are ways to declare a variable in TypeScript, except ________.

a) var lengthB:string

b) var localLength=13

c) var lengthA:string = "meter"

d) var 2

Ans:-  4)var 2

Q26.TypeScript is an open source programming language.

a) True

b) False

Ans:-  1)True

...