Java Interview Questions
- -1of 3 votes
Answershow to print this pattern
- premnath.velmurugan March 08, 2014 in India
input N=4
output :
4444444
4333334
4322234
4321234
4322234
4333334
4444444
input N=3
output :
33333
32223
32123
32223
33333| Report Duplicate | Flag | PURGE
Software Trainee Algorithm C# Data Structures Applications Developer Java - -3of 3 votes
AnswerString pool, equals method, create immutable class Person
- arun.md12 March 04, 2014 in India
collection Concurrency, blocked collection, dQueue, multi threading| Report Duplicate | Flag | PURGE
Morgan Stanley Software Engineer / Developer Java - 1of 1 vote
AnswersConstruct an iterator of iterator
- varunumesh77 February 26, 2014 in United States
Here is the below question format:
// E next();
// Boolean hasNext();
// input: Iterator<Iterator<E>>
// output: Iterator<E>
// [[1], [2, 3]] => [1, 2, 3]| Report Duplicate | Flag | PURGE
Amazon Intern Java - -1of 1 vote
AnswersWhat are the different ways of sorting the arrays in Java which is other than Arrays.sort(a1)
- deepak.us7 February 26, 2014 in United States| Report Duplicate | Flag | PURGE
Java - 3of 5 votes
AnswersA professor wants to see if two students have cheated when writing a paper. Design a function : hasCheated(String s1,String s2, int N) that evaluates to true if two strings have a common substring of length N. Additional question after implementation. Assume you don't have the possibility of using String.contains() and String.substring(). How would you implement this?
- dke.ade February 25, 2014 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Java - 4of 4 votes
AnswersGiven a list of 4 billion integers, find an integer not in the list using 4MB of memory. (interview was in Java)
- dke.ade February 25, 2014 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Java - -2of 2 votes
AnswersMake a JAVA program for an array of classes.
- Kanha February 24, 2014 in United States
class should have 4 or 5 attribute and Array should contain 10 data which all have that 4 or 5 attribute of class. And Retrieve each attribute from all data. (Like Array of structure in C).| Report Duplicate | Flag | PURGE
Java - 0of 0 votes
AnswersMake a Java/C program that takes n as input and gives you all sequence of n by using recurssion. For example if n=3, output will be:
- Kanha February 22, 2014 in United States
111
112
113
121
.........
........
331
332
333.| Report Duplicate | Flag | PURGE
Java - -1of 3 votes
AnswersWhat is polymorphism? what does it do?
- barrysingh1108@googlemail.com February 01, 2014 in UK| Report Duplicate | Flag | PURGE
Sage Software Intern Java - 0of 0 votes
AnswersThere are 2 arraylists each consisting of 1 million records.
- kmkswamy January 28, 2014 in India for Algorthims
Give me the same objects present in both the lists.
The objects in the list can be any thing of our choice.| Report Duplicate | Flag | PURGE
Algorithm Java - 0of 0 votes
Answersi have 2 class class employee which has empname and Title(manager,team lead) and class person which has name age and gender.. now i need to create a hasmap which has key and value pair as employee and person and if i give employee as key it should give me person values and if i give person as key it should give me employee value
- sandesh udupi January 26, 2014 in India| Report Duplicate | Flag | PURGE
Java Developer Java - 1of 1 vote
AnswersHow do you write a custom error handler in Java?
- A.K. January 15, 2014 in United States for Shared file| Report Duplicate | Flag | PURGE
Citrix System Inc Software Engineer / Developer Java - 0of 0 votes
Answerswhat happens when you re-throw an exception in Java?
- A.K. January 15, 2014 in United States for Shared file| Report Duplicate | Flag | PURGE
Citrix System Inc Software Engineer / Developer Java - 1of 1 vote
AnswersWhat is SOAP? What is REST? What are the major differences between SOAP & REST?
- A.K. January 15, 2014 in United States for Shared file| Report Duplicate | Flag | PURGE
Citrix System Inc Software Engineer / Developer Java - 5of 5 votes
AnswersYou need to develop the game Snake. What data structures will you use? Code your solution.
- GeorgyBoy December 30, 2013 in Israel| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm Coding Java Problem Solving - 0of 0 votes
AnswersAs a member of the cab finder app team, you are tasked with implementing a CabFinder class that has the following minimal public interface:
- ACE CA December 30, 2013 in United States
class CabFinder implements CabStatusListener {
/**
* Initiates CabFinder. Called only once per app startup.
* @app An application object providing services implemented by
* the rest of the application.
* @maxCabs Nearest number of cabs that can be returned to the user
*/
public void initialize(CabApp app, int maxCabs) {
//Insert code here...
}
/**
* Gets nearest cabs within 1km of the current user’s location.
* These must be the *nearest possible* @maxCabs in the 1km area.
* @return An unordered list of the nearest cabs.
*/
public Cab[] getNearestCabs() {
//Insert code here...
}
/**
* Asynchronous Callback per CabStatusListener (see below). Called when the position of a cab has changed.
*/
void onCabPositionChanged(Cab cab) {
//Insert code here…
}
/**
* Asynchronous Callback per CabStatusListener (see below). Called when a cab’s availability changes.
* @cab The cab whose availability has changed
* @isAvailable true if the cab is now available, false otherwise
*/
void onCabAvailabilityChanged (Cab cab, boolean isAvailable) {
//Insert code here…
}
}
Supporting Classes:
Here are the classes and utilities that are available for your use (you are not required to write any implementation for these classes)
/**
* Coordinates on a 2D map with a one meter granularity.
*/
class Position {
public int x;
public int y;
}
interface Cab {
/**
* Unique identifier of a cab.
*/
int getID();
/**
* Gets the current position of the cab
*/
Position getCabPosition();
/**
* Returns whether or not the cab is available
*/
boolean isAvailable();
}
/**
* Provides services implemented by the rest of the Cab Application.
*/
interface CabApp {
/**
* Gets the current location of the user
*/
Position getUserPosition();
/**
* Returns an iterator that gives access to the list of all cabs in the city
*/
Iterator<Cab> getCabs();
/**
* Registers a CabStatusListener object for change notifications of cab object data.
*/
void register(CabStatusListener listener);
}
/**
* The CabStatusListener interface
*/
interface CabStatusListener {
/**
* Called when the position of a cab has changed.
* @cab The cab object
*/
void onCabPositionChanged(Cab cab);
/**
* Called when a cab’s availability changes.
* @cab The cab object
* @isAvailable true if the cab is available, false otherwise
*
*/
void onCabAvailabilityChanged (Cab cab, boolean isAvailable);
}| Report Duplicate | Flag | PURGE
Java - 0of 0 votes
AnswersA String is given ilke--abdecadc...szx..any thing..like this...element in this given pattern can be any this(like int also and letter till z also)
- amit.grynch December 28, 2013 in India
you have to arrange in pattern--aabbcclike....ie.same charactor together...| Report Duplicate | Flag | PURGE
EMC Java Developer Java - 1of 1 vote
AnswersImplement data structure for garbage collector in java
- shrey.chaturvedi2525 December 23, 2013 in India| Report Duplicate | Flag | PURGE
Deshaw Inc SDE1 Java - 0of 0 votes
AnswersWe have a fictitious multi-level marketing scheme where a member can recruit one or more other members. At the end of the month, member’s payout is calculated at 10% of his direct sales (items the members sells
themselves) and 4% of sales generated by his recruits and their recruits.
Write a function that calculates the monthly compensation for all members given the original member. You can assume a member can only be recruited by a single existing member.
Given the following interface, please implement the MemberPayoutUtil.calculatePayout function.
- Albert1981 December 15, 2013 in United Statespublic interface Member { public double getMonthlySales(); private Collection<Member> getRecruitedMembers(); } public class MemberPayoutUtil { public static double calculatePayout(Member member) { // Implement me! } }
| Report Duplicate | Flag | PURGE
Amazon SDE1 Java - 0of 0 votes
Answersyou have the string ={ aabb, aafd,acff,aacg,.....} , if i am writing a as first char or first two char or first three char and so on, it should show the all unique combination of words started with the that characters for eg. say if iam writing aa then it show that aabb or aafd
- sandy December 10, 2013 in India
i have tried using hashmap is it increase my complexity or should i have to use list| Report Duplicate | Flag | PURGE
Samsung Network Engineer Algorithm Java - -2of 2 votes
Answerswhat is green thread in java..??
- s.sameer2606 December 05, 2013 in India| Report Duplicate | Flag | PURGE
Igate Java Developer Java - 1of 1 vote
AnswersGiven a list of ranges as input ((1,2),(3,4),(3,6),(8,10)),the output would be those ranges that don't overlap.For example, the output could be merging the ranges 1) (1,2),(3,4)
- aifra2000 December 02, 2013 in United States
2) (1,2) (3,6) etc
The output cannot contain (3,4),(3,6) as 3 is common to both| Report Duplicate | Flag | PURGE
Amazon Java Developer Java - 0of 0 votes
AnswersWrite an interface for HashMap.
- nosyDeveloper November 22, 2013 in United States| Report Duplicate | Flag | PURGE
Yahoo Software Development Manager Java - 0of 0 votes
Answersquicksort using divide and counquer . Need code please java
- fgfsdgs November 18, 2013 in United States| Report Duplicate | Flag | PURGE
Infosys Java Developer Java - 1of 1 vote
AnswersUsing a Java data structure, eliminate all unnecessary/stop words from a string. Assume you are given the string
- andreiarefiev November 14, 2013 in United States
"To be or not to be - that is the question: Whether it is nobler in the mind to suffer, the slings and arrows of outrageous fortune. Or to take up arms against a sea of troubles, and by opposing end them"
The unnecessary words to remove are "a", "be", "to", "the", "that", "this", "or"
So the resulting string should be like this
"not - is question: Whether it is nobler in mind suffer…| Report Duplicate | Flag | PURGE
Intuit Quality Assurance Engineer Java - 3of 3 votes
Answerswhen we have to override equals and hashcode in java..?
- PRASHANTGAURAV November 12, 2013 in India
what will happened if you dont override .. Explain with program.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Java - 3of 3 votes
Answerswhy strings are immutable ?
- tare.rohan November 11, 2013 in India
how many objects will be created in
String temp = "A" + "B" + "C" ;
explain your answer in detail.| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Java - 1of 3 votes
AnswersC={1,2,2,3,4,5}
- fgfsdgs November 09, 2013 in United States
Sum=5
subset;
{1,2,2}
{1,4}
{2,3}
using exhaustive force in java
ideas| Report Duplicate | Flag | PURGE
Palantir Technology iOS Developer Java - 0of 0 votes
Answershow do we compare two objects in java.
- gautam October 25, 2013 in India| Report Duplicate | Flag | PURGE
Software Trainee Java - -1of 1 vote
AnswersI am capturing the voice as buffer at client side and sending that buffer to server using Socket programming, then at server side I receive it and play using SourceDataLine , and its properly running on LAN but when I deploy it to Remote Server the voice carry noise data.
- zsanchit October 22, 2013 in India
tell me the solution.| Report Duplicate | Flag | PURGE
Java Developer Java
Open Chat in New Window