Blog Archives
Page 1 of 9
1 2 3 9

00: Tree from a list & flattening it back to a list in Java

Hierarchical data with parent & child relationships are very common, and Java collection does not have a Tree data structure, hence it is a popular interview question. Further questions include tree …



01: Can you design classes & interfaces using OO?

Q1. How would you go about designing a “farm animals” application where animals like cow, pig, horse, etc move from a barn to pasture, a stable to paddock, etc? The solution …



01: String parsing & date formatting – complete the given code

Q. Complete the method “changeDateFormat(String paragraph)” which takes a string input containing dates in mm/dd/yyyy format and converts them to “dd/mm/yyyy” format. For example, “My birthday is on 04/25/1980” …



01: Tree flattening example in Java

Q. Traverse the tree in depth and return a list of all passed nodes. It should handle different data types as Double, String, etc. The4 interface for the tree node is …



01: What is wrong with following Java code snippets? Auto-unboxing, switch, short circuit & exception

Auto-unboxing, switch, short circuit logical operators & exception handling are core Java basics that sometimes lead to obscure errors if not understood well & often tested in coding tests.

Q1. What …



02: Scenarios based Java OO concepts & GoF design patterns – naive Template Method pattern

Extends Can you design classes & interfaces using OO?. Only experience, and asking the right questions can teach you what design pattern to use, in which scenario.

Scenario: A company …



02: Tree structure – calculate average recursively & iteratively in Java

Q. Complete the following “TreeProcessingImpl” class ….. so that the unit tests shown below pass? Skeleton Code



02: What is wrong with this code? Heap Vs Stack, Thread safety & Synchronized

This post covers must know Java Multithreading basics – Heap Vs Stack, Thread-safety & Synchronization. When you have a multithreaded Java application, you need to code in a thread-safe manner. Java …



02: Working with Java Collections – Complete the given code

Q. Complete the method “canAttendAll(Collection seminars)” which takes a collection of seminar objects with start and end timestamps, and the method should determine if there is an overlap in seminars events. …



03: Scenarios based Java OO concepts & GoF design patterns – Strategy Pattern

The following post improves on the design flaws listed in the previous post entitled 02: Scenarios based Java OO design & GoF design patterns – naive Template Method pattern. Scenario: A …



03: Tree navigation – is a BST Tree?

Q. Complete the method “isValidBST(Node root)” which takes a “Tree node” as an input to evaluate if the input is a valid BST (i.e. Binary Search Tree)?



03: Tree traversal algorithms in Java

Q1. What are the different binary tree traversal mechanisms? A1. Traversing a tree means visiting all the nodes of a tree in order. Many different binary tree algorithms involve traversals. For …



03: Understanding Big O notations

Q. Have you seen job advertisements requiring Java candidates to work in real-time or high volume transaction processing systems? If you are applying for such jobs, you can be quizzed on Big O notation. Here …



Page 1 of 9
1 2 3 9

800+ Java Interview Q&As

Prepare to fast-track & go places
with multi-offers to choose from & increased earning potential. Expand your horizons along the way by taking the road less travelled.
Learn by categories on the go...
Learn by categories such as FAQs – Core Java, Key Area – Low Latency, Core Java – Java 8, JEE – Microservices, Big Data – NoSQL, etc. Some posts belong to multiple categories.
Top