UpWork (oDesk) & Elance Java v3 Test Question & Answers

Java v3 Test Question & Answer is really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is very valueable to acquire knowledge of this skill. Lets Start test.

Ques : What is the result of an attempt to compile and run the given program?

What would be the result if "java TwoTyre one two" is entered in the command line?Ans : one

Ques : What is the term to describe a situation where two or more threads are blocked forever, waiting for each other?Ans : deadlock

Ques : SQLException has a feature of chaining - identify the right code to execute the same from the following options:Ans : catch(SQLException e) { out.println(e.getMessage()); while((e=e.getNextException())!=null) { out.println(e.getMessage()); } }

Ques : Which statements are true regarding ServletContext Init Parameters in the deployment descriptor?Ans : They are set at deployment-time and can be updated at run-time.

Ques : Which of the following methods are members of the Vector class and allow you to input a new element?Ans : addElement

Ques : In which class is the notify method defined?Ans : Object

Ques : The principal finder method that must be implemented by every entity bean class is:Ans : findByPrimaryKey()

Ques : Which option lists Java access modifiers in the right order from the most permissive to the most restrictive?Ans : public, protected, []no modifier/default/package[], private

Ques : What should be the replacement of "//ABC" in the following code?

Ques : What will be the output, if the following program is run?public class Test8 { public static void main(String[] args) { System.out.println(Math.sqrt(-4)); }}Ans : NaN

Ques : What will be the output of this program?

public class Test {

public static void main(String args[]) {

int a, b; a = 2; b = 0; System.out.println(g(a, new int[] { b })); }

public static int g(int a, int b[]) {

b[0] = 2 * a; return b[0]; }}Ans : 4

Ques : There are three classes named A, B, and C. The class B is derived from class A and class C is derived from B. Which of the following relations are correct for the given classes?Ans : Any instance of B is an instance of A.

Ques : Which option could be used to see additional warnings about code that mixes legacy code with code that uses generics?Ans : -Xlint:unchecked

Ques : Assuming the servlet method for handling HTTPGET requests is doGet(HttpServletRequest req, HTTPServletResponse res), how can the request parameter in that servlet be retrieved?Ans : String value=req.getParameter("product");

Ques : Which of these is not an event listener adapter defined in the java.awt.event package?Ans : ActionAdapter

Ques : What would be the result of compiling and running the following code class?

Ques : As part of the type erasure process, when compiling a class or interface that extends a parameterized class or implements a parameterized interface, the compiler may need to create a synthetic method, called a _________.Ans : bridge method

Ques : What will be the output of the following code?public class MyTest {