Java Trainee Interview Questions

30,830 java trainee interview questions shared by candidates

There is a group of n people. A serial killer comes and kills every kth person from the group and keeps on repeating this until there is only one person left and he spares the life of that person. Write an equation/algorithm which takes n and k as input and give the position of the guy who will be alive after the complete process. For eg: Let us assume there is a group of 13 (n) people and the serial killer kills every 3rd (k) person. The positions on which they are standing are marked 1 to 13. The order in which he kills will be: 3, 6, 9, 12, 2, 7, 11, 4, 10, 5, 1, 8. This way the guy on 13th positon will be saved.
avatar

Java Consultant

Interviewed at Xebia

3.8
Mar 5, 2016

There is a group of n people. A serial killer comes and kills every kth person from the group and keeps on repeating this until there is only one person left and he spares the life of that person. Write an equation/algorithm which takes n and k as input and give the position of the guy who will be alive after the complete process. For eg: Let us assume there is a group of 13 (n) people and the serial killer kills every 3rd (k) person. The positions on which they are standing are marked 1 to 13. The order in which he kills will be: 3, 6, 9, 12, 2, 7, 11, 4, 10, 5, 1, 8. This way the guy on 13th positon will be saved.

The questions I was asked are as follows :- 1. Difference between pass by value and pass by reference 2. Finding the largest number in an array 3. How would you test a Lamp ? 5. How would you test a Twitter application ? 6. Find a missing number in an array of sorted numbers. 7. What are primitive types and non primitives types. 8. How would you test a Restful Web Service
Sep 17, 2013

The questions I was asked are as follows :- 1. Difference between pass by value and pass by reference 2. Finding the largest number in an array 3. How would you test a Lamp ? 5. How would you test a Twitter application ? 6. Find a missing number in an array of sorted numbers. 7. What are primitive types and non primitives types. 8. How would you test a Restful Web Service

Viewing 321 - 330 interview questions

Glassdoor has 30,830 interview questions and reports from Java trainee interviews. Prepare for your interview. Get hired. Love your job.