Ilovepdf Merged
Ilovepdf Merged
Exam Preperation
(Part 01)
1. What is TypeScript?
a) A superset of JavaScript
a) tsconfig.json
b) package.json
c) tscconfig.json
d) typescript.config
Answer: a) tsconfig.json
4. What command compiles TypeScript files in a project?
a) tsc
b) compile
c) ts-compile
d) typescript
Answer: a) tsc
a) tsc init
b) tsc --init
c) typescript init
d) typescript --init
b) Sublime Text
c) Atom
a) .ts
b) .js
c) .txt
d) .html
Answer: a) .ts
10. Which npm package manager command is used to initialize a new package.json file?
a) npm init
b) npm create
c) npm new
d) npm generate
11. How do you check the installed version of TypeScript on your system?
b) tsc --version
c) tsc -v
d) npm view typescript version
a) mkdir directory_name
b) newdir directory_name
c) mk directory_name
d) create directory_name
b) Deletes a file
d) Copies files
a) Tab
b) Enter
c) Shift
d) Backspace
Answer: a) Tab
16. Which command is used to move up one directory level in Unix/Linux systems?
a) cd ..
b) cd..
c) cd ../
d) cd ..
Answer: d) cd ..
17. Which of the following is a Git command used to clone a repository from GitHub to
your local machine?
a) git init
b) git pull
c) git clone
d) git push
a) Issue tracking
b) Code reviews
c) Video streaming
d) Pull requests
a) .ts
b) .js
c) .txt
d) .html
Answer: b) .js
b) GitHub Desktop
a) Static typing
b) Dynamic typing
c) Interfaces
d) Classes
a) var
b) let
c) const
d) Both b) and c)
a) var
b) let
c) const
d) Both a) and b)
Answer: b) let
28. What is the key difference between var, let, and const in JavaScript/TypeScript?
b) var has block scope, while let and const have function scope.
c) var has function scope, while let and const have block scope.
d) let and const are used for declaring functions, while var is used for variables.
Answer: c) var has function scope, while let and const have block scope.
29. Which of the following is true about TypeScript's type inference for variables?
Answer: b) TypeScript infers variable types based on the initial value assigned.
31. In TypeScript, what is the scope of a variable declared using the var keyword?
a) Global scope
b) Function scope
c) Block scope
d) Module scope
a) Type assertions
b) Type inference
c) Type narrowing
d) Type annotations
34. What happens if you try to redeclare a variable using let or const in the same scope
in JavaScript/TypeScript?
35. Which of the following statements is true regarding let and const in
JavaScript/TypeScript?
a) $
b) @
c) #
d) &
Answer: a) $
a) my-variable
b) 1stVariable
c) var#
d) _myVariable
Answer: d) _myVariable
39. In Typescript, which of the following is a common convention for naming variables
with multiple words?
d) Both b) and c)
a) numofstudents
b) numOfStudents
c) num_of_students
d) NumOfStudents
Answer: b) numOfStudents
a) +
b) -
c) *
d) /
Answer: a) +
42. In Typescript, what is the result of the following expression: "Hello" + " " +
"World"?
a) HelloWorld
b) Hello World
c) “HelloWorld”
d) SyntaxError
a) .
b) :
c) ;
d) ,
Answer: c) ;
44. Which of the following is the correct syntax for declaring a variable in Typescript?
b) myVar = 10;
b) Concatenating strings.
c) Backticks (` `)
d) Square brackets ([ ])
Answer: c) Backticks (` `)
47. Which of the following expressions correctly uses template literals in TypeScript?
a) `Hello, ${name}!`
b) "Hello, ${name}!"
c) 'Hello, ${name}!'
d) [Hello, ${name}!]
48. What advantage do template literals offer over traditional string concatenation in
TypeScript?
b) They allow for the interpolation of variables directly into the string.
Answer: b) They allow for the interpolation of variables directly into the string.
a) number
b) boolean
c) array
d) string
Answer: c) array
51. What is the data type of the following variable declaration in TypeScript: let age =
25;?
a) string
b) number
c) boolean
d) array
Answer: b) number
a) :
b) =
c) <>
d) !
Answer: a) :
Answer: b) To automatically determine the data type of a variable based on its value.
55. In statically typed languages like TypeScript, when are type errors typically
detected?
a) During compilation.
b) During runtime.
a) To execute code.
c) To declare variables.
d) To define functions.
a) //
b) #
c) ;
d) /*
Answer: a) //
a) To declare variables.
c) To define functions.
d) To document code.
a) &&
b) ||
c) +
d) !
Answer: c) +
62. What does the === operator do in TypeScript?
c) It performs addition.
d) It performs assignment.
c) It performs subtraction.
d) It performs assignment.
b) To compare values.
d) To declare variables.
a) +
b) &&
c) +
d) *
Answer: b) &&
66. What is the result of the logical AND (&&) operator when both operands are true?
a) true
b) false
c) null
d) undefined
Answer: a) true
67. What is the result of the logical OR (||) operator when one operand is true and the
other is false?
a) true
b) false
c) null
d) undefined
Answer: a) true
a) +
b) +=
c) ||
d) /
Answer: c) ||
d) To define a function.
70. When is the "else" statement used in conjunction with the "if" statement?
d) To define a function.
a) To execute a block of code only if a specified condition is true, and to execute another
block of code if that condition is false.
c) To execute a block of code only if the preceding "if" condition is false and a new condition
is true.
d) To define a function.
Answer: c) To execute a block of code only if the preceding "if" condition is false and a
new condition is true.
Answer: b) To watch for changes in TypeScript files and automatically recompile them.
Typescript
Exam Preperation
(Part 03)
73. What is package.json used for in a Node.js project?
a) npm install
b) npm add
c) npm get
d) npm require
78. How can you ignore a specific file named example.txt in a .gitignore file?
a) example.txt
b) /example.txt
c) *.txt
d) !example.txt
Answer: a) example.txt
d) To test code
82. Which prompt type in Inquirer.js presents a list of options for the user to choose
from?
a) Input
b) Confirm
c) List
d) Checkbox
Answer: c) List
83. Which method of Inquirer.js is used to start the prompt interface and receive user
input?
a) start()
b) prompt()
c) init()
d) run()
Answer: b) prompt()
84. How can you install Inquirer.js in your project using npm?
a) Input
b) Confirm
c) Array
d) List
Answer: c) Array
a) As a testing framework
88 .Which npm package provides the functionality of styling and coloring text output in
the terminal?
a) Chalk.js
b) TerminalStyler.js
c) Colorize.js
d) StyleMaster.js
Answer: a) Chalk.js
89. How can you install Chalk in your project using npm?
b) applyColor()
c) setColor()
d) chalk()
Answer: d) chalk()
a) Bold
b) Italic
c) Strikethrough
d) Underline
Answer: b) Italic
92. Which tool is designed for users who prefer a visual interface for tasks like
committing changes, creating branches, and resolving merge conflicts?
a) GitHub CLI
b) GitHub Desktop
93. Which of the following describes the syntax for defining an object type in
TypeScript using an interface?
a) interface Person {}
b) type Person = {}
c) class Person {}
d) object Person {}
d) It will prompt an error indicating that it's not a valid JavaScript file
95. Which of the following commands will transpile a TypeScript file and then execute
the resulting JavaScript file?
a) node index.ts
97. TypeScript provides support for which of the following features that JavaScript
lacks?
a) Static typing
b) Dynamic typing
c) Prototypal inheritance
d) Function overloading
98. What is the purpose of the null and undefined types in TypeScript?
99. In most programming languages, which symbol is commonly used as the assignment
operator?
a) =
b) ==
c) ===
d) :=
Answer: a) =
b) To declare variables
14) Typescript complier use _________ to check type when type is not given
a)type erasure b)type inference c)type annotations d)none of the
above