0% found this document useful (0 votes)
13 views8 pages

Test Preperation (Part 03)

Uploaded by

hassanyaseen615
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views8 pages

Test Preperation (Part 03)

Uploaded by

hassanyaseen615
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Typescript

Exam Preperation
(Part 03)
73. What is package.json used for in a Node.js project?

a) To store metadata about the project

b) To define project dependencies

c) To configure project settings

d) All of the above

Answer: d) All of the above

74. Which command is used to install dependencies listed in package.json?

a) npm install

b) npm add

c) npm get

d) npm require

Answer: a) npm install

75. What is the purpose of the devDependencies field in package.json?

a) To specify dependencies required only for development purposes

b) To specify dependencies required only for production purposes

c) To specify dependencies required for both development and production

d) devDependencies is not a valid field in package.json

Answer: a) To specify dependencies required only for development purposes

76. What is the purpose of tsconfig.json in a TypeScript project?

a) To configure TypeScript compiler options


b) To list project dependencies

c) To define project scripts

d) To specify project metadata

Answer: a) To configure TypeScript compiler options

77. What is the purpose of a .gitignore file in a Git repository?

a) To specify which files and directories should be tracked by Git

b) To specify which files and directories should be ignored by Git

c) To define commit messages that Git should ignore

d) To specify which branches should be ignored by Git

Answer: b) To specify which files and directories should be ignored by Git

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

79. What does npm stand for?

a) Node Project Manager

b) Node Package Manager

c) Node Programming Module

d) Node Package Module

Answer: b) Node Package Manager

80. What is the purpose of npm in a Node.js project?


a) To manage project dependencies

b) To run JavaScript code

c) To create web servers

d) To test code

Answer: a) To manage project dependencies

81. What command is used to uninstall a package installed via npm?

a) npm delete <package-name>

b) npm remove <package-name>

c) npm uninstall <package-name>

d) npm purge <package-name>

Answer: c) npm uninstall <package-name>

81. What is the purpose of package-lock.json in npm?

a) To list all installed packages

b) To lock down the version of installed packages

c) To define project scripts

d) To specify project metadata

Answer: b) To lock down the version of installed packages

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) npm add inquirer

b) npm install inquirer

c) npm require inquirer

d) npm fetch inquirer

Answer: b) npm install inquirer

85. Which of the following is not a type of prompt supported by Inquirer.js?

a) Input

b) Confirm

c) Array

d) List

Answer: c) Array

86. What is Inquirer.js used for in JavaScript development?

a) As a testing framework

b) To create user interfaces in the terminal


c) To manipulate arrays and objects

d) To manage asynchronous operations

Answer: b) To create user interfaces in the terminal

87. What is Chalk used for in JavaScript development?

a) To create user interfaces in the terminal

b) To format and colorize text output in the terminal

c) To manipulate arrays and objects

d) To manage asynchronous operations

Answer: b) To format and colorize text output in the terminal

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?

a) npm add chalk

b) npm install chalk

c) npm require chalk

d) npm fetch chalk

Answer: b) npm install chalk

90. Which method of Chalk is used to apply a specific color to text?


a) color()

b) applyColor()

c) setColor()

d) chalk()

Answer: d) chalk()

91. Which of the following is not a style supported by 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

Answer: 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 {}

Answer: a) interface Person {}


94. What happens if you try to directly run a TypeScript file using node without
compiling it first?

a) It will throw a syntax error

b) It will run the TypeScript code directly

c) It will transpile the TypeScript code on-the-fly and then run it

d) It will prompt an error indicating that it's not a valid JavaScript file

Answer: a) It will throw a syntax error

95. Which of the following commands will transpile a TypeScript file and then execute
the resulting JavaScript file?

a) node index.ts

b) tsc index.js && node index.js

c) tsc && node index.ts

d) node index.js && tsc index.js

Answer: b) tsc index.js && node index.js

96. Which of the following is true about TypeScript?

a) It is executed directly in browsers

b) It needs to be compiled into JavaScript before execution

c) It can only be used for server-side programming

d) It is not suitable for object-oriented programming

Answer: b) It needs to be compiled into JavaScript before execution

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

Answer: a) Static typing

98. What is the purpose of the null and undefined types in TypeScript?

a) To represent non-nullable values

b) To represent nullable values

c) To represent numeric values

d) To represent boolean values

Answer: b) To represent nullable values

99. In most programming languages, which symbol is commonly used as the assignment
operator?

a) =

b) ==

c) ===

d) :=

Answer: a) =

100. What is the purpose of the assignment operator in programming?

a) To compare two values

b) To declare variables

c) To assign a value to a variable

d) To perform mathematical operations

Answer: c) To assign a value to a variable

You might also like