TypeScript Installation and Configuration Quiz

TypeScript
0 Passed
0% acceptance

A 30-question TypeScript quiz covering installation, project setup, tsconfig.json fundamentals, compiler options, integrating build tools, project organization patterns, and how to run and compile TypeScript effectively.

30 Questions
~60 minutes
1

Question 1

Which command installs TypeScript globally using npm?

A
npm install -g typescript
B
npm add typescript-global
C
npm create typescript
D
npm start typescript
2

Question 2

What does running `tsc -v` show?

A
The installed TypeScript version
B
All TypeScript configs
C
Your Node.js version
D
Your npm version
3

Question 3

What is the benefit of installing TypeScript locally in a project?

A
Ensures consistent versions across team members
B
Allows TypeScript to run without Node.js
C
Enables TypeScript to compile without tsconfig.json
D
Makes TypeScript run faster automatically
4

Question 4

What does this command do?

bash
npm install --save-dev typescript
A
Adds TypeScript as a dev dependency
B
Runs the TypeScript compiler
C
Installs TypeScript globally
D
Creates a tsconfig.json file
5

Question 5

Which command initializes a default tsconfig.json file?

A
tsc --init
B
tsc --create
C
typescript init
D
npm init typescript
6

Question 6

Which directory is commonly used to store compiled JavaScript output?

A
dist
B
source
C
app
D
config
7

Question 7

What happens when you run this command?

bash
tsc
A
TypeScript compiles using tsconfig.json settings
B
tsconfig.json is created automatically
C
Node.js runs TypeScript files directly
D
A new project is initialized
8

Question 8

Which folder usually stores source TypeScript code?

A
src
B
dist
C
public
D
vendor
9

Question 9

What is the purpose of tsconfig.json?

A
Controls how the TypeScript compiler behaves
B
Stores npm scripts
C
Specifies Node.js installation settings
D
Tracks all dependencies
10

Question 10

What does this configuration mean?

json
"compilerOptions": {
  "target": "ES2017"
}
A
TypeScript outputs JavaScript compatible with ES2017
B
TypeScript enforces ES2017 syntax only
C
TypeScript will not compile older ECMAScript code
D
tsconfig.json becomes optional
11

Question 11

Which field tells TypeScript where to output compiled JS files?

A
outDir
B
rootDir
C
include
D
exclude
12

Question 12

Which field restricts which files TypeScript compiles?

A
include
B
files
C
paths
D
typeRoots
13

Question 13

What does the 'strict' option enable?

A
All strict type-checking rules
B
Faster JavaScript output
C
Automatic bug fixes
D
Disabling all errors
14

Question 14

What does this compiler option do?

json
"compilerOptions": {
  "noEmit": true
}
A
Prevents TypeScript from generating JavaScript output
B
Emits only error messages
C
Deletes previous JavaScript files
D
Makes TypeScript run in watch mode
15

Question 15

What does 'module' in tsconfig.json specify?

A
The module system used in the emitted JavaScript
B
The Node.js version required
C
Which npm packages get installed
D
Whether TypeScript can run in the browser
16

Question 16

What does this option enforce?

json
"compilerOptions": {
  "rootDir": "src"
}
A
Source files must be inside src
B
JavaScript output goes to src
C
Removes files outside src
D
TypeScript loads modules from root
17

Question 17

Which tool commonly bundles TypeScript using a loader?

A
Webpack
B
Git
C
ESLint
D
PostCSS
18

Question 18

What is this command used for?

bash
npx tsc -w
A
Runs TypeScript in watch mode
B
Removes TypeScript files
C
Installs TypeScript locally
D
Optimizes your bundle
19

Question 19

Which tool directly transpiles TypeScript without full type checking?

A
Babel
B
npm
C
ESLint
D
GitHub Actions
20

Question 20

Why is separating src and dist directories recommended?

A
It keeps compiled output separate from source code
B
It makes TypeScript faster automatically
C
It removes the need for tsconfig.json
D
It forces Node.js to install TypeScript
21

Question 21

What is a recommended pattern for larger TypeScript projects?

A
Grouping code by features rather than file types
B
Keeping all code in a single folder
C
Avoiding tsconfig.json
D
Placing build scripts inside src
22

Question 22

What does this script do?

json
"scripts": {
  "build": "tsc"
}
A
Runs the TypeScript compiler using project settings
B
Deletes compiled files
C
Starts a development server
D
Installs TypeScript dependencies
23

Question 23

Which command executes a compiled JavaScript file?

A
node file.js
B
tsc file.ts
C
ts-node file.js
D
node file.ts
24

Question 24

What does this command do?

bash
npx ts-node index.ts
A
Runs TypeScript directly without manual compilation
B
Compiles TypeScript only
C
Installs ts-node globally
D
Starts a build process
25

Question 25

Which compiler option controls incremental compilation?

A
incremental
B
watch
C
lazy
D
cache
26

Question 26

Why use source maps in TypeScript projects?

A
To debug original TypeScript code in browsers or Node
B
To compile code automatically
C
To prevent TypeScript from emitting JS
D
To package dependencies
27

Question 27

What does this tsconfig option do?

json
"compilerOptions": {
  "sourceMap": true
}
A
Generates .map files for debugging
B
Removes JS output
C
Minifies JavaScript
D
Runs TypeScript in strict mode
28

Question 28

Which command compiles only a specific file, ignoring tsconfig.json?

A
tsc file.ts --pretty
B
npm run build
C
node file.ts
D
tsc --incremental
29

Question 29

What does watch mode improve during development?

A
Automatically recompiles TypeScript when files change
B
Ensures Node.js restarts
C
Minifies output JS
D
Locks version numbers
30

Question 30

What does the TypeScript compiler output when there are no errors?

A
JavaScript files as configured in tsconfig.json
B
HTML documentation
C
Nothing at all
D
A list of dependencies

QUIZZES IN TypeScript