Blog Archives

13: Atomicity, Visibility, & synchronization in Java

Q. Given the following code, Client Service interface & implementation the line “XXX expensive call to a legacy system” in the “ServiceImpl” is an external call to a legacy system, which breaks when more than 5 concurrent calls are made. In other words, the “SLA (i.e. Service Level Agreement)” of…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in ♦ Complete the given code, member-paid

12: Complete the trades matching logic

Q. Given the following code Fill in required code in the “//********** TO BE COMPLETED *************” section within the “match(Trade trade)” method and in the variables declaration section at the top. Assume that this object is only accessed by a single thread. The requirements are 1) Two trades can be…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in ♦ Complete the given code, member-paid

11: Threads performing tasks by talking to each other

Q. Given the following code Output: Complete the above code so that it prints a=1 and b=1 interleaved. A. The solution is to have inter thread communication between both threads. One thread executes the method workOnX() on the shared object “SharedObject”, and the other thread invokes “workOnY()” Key Points: 1)

Read more ›

Posted in ♦ Complete the given code

10: Find all permutations of a given string – Iteration in Java

Q. Complete the method “Set getAllCombinations(String input) ” where input is any string and the method should return all possible combinations of a given string. For example: “abc” will have a permutation of 3! (i.e. 3 factorial) = 3 * 2 * 1 = 6 combinations of: result=[bca, acb, abc,…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in ♦ Complete the given code, member-paid

09: Find all permutations of a given string – best example to understand recursion

Q. Complete the method “Set getAllCombinations(String input) ” where input is any string and the method should return all possible combinations of a given string. For example: “abc” will have a permutation of 3! (i.e. 3 factorial) = 3 * 2 * 1 = 6 combinations of: result=[bca, acb, abc,…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in ♦ Complete the given code, member-paid

08: Jumping Frog problem in Java – Complete the given code

Q. Complete the method “int numberOfWays(int n)” where n is the distance to cover and the method should return the number of possible combinations if a frog can jump 1 or 2 steps at a time. The distance of 3 will have the following 3 combinations: 1) [1, 1, 1]…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in ♦ Complete the given code, member-paid

07: Index of long consecutive characters in a string – flow control

Q. Complete the method “int startIndexOfLongestRun(String input)” that returns the start index of a character that has the longest consecutive count. A. A map cannot be used here as the same character can repeated. For example, “a” is repeated. Also, the task is to find the starting index of the…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in ♦ Complete the given code, member-paid

06: Change Dir Path – String parsing & working with collections

Q. Complete the method ” public DirPath cd(String newPath)” which applies the following rules: /   : starting with “/” means root directory, else next directory path. ../ : means go up one directory. Output should be: /a/b/c/x/y/z A. Key Steps 1) If the cd newPath starts with “/”, then current…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in ♦ Complete the given code, member-paid
Page 1 of 212

800+ Java Interview Q&As – ♥Free | ♦FAQs

open all | close all

Pressed for time? 200+ Java Interview FAQs

open all | close all

16 Technical Key Areas to be a top-notch

open all | close all

100+ Java Tutorials – Step by step

open all | close all

100+ Java Coding Exercises

open all | close all

How good are your

open all | close all