Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions Java interview question
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


The Legendery
Java interview question
0 Answer(s)      a year and 9 months ago
Posted in : Java Interview Questions


Hello i had an online test in some company and i didn't succeed in doing it(they gave me a timeline) this was the test:

Problem:

1) You have a bunch of log files in:

 C:\CloudShareCodeChallenge\Challenge 

 Sample data with expected results (below) in C:\CloudShareCodeChallenge\Sample

2) Each file may contain two types of records, user records and payment records; you must process all files

3) User records are in the form of UR,<User Identifier>,<First name>,<Last name>

 User records are guaranteed to be unique

4) Payment records are in the form of PR,<Payment Identifier>,<User Identifier>,<Amount>

 There is a bug in the payments processor, and same payments MAY appear more than once

(hence double booking)

You should only take into account one payment per payment id.

5) Important notes:

You may assume all records are correct (parsing wise): only one comma per field, no decimal 
 point in amount and no missing fields, so you may use split etc. for that.

Files are not ordered, so depending on how you read the files you may get a payment record
 before the corresponding user record 

Each file name contains a two letter field records_M2_2TFA7.log only payment records starting
 with those two characters will be in the file

Payments with same prefix may span on more than one file.

All log files must be processed

Keep it clean and simple

If you feel you must add comment, rewrite the code to be self-explanatory.

All the clues/notes above are important :)

6) Your tasks:

Provide the list of the top 10 paying users: Full name and amount

Provide the most common and least common first names with count

Note: There may be more than one name

Provide the number of double booking payments:

   Either in thousandth of percent from the total number of payments 3 decimal points

   For 5% you should show 50.000

   For 0.2345% you will show 2.345

   Or a fraction 12,3435 / 100,000,000

Bonus Questions: How would you write the generator for the above problem

What would you take under consideration, what would be the challenges

Sample data processing results: Payments Ratio = 45.898 (235 / 5120)

Most common name(s): Hugh: 2

Most common name(s): Julio: 2

Most common name(s): Nelson: 2

Most common name(s): Sofia: 2

Most common name(s): Zelma: 2

Least common name(s): Annabelle: 1

Least common name(s): Chandra: 1

Least common name(s): Clayton: 1

Least common name(s): Cody: 1

Least common name(s): Gay: 1

Least common name(s): Guy: 1

Least common name(s): Jerri: 1

Least common name(s): Jessie: 1

Least common name(s): Julianne: 1

Least common name(s): Serena: 1

Top paying users:

Nelson Sensabaugh : 42669

Hugh Maginnis : 39375

Annabelle Glade : 30252

Jerri Bartee : 26393

Chandra Bottorff : 21221

Julianne Deller : 19624

Zelma Lubinsky : 17051

Nelson Caicedo : 16191

Sofia Lucena : 13779

Guy Gratton : 12150

There were 545 files and in each one there were approximitally 260,000 lines Where each line can be a payment record and the line is looking like this one: PR,U3VT2406XY5AC2,I8MKX,53 (of course Payment Identifier,User Identifier,Amount are not the same for each line)

And there can be lines which represent user record and those lines are like this one: UR,B7R1W,Nelson,Hornyak (of course User Identifier,First name,Last name are not the same for each line)

They gave an eclipse environment and said to do it in Java(Regular java programming),but I didn't know how and what things to use? Do I make an HashMap of more than a 100 million entries? Do I use different things? What is the algorithms that I should use and how? I just graduated so unfortunately I didn't succeed in doing this test but I really want to know how to do it?


Advertisement
View Answers

Related Tutorials/Questions & Answers:
java interview question and answer - Java Interview Questions
java interview question and answer   sir, i want one mark java interview question and answers
Interview question link - Java Beginners
Interview question link  Hi, I want JAVA+J2EE interview question and answer please suggesion me link
Advertisements
Java Interview Question
Java Interview Question  Java program Interview Question :i have a file which contains characters and integers in mixed format. for example :--> abd12 g156bcd etc Now how would i rearrange the file sothat the characters
Core Java Interview Question, Interview Question
Core Java Interview Question   ....   Core Java Interview Question Page 1 How could Java... to a file?      Core Java Interview Question Page 2
interview question - Java Interview Questions
interview question  hello i want technical interview question in current year   Hi Friend, Please visit the following links: http://www.roseindia.net/interviewquestions/ http://www.roseindia.net
java interview question
java interview question  what is the usage of abstract class
java interview question
java interview question  when will we use abstraction or interface
Interview Question - Java Interview Questions
Interview Question  I need Interview Questions on Java,J2EE Pls help me
Interview question - Java Interview Questions
Interview question   Hi Friends, I am new to java, can u tell me what is class ,object and instance with example. For example : class raja , raja r = new raja(); ,here raja is class and r is instance
Interview question - Java Interview Questions
Interview question   Hi Friends, Give me details abt synchronization in interview point of view. I mean ow to explain short and neat. Thanks
Core Java Interview Question, Interview Question
Core Java Interview Question Page 14       Question: What is clipping? Answer: Clipping... that is implemented in a language other than Java. Question: Can a for statement loop
Core Java Interview Question, Interview Question
Core Java Interview Question Page 21       Question: How are the elements of a GridLayout... and are laid out using the squares of a grid. Question: What an I/O filter? Answer: An I
Core Java Interview Question, Interview Question
Core Java Interview Question Page 17       Question: What is the difference between... application window that can have a menu bar. Question: Which class is extended by all
Core Java Interview Question, Interview Question
Core Java Interview Question Page 22       Question: What is a compilation unit? Answer: A compilation unit is a Java source code file. Question: What interface
Core Java Interview Question, Interview Question
Core Java Interview Question Page 23       Question: To what value is a variable... and interfaces that are loaded by a Java program. Question: How does a try statement
Interview Question - Java Interview Questions
Interview Question  1)If we give S.O.P. statement after finally block shall it prints or not? 2)Write a program in java to read a file & write in to another file? 3)Write a program taking two arrays and compare those two
Core Java Interview Question, Interview Question
Core Java Interview Question Page 27       Modifiers Question: What are access modifiers... written in non java language Question: What are transient variables
Core Java Interview Question, Interview Question
Core Java Interview Question Page 18       Question: Is &&= a valid Java operator? Answer: No, it is not. Question: Name the eight primitive Java
Core Java Interview Question, Interview Question
Core Java Interview Question Page 2   .... Question: What comes to mind when you hear about a young generation in Java... mentions a shallow copy in Java? Answer: Object cloning. Question: If you're
Core Java Interview Question, Interview Question
Core Java Interview Question Page 26       Language Fundamentals Question: How... 64 - - Question: What types
Core Java Interview Question, Interview Question
Core Java Interview Question Page 16  ... implementation is deferred to a subclass. Question: How are Java source code files... and interfaces. Source code files use the .java extension. Question: What
Core Java Interview Question, Interview Question
Core Java Interview Question Page 12       Question: What is a transient variable? Answer... collections of objects. Question: How does Java handle integer overflows
Core Java Interview Question, Interview Question
Core Java Interview Question Page 15  ... is to provide access to the Java runtime system. Question: How many times may... takes an argument of the String[] type. Question: Which Java operator is right
Core Java Interview Question, Interview Question
Core Java Interview Question Page 32   ... Question: What is the ultimate ancestor of all java classes Answer: Object class is the ancestor of all the java classes Question: What
Core Java Interview Question, Interview Question
Core Java Interview Question Page 13       Question: What is an Iterator interface? Answer.... Question: What is the difference between the >> and >>> operators
Core Java Interview Question, Interview Question
Core Java Interview Question Page 30       Objects and Classes Question: What's... while regular methods could be called many times. Question: What
Core Java Interview Question, Interview Question
Core Java Interview Question Page 19       Question: What is the difference between static... variables take on unique values with each object instance. Question: What
Core Java Interview Question, Interview Question
Core Java Interview Question Page 20       Question: Name four Container classes. Answer: Window, Frame, Dialog, File Dialog, Panel, Applet, or ScrollPane Question: What
Core Java Interview Question, Interview Question
Core Java Interview Question Page 25  ... be called. Question: Does java support virtual functions Answer: No java... Question: What is JVM Answer: When we install a java package
Core Java Interview Question, Interview Question
Core Java Interview Question Page 24       Question: Why do we need public static void main.... Question: What is reflection in java Answer: Reflection allows Java code
Core Java Interview Question, Interview Question
Core Java Interview Question Page 11       Question: What is serialization ?  Answer: Serialization is the process of writing complete state of java object
Advertisements
 

 

 

DMCA.com