Let us look at an interview question that revolves around Apex Classes.
One of the main advantages of Salesforce is when we create a Sobject we get access to something called a Standard Controller.
Irrespective of the object being a standard object and custom object we get access to it.
In a standard controller, we will be getting access to 9 methods and we can use them to perform some standard out-of-the-box functionalities.
If I were to override the methods with my own custom functionality or implement a new method that not part of the 9 out of the methods then I need to create a Custom Controller.
An Apex Custom Controller and Apex Extension both are one and the same with the only difference that in an Extension we will be having a mandatory one argument constructor which is not the case with a Custom Controller.
If I want to associate a Visualforce page with more than one Apex Class then we need to make use of an Extension.
The advantage of using an Extension is we can have up to 5 extensions by separating each of them with a comma.
If a method is implemented in both the Extensions, the extension that comes first that has the method implementation gets the priority and gets invoked.
Hope this helps!