Typescript Professional Sample Questions


Sample Questions
 



1.    What is the inherited type for the variable example in 'const example = ['Dylan']'?
A.    any[]
B.    string[]
C.    string
D.    unknown[]

2.    What does the 'readonly' access modifier do for an array variable assignment like: 'const codeNames: readonly string[] = ['Coding', 'God']'?
A.    Makes you read it for better clean code
B.    Allows only adding but not deleting elements in the array
C.    Makes it private and can only be used in the file its created
D.    Allows no changes and is there simply to be read from and not modified

3.    Which is a successful example of this tuple '[number, string]'?
A.    const ourTuple = [101]
B.    const ourTuple = ['Coding God', 101]
C.    const ourTuple = [101, 101, 'Coding God', 'Coding God']
D.    const ourTuple = [101, 'Coding God']

4.    Type Aliases are mostly used with ______.
A.    Strings
B.    Booleans
C.    Numbers
D.    None of the above

5.    ________ an interface will have the same properties as that interface.
A.    Idolizing
B.    Improving
C.    Extending
D.    Duplicating

Answers:      1 (B), 2 (D), 3 (D), 4 (A), 5 (C)


Certification

https://www.vskills.in/certification/typescript-certification-course

 For Support