
Typescript – Superset of JavaScript – Fresco Play – Inheritance – Polymorphism – Array types – Classes – Fresco Play Assessment – Answer
Type System:
A Type System is a set of rules that assign a property called type to various construct a computer program consists of, such as variables, expressions, functions or modules.
Type checker is responsible for Type Checking.
It is a kind of program analyzer verifying the types that are being used in the code. The soul purpose is to recognize the bugs before the execution of the code.
Two types of Type Checking:
1.Static Type Checking
2.Dynamic Type Checking
Typescript | Superset of JavaScript Fresco Play – Array types – Classes – Fresco Play Hands-On Solutions
Assessment Answer:
1.TypeScript uses prototypical inheritance instead of classical inheritance.
A. True
B. False
Answer: False
2. Which of the following is/are inherited from base class?
A. Method
B. Variables
C. Both the options
Answer: Both the options
3.Which keyword is used to access base class properties?
A. base
B. super
C. extends
D. implements
Answer: super
4.Inheritance is implemented by using the _________ keyword.
A. namespace
B. extend
C. None of the options
D. implements
Answer: extends
5. “ var jarvis = function (x:number, y? :number) :number {} “ showcases _________.
A. Type annotation
B. Defining parameter
C. Both the options
Answer: Both the options
6.Syntax for a decorator is __________.
A. ?symbol{}
B. #symbol
C. @symbol
D. *(symbol)
Answer: @symbol
7.The following are correct ways of defining variables in TypeScript, except ________.
A. var 10231
B. var DNA: string
C. var DNA: string = “CGTATGGGGATTC”
D. var NumberOfDNA = 10231
Answer: var 10231
8.Decorators provide a way for _________.
A. None of the options
B. Meta- programming syntax
C. Annotation
D. Both the options
Answer: Both the options
9.How can we access a class of modules from outside?
A. By using export
B. namespace classtoBeExported{}
C. by using implements
D. It is not possible in TypeScript due to safety concerns
Answer: by using export
10.Enum organizes a __________.
A. Set of related values
B. Set of un-related values
Answer: Set of related values
11.During runtime, ________checking is done.
A. Static type
B. Dynamic type
Answer: Dynamic type
12.Type annotation allow us to
A. Cast to A supertype
B. Cast a reference of a base class to one of its derived classes
C. Reassign the type of data
D. Record the intended contract of the function or variable
Answer: Record the intended contract of the function or variable
13. Type system is a _________.
A. Compiler
B. Programming Language
C. Set of rules
D. Scripting Language
Answer: Set of rules
14. TypeScript is a __________.
A. Dynamically type-checked language
B. Compiler
C. Super-set Javascript
D. New version of JavaScript
Answer: Super-set of JavaScript
15. Which of the following code snippets is safer?
A. function fn(x: () => any) {x() ;}
B. function fn(x: () => void) {x() ;}
Answer: function fn(x: () => void) {x() ;}
16. _________ is the command line enables experimental support for decorators.
A. “tcs –target ES5 –experimentalDecorators”
B. “experimentalDecorators”: true
C. “compilerOptions”: {}
D. “target”: “ES5”
Answer: “tcs –target ES5 –experimental Decorators”
17. The following types are supported by TypeScript, expect _________.
A. enum
B. string
C. boolean
D. integer
Answer: integer
18.Dynamic type checking is done at ________.
A. Compilation time
B. Runtime
Answer: Runtime
19.Generic allows accepting arguments of _________.
A. Stop only one type
B. None of the options
C. Different types
Answer: Different types
20.Static type checking is done at ___________.
A. Compilation time
B. Runtime
Answer: Compilation time
21.JavaScript file cannot be renamed to a Type Script file.
A. False
B. True
Answer: False
22. Which type is assigned to variables with null type?
A. Boolean
B. String
C. Any
D. None of the options
Answer: None of the options
23. Contextual typing in JavaScript is a form of ________.
A. Type interface
B. Type checking
C. It does not exist
D. Inheritance
Answer: Type Interface
24.Which of the following is the right way of defining enum?
A. enum Enum {}
B. declare enum Enum {}
C. const enum DNA {}
D. All the options
Answer. All the options
25.During compilation, TypeScript code gets converted to assembly language.
A. False
B. True
Answer: False
26.During compilation time, __________ checking is done.
A. static type
B. Dynamic type
Answer: Static type.
27.What does “ function f(I: number, w: number) {}” demonstrate?
A. Namespace
B. Type annotation
C. Reassigning data type
D. Modules
Answer: Type annotation
28.Which of the options is used approximately in JavaScript code?
A. function reverse(s: string) : string;
B. function reverse(s: String) : Sting;
Answer: function reverse(s: String) : Sting;
29.TypeScript is an open source programming language.
A. False
B. True
Answer: True
30.What type of checking does Java programming language uses?
A. Dynamic type checking
B. Static type checking
Answer: Static type checking
Disclaimer: The main motive to provide this solution is to help and support those who are unable to do these courses due to facing some issue and having a little bit lack of knowledge. All of the material and information contained on this website is for knowledge and education purposes only. Try to understand these solutions and solve your Hands-On problems. (Not encourage copy and paste these solutions)
Read more: – Why You Should Add Collagen Powder