You are on page 1of 6

Advanced Java MCQ Questions

1. Which method of HttpServletRequest is used to read the value of HTML form


elements

1. getInputText()
2. getValue()
3. getAttributes()
4. getParameter()

Answer: getParameter()

2. Which of the following variable declaration would NOT compile in a java program?

1. int 1_var;.;
2. int var;
3. int VAR;
4. int var1;

Answer: int 1_var;.;

3.Microsoft Intermediate Language is also termed as____________

1. MSIL
2. IL
3. CIL
4. All of above

Answer: All of above

4. Which of the Application Context Object is associated with Spring MVC


Application____________-

1. WebApplicationContext
2. AnnotationConfigApplicationContext
3. ClassPathXMLApplicationContext
4. DefaultListableBeanFactory

Answer: WebApplicationContext

5. Servlet technology is used to create a web application___________

1. resides at client side


2. resides at server side
3. resides at both server side and client side
4. None of these

Answer: resides at server side

6. What is the body of a Thread?


1. begin
2. execute
3. run
4. start

Answer: run

7. Which of the following are methods of form submission_____________

1. Post
2. get
3. All of above
4. None of Above

Answer: All of above

8. What is the type and value of the following expression? (Notice the integerdivision)-4
+ 1/2 + 2*-3 + 5.0

1. int -5
2. double-5.0
3. int-4
4. double-4.5

Answer: double-5.0

9. If a priority of a java thread is 3 then the default priority of its child thread will
be___________

1. 0
2. 5
3. 1
4. 3

Answer: 3

10. What are valid keywords___________

1. interface
2. instanceof
3. Implements
4. All of above

Answer: All of above

11. How many benefits of advanced java?

1. 3
2. 4
3. 2
4. 1

Answer: 4

12. Which of the following are methods of user request handling in servlet_______

1. doGet()
2. doPost()
3. All of the above
4. None of above

Answer: All of above

13. Which are legal declarations? (Choose all that apply)

1. short [] y
2. short x [];
3. short[5] x2;
4. All of above

Answer: All of above

14. Which of the following is wrapper class in java?

1. Integer
2. Float
3. Double
4. All of above

Answer: All of above

15. Which of the followings are the types of JIT?

1. Econo-JIT
2. Pre-JIT
3. Normal-JIT
4. All of the above

Answer: All of the above

16. What will be printed as the output of the following program? public class testincr {
public static void main(String args[]) { int i = 0; i = i++ + i; System.out.println(“I = ”
+i); } }

1. I=1
2. I=2
3. Error
4. I=0

Answer: I=1
17. Which one of these events will cause the thread to die?

1. when the execution of the run() method ends


2. on calling the sleep() method
3. on calling the wait() method
4. when the execution of the start() method ends

Answer: when the execution of the run() method ends

18. Use the following declaration and initialization to evaluate the Java expressions int a
= 2, b = 3, c = 4, d = 5; float k = 4.3f; System.out.println (c=c++);

1. 2
2. 5
3. 4
4. 8

Answer: 4

19. Returns the number of cells in a range that contain any value/label

1. CountA
2. Count
3. CountIf
4. List

Answer: CountA

20. Predict the output of following Java Programs. // filename Main.java class Test {
protected int x, y; } class Main { public static void main(String args[]) { Test t = new
Test(); System.out.println(t.x + " " + t.y); } }

1. 1,2
2. 1,1
3. 0,0
4. Error

Answer: 0,0

21. JEE stands for _________

1. Java Encode Edition


2. Java Expert Edition
3. Java Ended Edition
4. Java Enterprise Edition

Answer: Java Enterprise Edition

22. When was Java released?


1. 1994
2. 1995
3. 1975
4. 1996

Answer: 1995

23. What is the executable applet?

1. .object
2. .class
3. .method
4. .function

Answer: .class

24. What is the correct declaration of an abstract method

1. public void abstract method();


2. public abstract void method();
3. public final abstract void method();
4. public abstract method();

Answer: public abstract void method();

25. What is casting a value?

1. ratio
2. expression
3. operator
4. None

Answer: ratio

26. Which is one of the symbol of array?

1. []
2. {}
3. ()
4. <>

Answer: []

27. Which one of the following statement is not true about the collection interface?

1. list interface extends collection interface


2. all methods defined in set interface are also defined in collection interface
3. all methods defined in list interface are also defined in collection interface
4. set interface extends collection interface
Answer: all methods defined in set interface are also defined in collection interface

28. Which one is java token?

1. Operators
2. Identifiers
3. Literals
4. All of above

Answer: All of Above

29. Which is one of the initialization state?

1. init()
2. int()
3. inti()
4. initial()

Answer: init()

30. Consider the following class definition: public class MyClass { private int value;
public void setValue(int i){ / code / } // Other methods… } The method setValue assigns
the value of i to the instance field value. What could you write for the implementation of
setValue?

1. this.value = i;
2. value == i;
3. value = i;
4. Both 1 & 3

Answer: Both 1 & 3

You might also like