Java Trainee Interview Questions

30,830 java trainee interview questions shared by candidates

1. Please consider the HTML below. Assuming it is stored in a String variable, can you write a short Java program to retrieve all the ‘beverages’ from the list shown below. You should assume there could be any number of lists, with any number of items, and in any order, but there will only be one list of beverages. <html> <body> <p>Coders favourite music genre:</p> <ol> <li>House</li> <li>Ballad</li> <li>Dance</li> </ol> <p>Coders favourite beverage:</p> <ol> <li>Coffee</li> ................................................................................ <li>Tea</li> <li>Coke</li> </ol> <p>Coders favourite phrase:</p> <ol> <li>Pfff</li> <li>Damn</li> <li>It works</li> </ol> </body> </html> Consider the following HTML source of the page ‘test.html’ below: <html> <form name="sample" action=”?”> <input type="checkbox" name="field1" /> <input type="hidden" name="field2" id="field_2" /> <input type="radio" name="field3" value="X" /> <input type="radio" name="field3" value="Y" /> <input type="button" oncl1ck="document.getElementById('sample').submit();" value="Submit form" /> <input type=”submit” name=”clicked” value=”Click me” /> </form> </html> 2-Looking at the form above, to which page will the data be sent ? 3-What would be the HTTP method through which the form data will be transmitted ? 4-What will be the value of the checkbox ‘field1’, if the form was submitted as it is ? Hint: the checkbox that is not ticked. 5-What would be the result of clicking the ‘Submit form’ button ? Hint: see the bolded text above, before answering this question.
avatar

Java Developer

Interviewed at Travelfusion

3.3
Feb 17, 2015

1. Please consider the HTML below. Assuming it is stored in a String variable, can you write a short Java program to retrieve all the ‘beverages’ from the list shown below. You should assume there could be any number of lists, with any number of items, and in any order, but there will only be one list of beverages. <html> <body> <p>Coders favourite music genre:</p> <ol> <li>House</li> <li>Ballad</li> <li>Dance</li> </ol> <p>Coders favourite beverage:</p> <ol> <li>Coffee</li> ................................................................................ <li>Tea</li> <li>Coke</li> </ol> <p>Coders favourite phrase:</p> <ol> <li>Pfff</li> <li>Damn</li> <li>It works</li> </ol> </body> </html> Consider the following HTML source of the page ‘test.html’ below: <html> <form name="sample" action=”?”> <input type="checkbox" name="field1" /> <input type="hidden" name="field2" id="field_2" /> <input type="radio" name="field3" value="X" /> <input type="radio" name="field3" value="Y" /> <input type="button" oncl1ck="document.getElementById('sample').submit();" value="Submit form" /> <input type=”submit” name=”clicked” value=”Click me” /> </form> </html> 2-Looking at the form above, to which page will the data be sent ? 3-What would be the HTTP method through which the form data will be transmitted ? 4-What will be the value of the checkbox ‘field1’, if the form was submitted as it is ? Hint: the checkbox that is not ticked. 5-What would be the result of clicking the ‘Submit form’ button ? Hint: see the bolded text above, before answering this question.

"Suppose you have two different kinds of server requests - requests that MUST be responded to in 2 seconds and cannot be resent, and requests that can be responded to in 10 seconds, but can be resent. How would you handle the priority of responding to these requests?"
avatar

Back-end Java Engineer

Interviewed at Fanatics

3.3
May 20, 2016

"Suppose you have two different kinds of server requests - requests that MUST be responded to in 2 seconds and cannot be resent, and requests that can be responded to in 10 seconds, but can be resent. How would you handle the priority of responding to these requests?"

Viewing 311 - 320 interview questions

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