Company: Practo_SDE_Intern_MCQ
Difficulty: medium
In a vehicle tracking system, the Vehicle class has private fields for latitude and longitude and provides public methods updateLocation and getLocation. This design prevents the direct alteration of a vehicle's coordinates from outside the class. This scenario is an example of:
Imagine you're developing a software system for a car manufacturer to model different types of vehicles. You have a base class Vehicle with subclasses Car, Truck, and Motorcycle. If the Car class adds a new method openTrunk() which is not present in Vehicle, this is an example of:
You are implementing a search algorithm to find a specific element in a sorted array of integers. Which of the following algorithms would be the most efficient in terms of time complexity?
To implement an undo feature in a text editor, which allows reversing the last sequence of edits, what data structure should be used?