This quiz explores object-oriented programming concepts in TypeScript, including classes and object types, covering topics such as class properties, access modifiers, readonly properties, getters and setters, abstract classes, methods, and interfaces. It also highlights the differences between interfaces and type aliases, offering a comprehensive understanding of TypeScript’s features.
Question 2
Which access modifier allows a property to be accessed only within the class in which it is defined?
Question 8
What happens if a class does not implement all properties of an interface it claims to implement?
Question 10
Which of the following is a valid implementation of an interface in a class?
interface Vehicle {
speed: number;
move(): void;
}
class Car implements Vehicle {
speed: number;
move() {
console.log(`The car is moving at ${this.speed} km/h`);
}
}
There are 10 questions to complete.
Quiz about TypeScript Object Oriented Programming Quiz