TypeScript Beginner Quiz
Grasp the basics of TypeScript and its core concepts.
Start the quizSample questions from this quiz
A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.
1. How do you declare a variable with a specific type in TypeScript?
let myVar: string = "Hello";- let myVar = string;
- var myVar as string;
- let myVar: string;
- string myVar;
Show answer
Answer: let myVar: string;. TypeScript uses a colon (:) after the variable name to specify its type.
2. Which of the following is NOT a basic type in TypeScript?
- number
- integer
- boolean
- string
Show answer
Answer: integer. TypeScript uses `number` for all numeric values, including integers and floats. `integer` is not a distinct type.
3. What is the type of an uninitialized variable in TypeScript?
let x;- null
- any
- unknown
- undefined
Show answer
Answer: any. If a variable is declared without a type and without an initial value, it defaults to the `any` type.
Frequently asked questions
How many questions are in this TypeScript quiz?+
30 questions, with a 45-minute time limit. Every question includes a written explanation of the correct answer.
Is this TypeScript quiz free?+
Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.
What level is the beginner quiz aimed at?+
Grasp the basics of TypeScript and its core concepts.
Can I use this to prepare for a TypeScript interview?+
Yes. The questions cover the topics that come up in TypeScript technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.
Ready to test your TypeScript?
30 questions, 45 minutes. Free, no sign-up.
Start now