TypeScript - JavaScript's Superset MCQs Solution | TCS Fresco Play | Fresco Play
Disclaimer: The primary purpose of providing this solution is to assist and support anyone who are unable to complete these courses due to a technical issue or a lack of expertise. This website's information or data are solely for the purpose of knowledge and education.
All Question of the MCQs Present Below for Ease Use Ctrl + F with the question name to find the Question. All the Best!
1. var jarvis = function (x: number, y?: number): number {} showcases
both
2. var jarvis = function (x: number, y?: number): number {} showcases ____________.
Both
3. _________ in the command line enables experimental support for decorators.
"tsc --target ES5 --experimentalDecorators"
4. __________ in command line enables experimental support for decorators.
experimentalDecorators: true*
5. __________ in command line enables experimental support for decorators.
experimentalDecorators: true
6. “any” is type of generic.
FALSE
7. A JavaScript file cannot be renamed to a TypeScript file
FALSE
8. A JavaScript file cannot be renamed to a TypeScript file
FALSE
9. A type system is a set of
Rules
10. Accessing a class of a module from outside is impossible in TypeScript.
FALSE
11. Accessing a class of a module from outside is impossible in TypeScript.
FALSE
12. Annotations can be implemented as length:
number
13. At most, how many decorators can be applied to a declaration?
Multiple
14. Compiled .js of .ts containing class will also have class.
TRUE
15. Compiled .js of .ts containing class will also have class.
FALSE
16. Contextual typing in TypeScript is a form of ___________.
Type Inference
17. Contextual typing in TypeScript is a form of ___________.
Type Checking*
18. Decorators provide a way for
Both the options
19. Decorators provides a way for ________________.
Both
20. Decorators provides a way for ________________.
Annotation*
21. During compilation time, _______checking is done.
Static Type
To avoid assigning value for parameterized variable*
22. During compilation, TypeScript code gets converted to assembly language.
FALSE
23. During run time, __checking is done
Dynamic Type
24. Dynamic type checking is done at __________.
Run time
25. Enum organises _______________.
Set of related values
26. Enum organises _______________.
Set of related values
27. Enum organizes a
SET OF RELATED VALUES
28. Generics allows to accept arguments of __________.
Different types
29. Generics allows to accept arguments of __________.
Different types
30. Generics allows to accept arguments of__
Different types
31. Generics are _______
Template
32. How can we access a class from a module from outside?
By using "module"*
33. How can we access a class of module from outside?
By using "implements"*,
34. Inheritance is implemented by using which keyword?
extends
35. Likewise other elements, Interface of TypeScript is usually converted to JavaScript.
TRUE
36. Static type checking is done at
Compilation time
37. Syntax for a decorator is
@symbol
38. The code snippet " if (value && typeof value == "string") {}; is used for 39. ______________.
Overloading
39. The code snippet " if (value && typeof value == "string") {}; is used for ______________.
Overloading
40. The following are correct ways of defining variables in TypeScript,
except _
41. The optional parameter can be defined by using
TRUE
42. The value of TypeScript is writing
Safer code
43. To a declaration, at most how many decorators can be applied?
Only one per declaration*
44. To a declaration, at most how many decorators can be applied?
Only one per declaration
45. Type Annotations allows us to
Record the intended contract of the function or variable.
46. Type Annotations allows us to
Record the intended contract of the function or variable.
47. Type System is a _____________.
Set of rules
48. TypeScript allows us access to private members via ___________.
get and set
49. TypeScript allows us access to private members via ___________.
get and set
50. Typescript compiler tsc converts code to
JavaScript
51. TypeScript is
Object Oriented
52. TypeScript is a open source programming language.
FALSE
53. TypeScript is a__
Super-set of JavaScript
54. TypeScript uses prototypical inheritance instead of classical inheritance.
FALSE
55. TypeScript was made public by
Microsoft
56. value && typeof value == "DataType" is used for
Overloading
57. We can rename a .js file to .ts file generally
TRUE
58. What is the form associated with @expression?
Decorators
59. What is the form associated with @expression?
Decorators
60. What is true about Mixins in TypeScript?
All of these
61. What is true about Mixins in TypeScript?
All of these
62. What type of checking does Java programming language use?
Static type checking
63. Which is not a type that TypeScript supports?
integer
64. Which is not a type that TypeScript supports?
integer
65. Which keyword is used for Inheritance in TypeScript?
extends
66. Which keyword is used for Inheritance in TypeScript?
extends
67. Which key work is used to access base class properties?
super
68. Which of the following are inherited from base class?
all of these
69. Which of the following demonstrates function overloading, if possible, in TypeScript?
if (value && typeof value == "number"){}
70. Which of the following demonstrates function overloading, if possible, in TypeScript?
if (value && typeof value == "number"){}
71. Which of the following is a wrong way to declare the variable in TypeScript?
var 2
72. Which of the following is the right way of defining enum?
all of these
73. Which of the following is the right way of defining enum?
all of these
74. Which of the following is the wrong way of defining variables in TypeScript
var 10231
75. Which of the following is the wrong way of defining variables in TypeScript?
var 10231
76. Which of the two is used appropriately in JavaScript code:
function reverse(s: string) : string;
77. Which one of the following code snippet is safer?
function fn(x: () => void) { x(); }
78. Which type is assigned to variables with null type
None of these
79. Which type is assigned to variables with null type?
None of these+
80. Why optional parameters are added?
To avoid assigning value for parameterized variable
81. Why optional parameters are added?
To assure that value is always assigned to the variable*,
1 comment