[go: up one dir, main page]

0% found this document useful (0 votes)
103 views10 pages

11.typescript - Completed-Completed

The document discusses TypeScript concepts like inheritance, generics, type checking, and decorators. It provides questions to test knowledge of TypeScript features. TypeScript is a superset of JavaScript that incorporates static type checking through type annotations and interfaces. It allows developers to use modern ECMAScript features while also adding optional static types.

Uploaded by

Sakshi Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views10 pages

11.typescript - Completed-Completed

The document discusses TypeScript concepts like inheritance, generics, type checking, and decorators. It provides questions to test knowledge of TypeScript features. TypeScript is a superset of JavaScript that incorporates static type checking through type annotations and interfaces. It allows developers to use modern ECMAScript features while also adding optional static types.

Uploaded by

Sakshi Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 10

Inheritance is implemented by using which keyword?

Implements**

Extends --

None of the options

Namaespace

TypeScript uses prototypical inheritance instead of classical inheritance.

False

True**

Which of the following are inherited from base class?

variables

method

all of these

Which keywork is used to access base class properties?

super

base

extends**

implements

Typescript compiler tsc converts code to

Assembly Language

JavaScript**

AngularJS

Machine Language
A JavaScript file cannot be renamed to a TypeScript file

True

False

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

False

True**

TypeScript is a__

Dynamically type checked language

New version of JavaScript

Compiler

Super-set of JavaScript**

During run time, __checking is done

Dynamic Type**

Static Type

A type system is a set of

Rules**

Data

Predefined Functions

Variables

Generics allows to accept arguments of__


Different types**

Only one type

None of these

Static type checking is done at

Compilation time

Run time

“any” is type of generic.

True

False

What is the form associated with @expression?


None of these

Constructors

Module initialisation

Decorators

Which one of the following code snippet is safer?


function fn(x: () => any) { x(); }

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

Which of the two is used appropriately in JavaScript code?


ffunction reverse (s: String) : String;

function reverse(s: string) : string;

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


var lengthB:string

var lengthA:string = "meter"

var 2

var localLength=13

any" type is assigned to the variable in case of _.


not initialising nor defining the type of variable

"Zero" or "0" assigned to the variable

not initialising the variable

null value assigned to the variable

Which of the following is the wrong way of defining variables in TypeScript?


var DNA:string= "CGATAATCGGGGAATTTCAG"

var 10231

var NumberOfDNA=10231

var DNA:string

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


All of these

const enum DNA {}

declare enum Enum {}

enum Enum {}

Which of the following demonstrates function overloading, if possible, in


TypeScript?
get len():string

var f = 0;
var a = function (n1: number, n3?: number) : number{}

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

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


Type annotation

Namespace

Modules

Reassigning data type

Decorators provides a way for __.


None of these

Both

Meta-programming syntax

Annotation

Why optional parameters are added?


To avoid confusion

To assure that value is always assigned to the variable

To add more than three parameters

To avoid assigning value for parameterised variable

Which type is assigned to variables with null type?


String

any---

boolean

None of these

Enum organises _.
Set of related values

Set of un-related vlaues

TypeScript is a .
Super-set of JavaScript

Dynamically type checked language

Compiler

New version of JavaScript

A JavaScript file cannot be renamed to a TypeScript file.


False

True

Optional parameter can be defined by using "?".


True

False

During compilation, TypeScript code gets converted to assembly language.


False

True

During compilation time, _checking is done.


Static Type

Dynamic type

Generics allows to accept arguments of __.


Only one type

None of these

Different types

Which is not a type that TypeScript supports?


string

integer

enum

boolean

TypeScript allows us access to private members via ___.


set only

try and catch block

get and set --

finally block

Which keyword is used for Inheritance in TypeScript?


follows

defines

implements

extends

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


By using "import"

By using "module" only

By using "export"

By using "namespace" only

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


Only one per declaration

at most three

Multiple

Only one in single line

How can we access a class of module from outside?


namespace classToBeExported{}

By using "implements"

By using "export"

It is not possible in TypeScript due to safety concerns.

What type of checking does Java programming language use?


Static type checking

Dynamic type checking

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


False
True

The code snippet " if (value && typeof value == "string") {}; is used for .
Inheritance add-on

Parameterising

Overriding

Overloading

__ in command line enables experimental support for decorators.


"target": "ES5"

"experimentalDecorators": true

" tsc –target ES5 –experimentalDecorators " **

"compilerOptions": {}

Type Annotations allows us to ____.

Cast a reference of a base class to one of its derived classes.**

Cast to a supertype -- wrong

Reassign the type of Data

Record the intended contract of the function or variable.

Dynamic type checking is done at __.

Run time

Compilation time
Contextual typing in TypeScript is a form of ___.

Type Inference

Type Checking

It does not exists

Inheritence..

What is true about Mixins in TypeScript?

All of these

They are partial classes

Each class is focused on a particular activity

They are mixed together to form a new class

20/25

TypeScript is____

Object oriented

TypeScript was made public by


Microsoft

Generics are _______


Object – wrong

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

Syntax for a decorator is


@symbol
The code snippet " if (value && typeof value == "string") {}; is used for
______________
Inheritance add on – wrong

Para – wrong

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


False

You might also like