Written assignment around Calendar application having events and meetings. You were expected to come up with working API’s having proper entites defined and design patterns utilised while writing classes.
My past projects and Round 1 assignment discussions
We discussed about abstract class versus interface and new java 8 features w.r.t. interfaces (default methods). It also included some differences between usage of default methods in interface and abstarct class. When to use each one of them.
Consider a hashmap as a data member of singleton class. How to make it thread safe?
Give an example of a class that is both singleton and immutable. Some questions around static classes and multithreading
Find missing element in an increasing array eg 31, 32, 34, 35, 36 (He was expecting modified binary search)
Discussions around Java features, OOPS concepts specifically about polymorphism
Can static methods be overridden and why /why not?
What is sinleton class? how to make it thread safe?
Difference static synchronized versus non static synchronized methods?
Can 2 non static synchronized methods be called by 2 threads using same object?
Can 2 non static synchronized methods be called by 2 threads using diff objects?
Can 2 static synchronized methods be called by 2 threads using same/diff object?
class c extends b, b extends a ? in what order will constructors be called?
SQL query on table BOOK ->id, book name, AUTHOR-> author id, author name, BOOKAUTHOR -> id, author id. Give all author names who have written more than one books (avoid nested query and use join, write optimized query)
Two classes:CarPlate, Car, and given a HashMap<CarPlate, Car>. Suppose class A creates an object of CarPlate(“4000”) and Car and puts both in given HashMap. And there is another class B which also creates an object of CarPlate(“4000”) and tries to get it but an error is thrown not found? What could possibly go wrong here?
(I gave solution as default hashcode method is address based, so hashcode could be diff for 2 carplate objects. So we should override the hascode method and equals method both)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.