TypeScript Interview Quiz

TypeScript Interview Questions

  1. What is TypeScript?
    Ans: It is open source, strongly typed, object oriented and compiled language developed by Microsoft.
                  
  2. Why use TypeScript?
    Ans: There are following reasons :
    1.) It is open source.
    2.) TypeScript simplifies JavaScript code.
    3.) It provides static type checking.
    4.) It makes code easier to read and understand.
    5.) TypeScript is nothing but JavaScript with some additional features.
    6.) TypeScript will save developers time.
    7.) TypeScript is a superset of ES3, ES5, and ES6.
  3. What are additional feature of TypeScript?
    Ans: 1.)  Functions with optional parameters(optional parameter using ?).
     Example : function echo(a:number, b:string, c:number?): any{}
    2.) Generics support.
    3.) Modules support.
    4.) Support inheritence property.
    5.) enum type support.
    6.) Interface support.
  4. TypeScript Compiler
    Ans:TSC convert the typescript file into javascript file.
  5. A JavaScript file cannot be renamed to a TypeScript file.
    Ans: False.
  6. The value of TypeScript is writing
    Ans: Safer code
  7. TypeScript was made public by
    Ans: Microsoft.
  8. We can rename a .js file to .ts file generally
    Ans: True
  9. Typescript compiler tsc converts code to
    Ans: JavaScript
  10. TypeScript is a__
    Ans: Super-set of JavaScript
  11. TypeScript is
    Ans: Object Oriented.
  12. Which type is assigned to variables with null type
    Ans: None of these
  13. Type Annotations allows us to
    Ans: Record the intended contract of the function or variable.
  14. Is typeScript reduces the bugs?
    Ans: Yes, It reduce the bugs like null handling, undefined etc.
  15. Function overloading.
    Ans: TypeScript allows to define overloaded functions and this helps distinct implementations of a function depending on the parameter.
  16. Generics allows to accept arguments of__
    Ans: Different types.
  17. A type system is a set of
    Ans: Rules.
  18. Static type checking is done at _____________.
    Ans: Compilation time.
  19. Annotations can be implemented as
    Ans: length: number.
  20. During run time, ______________checking is done.
    Ans: Dynamic Type.
  21. Which of the following is the right way of defining enum?
    Ans: All of these
  22. Generics are ______.
    Ans: Template
  23. Which of the following is the wrong way of defining variables in TypeScript
    Ans: var 10231.
  24. Which of the two is used appropriately in JavaScript code:
    Ans: function reverse(s: string) : string;
  25. Value && typeof value == "DataType" is used for
    Ans: Overloading
  26. Inheritance is implemented by using which keyword?
    Ans: extends.
  27. " var jarvis = function (x: number, y?: number): number {} " showcases
    Ans: both.
  28. Syntax for a decorator is
    Ans: @symbol.
  29. Which of the following are inherited from base class?
    Ans: all of these.
  30. Which keywork is used to access base class properties?
    Ans: super.
  31. The code snippet " if (value && typeof value == "string") {}; is used for ______________.
    Ans: Overloading
  32. Which keyword is used for Inheritance in TypeScript?
    Ans: extends
  33. TypeScript uses prototypical inheritance instead of classical inheritance.
    Ans: False
  34. During compilation, TypeScript code gets converted to assembly language.
    Ans: False
  35. How can we access a class of module from outside?
    Ans: By using "export"
  36. During compilation time, _______checking is done.
    Ans: Static type
  37. __________ in command line enables experimental support for decorators.
    Ans: "experimentalDecorators": true.
  38. Which is not a type that TypeScript supports?
    Ans: integer.
  39. Type System is a _____________.
    Ans: Set of rules
  40. What is true about Mixins in TypeScript?
    Ans: All of these
  41. Accessing a class of a module from outside is impossible in TypeScript.
    Ans: False
  42. Optional parameter can be defined by using "?".
    Ans: True
  43. Likewise other elements, Interface of TypeScript is usually converted to JavaScript.
    Ans: False
  44. Enum organises _______________.
    Ans: Set of related values
  45. TypeScript is a open source programming language.
    Ans: True
  46. To a declaration, at most how many decorators can be applied?
    Ans: Multiple
  47.  Compiled .js of .ts containing class will also have class.
    Ans: False
  48. What is the form associated with @expression?
    Ans: Decorators

Comments

Popular posts from this blog

Cloud Computing Quizs