TypeScript Object Oriented Programming Quiz (original) (raw)

Which of the following defines a property in a class in TypeScript?

Which access modifier allows a property to be accessed only within the class in which it is defined?

What happens if you try to modify a property marked as readonly?

What is the purpose of a setter in a class?

Which of the following is a correct example of a getter method in TypeScript?

What is the key characteristic of an abstract class?

How is an abstract method declared in TypeScript?

What happens if a class does not implement all properties of an interface it claims to implement?

How do you declare that a class implements multiple interfaces?

Which of the following is a valid implementation of an interface in a class?

TypeScript ``

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.

Take a part in the ongoing discussion