Travelfusion interview question

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.

Interview Answers

Anonymous

Apr 17, 2015

What is the bolded text in the form? It is not highlighted....

2

Anonymous

Jan 26, 2018

The bolded text in the form is: getElementById('sample') form name="sample"