Advanced Java MCQ Questions
Advanced Java MCQ Questions
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;
1. MSIL
2. IL
3. CIL
4. All of above
1. WebApplicationContext
2. AnnotationConfigApplicationContext
3. ClassPathXMLApplicationContext
4. DefaultListableBeanFactory
Answer: WebApplicationContext
Answer: run
1. Post
2. get
3. All of above
4. None 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
1. interface
2. instanceof
3. Implements
4. All of above
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
1. short [] y
2. short x [];
3. short[5] x2;
4. All of above
1. Integer
2. Float
3. Double
4. All of above
1. Econo-JIT
2. Pre-JIT
3. Normal-JIT
4. 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?
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
Answer: 1995
1. .object
2. .class
3. .method
4. .function
Answer: .class
1. ratio
2. expression
3. operator
4. None
Answer: ratio
1. []
2. {}
3. ()
4. <>
Answer: []
27. Which one of the following statement is not true about the collection interface?
1. Operators
2. Identifiers
3. Literals
4. All of above
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