Check Your Java OOPs Concepts Skills and Master it Quickly

Did you finish learning Java OOPs Concepts? Check your level with tricky Coding & Conceptual OOP questions –  Master and Get Ready for writing industry-level application in no time with the book OOP Concepts Booster!

(Try these 5 Coding and 15 Conceptual Questions!)


Coding OOP Questions:

Q-1) Below is a bank user account class. The Manager, finance and Teller classes of the bank are accessing the user account balance. What is the problem with the class Account and how would you modify it?

class Account {
	public double balance;

	public void withdraw() {
	}
}

Q -2) This original version of the switch interface is distributed to many clients. How would you update the interface with a new specification i.e. “void setLed();”, so that the existing client code does not break?

interface Switch {
 void on();
 void off(); 
}

Q-3) Let’s say to prepare a very testy coffee, the sequence of adding ingredients is as below.

First, add coffee, then add sugar and then milk.

You provided the below coffee recipe class to 3 venders to implement it. What problem can be arises and how will you solve the problem?

class Recipe {
	public void coffee() {
	}
	public void sugar() {
	}	
	public void milk() {
	}
}

Q-4) A software designer team decided to have only 3 specifications as below, so, user classes can implement it. What mistakes the team has made and what will be your suggestion and why?

abstract class Mouse{
	abstract void leftClick();
	abstract void rightClick();
	abstract void scroll();
}

Q-5) The below working code writes something on a board with blue Marker.  – What can be the issue in real time?

class Board {
	public void write(BlueMarker m) {
		m.color(); 
	}
}

Conceptual OOP Questions:

 Q-1) What can be the issue if you delete a base class method if a subclass overrides it?

Q-2) How do polymorphism and inheritance provide extensibility?

Q-3) Why should anyone use constructor overloading? How does this help?

Q-4) How does inheritance help eliminate duplicate code?

Q-5) Why do you need to overload the method if methods with different names do the task as well?

Q-6) What are the multiple ways to reuse the code in OOP?

Q-7) If we can’t create an object of an abstract class, then what is its purpose? What can be the scenarios of uses?

Q-8) How does encapsulation provide security?

Q-9) Are both the concepts of encapsulation and abstraction really related to hiding complexities? Can you Justify your answer?

Q-10) What are impacts if I don’t follow dictum – “Code to the interface, not to the implementation”?

Q-11) How can an “interface” or an “abstract class”, be used to aid in improving the degree of abstraction in the design of a class?

Q-12) Both the composition and aggregation follow the Has-A relationship, then how are they different? Which one should you choose when?

Q-13) In what scenarios inheritance is indispensable? Is it true that inheritance is used for code reuse only? If not, what are the other factors?

Q-14) How can inheritance break the client code, but composition cannot? Illustrate the scenario example of this.

Q-15) What are the good guidelines to choose inheritance or composition?


SOLUTION:

You’ll find the solutions to all conceptual questions in the book OOP Concepts BoosterCreated and designed uniquely after decades of working with Industrial OOP to get you strong hold on it. Coding questions are simulated from the examples from the book.

Solving any kind of oop based problems will be a PIECE OF CAKE for you after reading the book( contains concepts and Q&A approach). – Become a TOP performer!

You can instantly read the book in your browser on Amazon here or Google Play or Get your copy below.

GET YOUR COPY


OOP Concepts Booster
OOP Concepts Booster

Related Posts