Java Developer Interview Questions
- 0of 0 votes
AnswersPrint all permutations of a string and give the complexity of the algorithm.
- killdos October 11, 2015 in United States| Report Duplicate | Flag | PURGE
Walmart Labs Java Developer - 0of 0 votes
AnswersGiven a tree (incolmplete and/or unbalanced), how would you write it to disk so it can be moved to another machine and recreated?
- killdos October 11, 2015 in United States| Report Duplicate | Flag | PURGE
Walmart Labs Java Developer - 0of 0 votes
AnswersJava question:
- killdos October 11, 2015 in United States
Given string represntation of an object and a list of classes. How would you determine what class that object belongs to?| Report Duplicate | Flag | PURGE
Ebay Java Developer - 0of 0 votes
AnswersDesign database schema for the following problem:
- killdos October 11, 2015 in United States
You have a website that allows user to download some content. You have to enforce a limit of say 10 items per day for a user. So a user cannot download more than 10 items per 24 hours.
And download counters for users are not reset at 00:00 am because that would allow users to download 10 items between 11 and 12 at night one day and download another 10 items between 12 and 1 the same night. This violates the condition.| Report Duplicate | Flag | PURGE
Ebay Java Developer - 0of 0 votes
AnswersGiven a number, print all valid parentheses combination for that number.
- killdos October 11, 2015 in United States
Like for n = 3 output would be ()()(), (())(), ()(())| Report Duplicate | Flag | PURGE
Ebay Java Developer - 0of 0 votes
AnswersIs it possible to implement singelton pattern in JS. If it is how would you do it?
- killdos October 11, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Java Developer - 0of 0 votes
AnswersGiven two identical dom trees and an element in one of those trees, find the corresponding element in the other tree and highlight it.
- killdos October 11, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Java Developer Algorithm Trees and Graphs - 0of 0 votes
Answersconsider an array1={1,1,1,1,1,1,1,1,1,1}
- sekardhana94 October 07, 2015 in India
if n=4 add first four elements and next four elements
result : array1={4,4,2}
if n=3 add first three elements and next three elements repeat process untill size of array <=n
result1:
array1={3,3,3,1}
result2 : array1={6,4}| Report Duplicate | Flag | PURGE
ss Java Developer Arrays - 2of 2 votes
AnswersGiven an array of strings with only lowercase letters , create a function that returns an array of those same strings, but each string has its letters rearranged such that it becomes a palindrome (if possible, if not, return -1)
- makingworldcode September 13, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Java Developer Java - 0of 0 votes
AnswersThere is a service which is run by a thread. Within that service, there are say 100 tasks which need to be executed sequentially(highlighted the work sequentially). How would you design your service, specifically what classes from Java framework would you use for this scenario?
- User1 August 24, 2015 in United States| Report Duplicate | Flag | PURGE
JP Morgan Java Developer Threads - 0of 0 votes
AnswersWrite code for square root function? Basic Math Square Root. (Discuss your solution first with the interviewer then code while interviewer was watching over online)
- robotics1 July 25, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Java Developer - 0of 0 votes
AnswersInput Parser and Processor
- rameshelworthy July 04, 2015 in India
Problem
Implement a java program for querying data from a java object. Java object need to be constructed based on text data provided to program.
The parser should be generic to parse any input confirming to the hierarchical format similar to the one mentioned in sample
The Content of the file
[employee]
name=john
age=30
salary=100
[address]
houseno=221b
street=bakerstreet
[location]
place=xyz
state=abc
country=123
[/location]
[/address]
designation = srDeveloper
[/employee]
Sample Input and Output
employee.name Output John
employee.address.houseno Output 221b
employee.address.location.state Output abc
employee.manager Output NOT_FOUND
The program should work any object data specified as input file.| Report Duplicate | Flag | PURGE
Oracle Java Developer Data Structures - 0of 0 votes
AnswersFind the most frequent element in an array in logn time.
- ksahoo June 28, 2015 in United States| Report Duplicate | Flag | PURGE
ADP Java Developer Algorithm - 0of 2 votes
AnswersI have this element {1, 1, 2, 3}, so i have an duplicate element. I want generate combinations and my result should be: {1} {2} {3} {1 1} {1 2} {1 3} {2 3} {1 1 2} {1 1 3} {1 2 3} {1 1 2 3}. The order of element isn't important, {1 1 2 3} == {2 3 1 1}, but i wan't a duplicate result set.
- pasquale.restaino1992 May 25, 2015 in United States
My code is:
enter code herepublic List> powerSet1(List originalSet) { Date inizio = new Date(); int resultSize = (int) Math.pow(2, originalSet.size()); // resultPowerSet is what we will return List> resultPowerSet = new ArrayList>(resultSize);
// Initialize result with the empty set, which powersets contain by definition
resultPowerSet.add(new ArrayList<Elemento>(0));
// for every item in the original list
for (Elemento itemFromOriginalSet : originalSet) {
// iterate through the existing powerset result
// loop through subset and append to the resultPowerset as we go
// must remember size at the beginning, before we append new elements
int startingResultSize = resultPowerSet.size();
for (int i=0; i<startingResultSize; i++) {
// start with an existing element of the powerset
List<Elemento> oldSubset = resultPowerSet.get(i);
// create a new element by adding a new item from the original list
List<Elemento> newSubset = new ArrayList<Elemento>(oldSubset);
newSubset.add(itemFromOriginalSet);
// add this element to the result powerset (past startingResultSize)
resultPowerSet.add(newSubset);
}
}
logger.info(resultPowerSet);
Date fine = new Date();
long tempo = fine.getTime() - inizio.getTime();
logger.info ("durata genera combinazioni: " + tempo);
return resultPowerSet;
}
But this generate duplicate.| Report Duplicate | Flag | PURGE
Java Developer Java - 0of 2 votes
Answerswrite a prog/method to convert number to character (as in old mobile phone).
- Anonymous May 03, 2015 in United States
e.g. 2 entered 1 = A
2 entered 2 = B
2 entered 3 = C
# = space
22#22 = B B etc.| Report Duplicate | Flag | PURGE
Epic Systems Java Developer Algorithm - 1of 1 vote
AnswersYou are given two objects, Student and Course, and there exist a many to many relation between them. One student can be enrolled for more than one course and there can be many students enrolled for a single course. Design an effective data structure to store such data keeping in mind that the time complexity for search should be optimum. A search can be for the list of students enrolled for a single course, or for the list of courses a single student is enrolled.
- angshu1986 May 01, 2015 in India| Report Duplicate | Flag | PURGE
Morgan Stanley Java Developer Data Structures Java - 0of 0 votes
AnswersGiven a class Employee
class Employee { int age; String fName; String lName; }
An UI searches for employees using either 'FirstName LastName' or 'LastName FirstName'. Give a solution that will return the employee details, in O(1) time.
- angshu1986 April 21, 2015 in India
e.g. FirstName - John LastName - Walker
both John Walker and Walker John should work in O(1). Tried using a hashmap, but search would be O(2).| Report Duplicate | Flag | PURGE
Symantec Java Developer - 1of 1 vote
AnswersWrite a program for a word search. If there is an NxN grid with one letter in each cell. Let the user enter a word and the letters of the word are said to be found in the grid either the letters match vertically, horizontally or diagonally in the grid. If the word is found, print the coordinates of the letters as output.
- Tony April 16, 2015 in United States| Report Duplicate | Flag | PURGE
Epic Systems Java Developer Algorithm - 1of 1 vote
AnswersHow can you determine if an array is pre order representation of a binary tree. I started with the logic of creating binary tree using a pre order array and failure to create the tree will mean that the array is not a pre order representation, but got stuck in middle.
- angshu1986 April 16, 2015 in India| Report Duplicate | Flag | PURGE
Symantec Java Developer Data Structures - 0of 0 votes
AnswersIn our game there is a carousel with 8 seats in the center of the screen. On the left side of the carousel, there is an
- emcho.coh March 05, 2015 in United States
additional seat labeled ‘Start’ and to its right, a seat labeled ‘Finish’. There are 4 kids on the carousel at random
seats. You have an avatar who is initially found in the ‘Start’ seat
Your goal is to move your avatar to the ‘Finish’ seat. You move your avatar using the ‘Jump’ button. When clicking
the button the nearest seat to the current seat of your avatar is considered: if this seat is vacant, your avatar will
move to this vacant seat and you get 10 points, if the seat is taken you lose a life point.
The challenge is that the carousel is constantly rotating clockwise. To be clear, the carousel rotation is smooth (not in
steps of a seat).
If your lives go to 0, the game ends. When you reach the ‘Finish’ seat, you get 50 points and the carousel increase its
rotation speed, now your goal is to go back to the ‘Start’ seat, and on it goes.
Tips & comments:
• The tricky part of the exercise is the spinning carousel. Of course the seat and people that are on the
carousel are moving in circles. There are two ways that you can implement this:
1. By thinking of the table as standing still and the seats as moving in circles.
2. Using affine transforms.
We suggest that you use the first approach as it will be simpler. The second approach has some advantages,
but use it only if you are familiar with it.| Report Duplicate | Flag | PURGE
Java Developer - 3of 3 votes
AnswersHow to find efficiently the minimum of an array of integers that is the maximum of other arrays?
- wingchun0511 January 31, 2015 in France
Example:
A = [126, 110, 130]
B = [125]
C = [105, 115]
The minimum element of array A that is the maximum of B and C is 126| Report Duplicate | Flag | PURGE
Java Developer Algorithm Coding Java Online Test - 1of 1 vote
AnswersYou have a binary search tree and you have to return the two nodes such that there sum i equal to ‘K’. Pseudo code is to be given.
- tihor January 26, 2015 in India
O(n)time & O(n) sppace is easy but challenge O(n) time & O(1) space.| Report Duplicate | Flag | PURGE
Amazon Java Developer Algorithm - 9of 9 votes
AnswersWrite a function which will return a char from a given encoded string from given index without decoding string. e.g. from “a2bc3d4” ( means “aabcbcbcdddd” ) and index value is 7 means function should return c without decoding original string ?
- kumarraju05 January 19, 2015 in India| Report Duplicate | Flag | PURGE
makemytrip Java Developer Algorithm - 0of 0 votes
AnswersJava coding
- an25081981 January 04, 2015 in India
Given a file with the following entry
ID EMp_Name Manager_ID
1 "ABC" 2
2 "PRW" Null
3 "DEF" 2
4 "PRE" 3
5 "DKF" 4
Print the Respective Manager hierarchy in the below format
PRW | ABC |
| DEF | PRE | DKF
The Employe Manager table can be extended to Hold N entry| Report Duplicate | Flag | PURGE
JP Morgan Java Developer Coding - 0of 0 votes
Answersyou have 2 lists of points
- sultana.buet December 02, 2014 in switzerland for 5
- for one point in the first list, you have to find all the points in the second list that are in a certain radius with a fast algorithm| Report Duplicate | Flag | PURGE
StartUp Java Developer Algorithm - 0of 0 votes
AnswersCreate corpus reader and tokenizer
- fgfsdgs November 06, 2014 in United States
Write a program that creates an inverted index for this corpus, allowing searching for free
text, e.g. [dor cabeça], [efeitos adversos]
a) Use the index structure and contents that you consider more suitable/relevant;
b) Use a default list of stopwords and accept as optional argument a text file with
stopwords; Add the option to disable the use of the stopword filter;
c) Use the Porter stemmer as default, but you should allow disabling this;
d) Add the option to write / read the index to / from a text file.
2. Implement a ranked retrieval method based on the vector-space model and using the tf-idf
weighting scheme.
2.1. Use the queries and the list of relevant documents to evaluate your implementation (note:
these will be available later). Calculate and report the average precision for each query and
the mean average precision (MAP) over all queries.
docs-> EMEA Corpus ->https://drive.google.com/folderview?id=0B3Slz0zk1PRUSkxuTlE2VVl1Ym8&usp=sharing| Report Duplicate | Flag | PURGE
Informatica Java Developer - 0of 0 votes
AnswersHow many minimum numbers from fibonacci series are required such that sum of numbers should be equal to a given Number N?
- abdulhameed.pathan November 03, 2014 in India
Note : repetition of number is allowed.
Example1.
N= 7;
answer = 2 (5 + 2 = 7)
Example 2.
N = 70;
Answer = 3 (34 + 34 + 2)| Report Duplicate | Flag | PURGE
Alcatel Lucent Java Developer Brain Teasers Java - -1of 1 vote
AnswersHow to implement split () method
- kirann October 17, 2014 in United States| Report Duplicate | Flag | PURGE
Java Developer Algorithm Java