## Java Interview Questions

- 0of 0 votes
Write a program to implement Double Linked List from Stack with min. complexity.

- -1of 1 vote
How to implement split () method

- -1of 1 vote
How to implement split () method

- -1of 1 vote
Write a program to split a string without using split()method

- 0of 0 votes
Given a string .Check if the string is palindrome or not

- 2of 2 votes
The stepping number:

A number is called as a stepping number if the adjacent digits are having a difference of 1. For eg. 8,343,545 are stepping numbers. While 890, 098 are not. The difference between a â€˜9â€™ and â€˜0â€™ should not be considered as 1.

Given start number(s) and an end number(e) your function should list out all the stepping numbers in the range including both the numbers s & e.

- 0of 0 votes
Given two classes C1 and C2 which are almost same.(remember not exactly same).

You want to choose best among these classes so that it can be use as key in hashmap.

What question will you ask regarding two classes C1 and C2.

- 0of 0 votes
What is the diffenrce between join() and wait()?

What is sleep(). Which method releases the lock?

- 0of 0 votes
How can we implement asynchronous call in Java? Say I want to query Google but donâ€™t want to use all the urls want to use later. How can we do that?

- 0of 0 votes
How can we divide a large file between multi threads to process it? If we are running a multi threaded application and input is a large file and we have to provide each thread a part of the file to make it fast. How we can achieve it in java?

- 0of 0 votes
If we have all the variables and methods are as static. So would that class be thread safe?

- 0of 0 votes
Judgement Day

Skynet has figured out a way to take over the world. It will keep producing robots and molecular assemblers until it has converted all matter for its own purpose. Robots work to produce more robots and molecular assemblers. Molecular assemblers convert matter into programmable matter to be used to produce more robots and molecular assemblers.

Initial Info On day 0, Skynet started with 3 robots, 1 molecular assembler and 0 units of programmable matter.

On day i (i>0), robots produced can be calculated as the sum of the robots produced on the previous day and thrice the units of programmable matter produced on the previous day.

On day i, number of molecular assemblers produced can be calculated as the sum of robots produced on the previous day and twice the units of programmable matter produced on the previous day.

On day i, the units of programmable matter produced can be calculated as five times the number of molecular assemblers produced on the previous day.

How many robots, molecular assemblers and units of programmable matter will be produced on the Judgement Day (day n)?

Input/Output Specifications

Input format: Two integers x and y (1<=x,y<=10^6) such that the judgement day falls on day n = x*y.

Output format: Since the number of robots, molecular assemblers and units of programmable matter grows very rapidly, we want you to output them modulo 1000000007.

The output should be a string having the following format: R#M#P, where - R is the number of robots produced on judgement day modulo 1000000007 - M is the number of molecular assemblers produced on judgement day modulo 1000000007 - P is the number of units of programmable matter produced on judgement day modulo 1000000007

- 0of 0 votes
Distributing Medals It's the medal distribution ceremony. 10^6 police officers, numbered from 1 to 10^6, are standing in a line. There are N (1<=N<=1000) iterations of medal distribution. In iteration i (0 < = i < N), count[i] ( 1 < = count[i] < = 100) medals are given to all officers from from[i] to to[i] ( 1 < = from[i] < = to[i] < = 10^6 )

If we sum up the number of medals received starting from the first officer, who would be the first officer for which the cumulative sum exceeds a given medal count THRESHOLD ( 1 < = THRESHOLD < = 10^9 )?

Input/Output Specifications Input format:

You are given 5 inputs:

input1 = N, the number of iterations

input2 = count, the array of medal counts in each iteration

input3 = from, the array of starting indices in each iteration

input4 = to, the array of ending indices in each iteration

input5 = THRESHOLD, the medal count threshold

Output format:

An integer, representing the number of the first officer such that the cumulative sum of medals starting from the first officer upto this officer exceeds THRESHOLD. The output should be -1 if such an officer does not exist

- 0of 0 votes
Judgement Day

Skynet has figured out a way to take over the world. It will keep producing robots and molecular assemblers until it has converted all matter for its own purpose. Robots work to produce more robots and molecular assemblers. Molecular assemblers convert matter into programmable matter to be used to produce more robots and molecular assemblers.

Initial Info On day 0, Skynet started with 3 robots, 1 molecular assembler and 0 units of programmable matter.

On day i (i>0), robots produced can be calculated as the sum of the robots produced on the previous day and thrice the units of programmable matter produced on the previous day.

On day i, number of molecular assemblers produced can be calculated as the sum of robots produced on the previous day and twice the units of programmable matter produced on the previous day.

On day i, the units of programmable matter produced can be calculated as five times the number of molecular assemblers produced on the previous day.

How many robots, molecular assemblers and units of programmable matter will be produced on the Judgement Day (day n)?

Input/Output Specifications

Input format: Two integers x and y (1<=x,y<=10^6) such that the judgement day falls on day n = x*y.

Output format: Since the number of robots, molecular assemblers and units of programmable matter grows very rapidly, we want you to output them modulo 1000000007.

The output should be a string having the following format: R#M#P, where - R is the number of robots produced on judgement day modulo 1000000007 - M is the number of molecular assemblers produced on judgement day modulo 1000000007 - P is the number of units of programmable matter produced on judgement day modulo 1000000007

- 0of 0 votes
Write a java program read 3 numbers and line length make triangle..find whether triangle is isosceles or equilateral triangle,also find out rightangle triangle?

- 0of 0 votes
Write a java program multiply two 10-digit numbers and the number is very large number(10,000) ten thousand digits,don't use any built-in functions?

- 0of 0 votes
What is out in System.out.println(). How can we redirect System.out.println to file than showing on console? Say we have

System.out.println("Hello World!!"). We want "Hello World!!" written to file than showing on console.

- 0of 0 votes
How can you handle uncheckedexceptions globally in project?

- 0of 0 votes
*

* *

* * *

* * * * write a program in java??

- 0of 0 votes
Design a shopping cart.

- 0of 0 votes
Normally where singleton design pattern used in a project?

- 0of 0 votes
what is low level design and high level design in realtime java?

- 0of 0 votes
what are the top 10 coding standards/code reviews in java?

- 0of 0 votes
Spring following by default singleton scope..so if we are using clone() is there anything happend?if anyone knows please tell me the answer

- 0of 0 votes
How to find non- common elements between two string arrays. Eg: String a[]={"a","b","c","d"};

String b[]={"b","c"};

O/p should be a,d

- 0of 0 votes
Java runs on a "virtual" stack machine inside JVM, which has instruction of size of one byte (called byte-codes). How many instructions/bytecodes potentially can such a machine have?

PICK ONE OF THE CHOICES

256

Unlimited

2^32 for 32-bit machines

Depends on JVM version

- 0of 0 votes
[Phone screen]

Tell me about the Java Collections framework, what are its main interfaces. OK, what are the main differences between the Set and List interfaces? What do you give up if you go from a List to a Set, and what do you get in exchange for this if you go from a List to a Set? How would you go about guessing the order of an iteration() of HashSet if I told you I was going to insert the strings "first", "second", "third", "forth", and "fifth"?

- 0of 0 votes
Tell me about the Java Collections framework, what are its main interfaces. OK, what are the main differences between the Set and List interfaces? What do you give up if you go from a List to a Set, and what do you get in exchange for this if you go from a List to a Set? How would you go about guessing the order of an iteration() of HashSet if I told you I was going to insert the strings "first", "second", "third", "forth", and "fifth"?

- 0of 0 votes
[Phone screen]

Tell me what you know about the java.lang.Object class. OK, what are best practices for the equals method? How would you implement an equals method for a class with 100s of data fields?

- 0of 0 votes
Write a Program to find out Whether a given String can be a Palindrome i.e. we need to see for the palindrome after rearranging the words in that string.

example: lets say we have a string "aabbccd" so it can be a palindrome after rearranging the words "abcdcba".

For this I need to find out the optimal solution.