TypeScript Introduction and Overview Quiz
Test your foundational knowledge with 40 questions on TypeScript—covering its purpose, differences from JavaScript, benefits, compilation, and real-world applications.
Question 1
What is TypeScript?
Question 2
Who created and maintains TypeScript?
Question 3
What is the primary purpose of TypeScript?
Question 4
Can valid JavaScript code be used as TypeScript code?
Question 5
What file extension is commonly used for TypeScript files?
Question 6
Which command compiles a TypeScript file named app.ts?
# In terminalQuestion 7
What is a key difference between TypeScript and JavaScript?
Question 8
What happens to TypeScript type annotations during compilation?
Question 9
Which feature is available in TypeScript but not in standard JavaScript?
Question 10
Which code is valid in TypeScript but would cause a compile-time error if misused?
function greet(name: string): string {
return "Hello, " + name;
}Question 11
Can TypeScript prevent all runtime errors?
Question 12
What is emitted when you compile a TypeScript file?
Question 13
How does TypeScript improve developer productivity?
Question 14
Why is TypeScript beneficial for large teams?
Question 15
Which of the following is a common benefit of static typing in TypeScript?
Question 16
What happens if you enable strict mode in TypeScript?
Question 17
How does TypeScript support modern JavaScript features?
Question 18
Which tooling feature is enhanced by TypeScript in VS Code?
Question 19
What is the minimal valid TypeScript program?
Question 20
What does this TypeScript code do?
let count: number = 5;
count = "hello"; // ❌Question 21
Which is a valid way to define a function with typed parameters in TypeScript?
// Option A
function add(a: number, b: number): number {
return a + b;
}Question 22
What is the inferred type of name in this code?
const name = "Alice";Question 23
Which file typically contains TypeScript compiler options?
Question 24
What does this interface define?
interface User {
name: string;
age: number;
}Question 25
How does TypeScript help with refactoring?
Question 26
Why is explicit typing beneficial for API boundaries?
Question 27
What kind of error can TypeScript help prevent?
Question 28
How does TypeScript support gradual migration from JavaScript?
Question 29
What is the benefit of using union types in TypeScript?
Question 30
How does TypeScript integrate with third-party libraries?
Question 31
What is the role of the TypeScript compiler (tsc)?
Question 32
What JavaScript version is this TypeScript code compiled to by default?
const result = numbers.map(n => n * 2);Question 33
What happens if you run tsc on a file with a type error?
Question 34
Which command generates type declaration files (.d.ts) alongside JavaScript output?
Question 35
Can TypeScript compile to JavaScript that runs in older browsers?
Question 36
Which frontend framework was originally built with TypeScript?
Question 37
Why is TypeScript popular for Node.js backends?
Question 38
How is TypeScript used in monorepos or design systems?
Question 39
Which company uses TypeScript at scale in its products?
Question 40
When might you choose not to use TypeScript?
