Java Interview Questions
- 0of 0 votes
AnswerIt is part of a programming exercise.
- joyfeng November 19, 2015 in United States
Input is a combination of arbitrary complex filters. For example:
name = "smith" AND age > 9 OR Not(city = "New York")
It asks for a string representation, including the ability to generate and parse filters from the string representation. (you are not required to implement the string parsing logic since this could take too long)
Hint: give an example of a tree data structure.| Report Duplicate | Flag | PURGE
unknown Software Engineer / Developer Java - 0of 0 votes
AnswerTest Question
- rafitoapp1 October 02, 2015 in United States| Report Duplicate | Flag | PURGE
ThoughtWorks Software Engineer Java - 0of 0 votes
AnswersProblem Two: Conference Track Management
- rafitoapp1 October 02, 2015 in United States
You are planning a big programming conference and have received many proposals which have passed the initial screen process but you're having trouble fitting them into the time constraints of the day -- there are so many possibilities! So you write a program to do it for you.
• The conference has multiple tracks each of which has a morning and afternoon session.
• Each session contains multiple talks.
• Morning sessions begin at 9am and must finish by 12 noon, for lunch.
• Afternoon sessions begin at 1pm and must finish in time for the networking event.
• The networking event can start no earlier than 4:00 and no later than 5:00.
• No talk title has numbers in it.
• All talk lengths are either in minutes (not hours) or lightning (5 minutes).
• Presenters will be very punctual; there needs to be no gap between sessions.
Note that depending on how you choose to complete this problem, your solution may give a different ordering or combination of talks into tracks. This is acceptable; you don’t need to exactly duplicate the sample output given here.
Test input:
Writing Fast Tests Against Enterprise Rails 60min
Overdoing it in Python 45min
Lua for the Masses 30min
Ruby Errors from Mismatched Gem Versions 45min
Common Ruby Errors 45min
Rails for Python Developers lightning
Communicating Over Distance 60min
Accounting-Driven Development 45min
Woah 30min
Sit Down and Write 30min
Pair Programming vs Noise 45min
Rails Magic 60min
Ruby on Rails: Why We Should Move On 60min
Clojure Ate Scala (on my project) 45min
Programming in the Boondocks of Seattle 30min
Ruby vs. Clojure for Back-End Development 30min
Ruby on Rails Legacy App Maintenance 60min
A World Without HackerNews 30min
User Interface CSS in Rails Apps 30min
Test output:
Track 1:
09:00AM Writing Fast Tests Against Enterprise Rails 60min
10:00AM Overdoing it in Python 45min
10:45AM Lua for the Masses 30min
11:15AM Ruby Errors from Mismatched Gem Versions 45min
12:00PM Lunch
01:00PM Ruby on Rails: Why We Should Move On 60min
02:00PM Common Ruby Errors 45min
02:45PM Pair Programming vs Noise 45min
03:30PM Programming in the Boondocks of Seattle 30min
04:00PM Ruby vs. Clojure for Back-End Development 30min
04:30PM User Interface CSS in Rails Apps 30min
05:00PM Networking Event
Track 2:
09:00AM Communicating Over Distance 60min
10:00AM Rails Magic 60min
11:00AM Woah 30min
11:30AM Sit Down and Write 30min
12:00PM Lunch
01:00PM Accounting-Driven Development 45min
01:45PM Clojure Ate Scala (on my project) 45min
02:30PM A World Without HackerNews 30min
03:00PM Ruby on Rails Legacy App Maintenance 60min
04:00PM Rails for Python Developers lightning
05:00PM Networking Event| Report Duplicate | Flag | PURGE
ThoughtWorks Software Engineer Java - 1of 1 vote
AnswersTest Question, this is a test question
- rafitoapp1 October 02, 2015 in United States| Report Duplicate | Flag | PURGE
ThoughtWorks Software Engineer Java - 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
AnswersGiven a 2-dimensional square matrix, rotate the matrix clockwise. Imagine concentric circles. Input from stdin: first line is length, subsequent lines are rows of the matrix. Output the matrix to stdout. This was one of the questions. You have 2 hrs to complete it.
- Yev September 02, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Java - 0of 0 votes
AnswersGiven a positive integer, rearrange its digits to find the greatest positive integer. Expected time/space complexity O(1). I was to do this in space O(1), time O(n).
- Yev September 01, 2015 in United States| Report Duplicate | Flag | PURGE
OptionsCity Software Engineer Java - 0of 0 votes
AnswersCompany will start a new marketing campaign targeting the users according
- JavaBuddy August 22, 2015 in United States
to their purchasing profiles.
This campaign has 3 kinds of messages each one targeting one group of customers:
Message 1 - targets the 25% of customers that spend most at the site
Message 2 - targets the 25% of customers that spend least at the site
Message 3 - targets the rest of the customers.
Given the list of purchases made during the week, write a program that lists
what kind of message each customer will receive.
Each purchase in this list features the customer id, the purchase amount among other information.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm Java - 0of 0 votes
AnswersDesign a system java same as relational database.
For example,
You Have employee table as bellow:ID | Name | Manager | Salary
Now you can execute queries like :
select * from Employee where ID= ' something' select * from Employee where Name= ' something' select * from Employee where salary = ' something'
In same way you have a class Emplyee as bellow:
class Employee { String ID; String Name; String Salary; String Manager; }
Now I want to query on this class as same as the sql queries above,
- Ghosh August 17, 2015 in India
How can I do it efficiently?
The code should be optimized on time complexity and space complexity.| Report Duplicate | Flag | PURGE
Oracle Software Architect Algorithm Data Structures Java Object Oriented Design - 0of 0 votes
AnswersWrite a function to generate pascal triangle (use recursion)
- chad August 05, 2015 in United States
public static int[] generatePascal(int level)| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Java - 0of 0 votes
AnswersHow do you decide whether we should use Java or C++ for a particular project . what are pros and cons
- chad August 01, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP SDE-2 Java - 0of 0 votes
AnswerHow does garbage collector work ? In mark and sweep , how does gc know which objects it needs to mark , how are references stored for objects for gc to understand that its reference is null or it is no more referenced anywhere j
- chad August 01, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP SDE-2 Java - 0of 0 votes
AnswerThere are five classes having inheritance a,b,c,d,e. We have to solve an equation with all the possible methods defined in the above classes.We have multiply(), add(),subtract() and divide() methods in the above classes.
- manishvashishtha01 July 28, 2015 in United States| Report Duplicate | Flag | PURGE
Java - 1of 1 vote
AnswersGiven a hashmap, HashMap<String,List<String>> with the following data:
- Yev July 16, 2015 in United States
A: B,C
B: X Y
X: Z
Y: Z
Expected output is an array of the dependencies. I initially started with Breadh-first search for simplicy, which had running O(|V|+'E') and space O(|V|). The interviewer said depth-first search is better; I don't see how DFS is better, because it requires recursion.
Part2: He then said my solution is functionally correct and then introduced a circular dependency and asked how to resolve it. I said using a visited hashset will detect a circular dep. He said it's not quite right and there a few approaches.| Report Duplicate | Flag | PURGE
Here Software Developer Java - 0of 0 votes
AnswersGiven a string of english characters. Find the character that appears only once. I used arr[256] to store a count of each character. Then, iterate over the array to find the first non-dup, a[iter+'a']==1. The interviewer thought that storing a[iter]='x' (dup) and a[iter]=<index> was a better solution to avoid running a second pass over the string. In my mind, I disagreed using the array index, one can find the character that appears only once. The interviewer persisted, and told me to think about it.
- Yev July 16, 2015 in United States| Report Duplicate | Flag | PURGE
Here Software Developer Java - 0of 0 votes
AnswersPassing objects and correct the program:---
- Avinash July 14, 2015 in United States
class OdemoA
{
int i,j;
void function1(int i)
{
System.out.println(i);
System.out.println("Inside function()");
}
void function2(Area a1)
{
if(a1!=null)
{
a1.i=203;
a1.j=115;
}
System.out.println(a1);
System.out.println("end of function2()");
}
public static void main(String args[])
{
OdemoA d1 = new OdemoA();
Area a2 = new Area();
d1.function2(a2);
System.out.println(a2.i);
System.out.println("end main");
}
}| Report Duplicate | Flag | PURGE
ADP Developer Program Engineer Java - 0of 0 votes
AnswersHello , I must write a program that given the elements in a list , generates all combinations of these elements .
- pasquale.restaino1992 July 06, 2015 in United States
For example, if I [A, B , C ] , the possible combinations are [ A] , [B ] , [ C ] , [A, B ] . [ A, C ] , [ B, C ] , [A, B , C ] . Another example , having [ A, A, B] the possible combinations are [ A] , [ A, A ] , [A, B ] , [ A, A, B, A ] .
How can I write it in java ?| Report Duplicate | Flag | PURGE
Java - 0of 0 votes
Answerswrite a java program display the sub string from a string without using string function
- vivek260394 June 11, 2015 in India for 1| Report Duplicate | Flag | PURGE
Developer Program Engineer Java - 0of 0 votes
AnswersHave you done debugging in JVM? How would you do it.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Data Structures Java Knowledge Based Testing test - 0of 0 votes
Answerswhat's use of equals and hashcode function?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Coding Hash Table Java Object Oriented Design - 0of 0 votes
Answershashmap implementation?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Algorithm Coding Hash Table Java - -1of 1 vote
Answervector vs arraylist
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Coding Java Object Oriented Design - 0of 0 votes
Answerhashtable vs hashmap
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Coding Hash Table Java - 0of 0 votes
AnswersIs memory leaks possible in Java?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Java Testing - 0of 0 votes
AnswerHow Garbage collector know if something is not used and needs to be removed?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Coding Compiler Debugging Java - 0of 0 votes
Answersdifference between java7 and java8?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Java - 0of 0 votes
Answersjava vs javascript
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Java - 0of 0 votes
Answersstack vs heap
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Ebay Software Developer Java - 0of 0 votes
AnswersDoes JavaScript has inheritance?
- Tom Walker June 07, 2015 in United States
Can you override in JavaScript?| Report Duplicate | Flag | PURGE
Amazon Software Developer Java JavaScript Object Oriented Design - 0of 0 votes
AnswersWhat's difference between Javascript and JAVA in terms of OOP principles. Provide examples.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Coding Java JavaScript Object Oriented Design