Objective Questions
Objective Questions
Objective Questions
Question-1 : What will happen when you try compiling and running this code?
Question-2 : What is the result of attempting to compile and run the program?
import java.util.*;
class F {
public static void main (String[] args) {
Object v = new Vector();
System.out.print((v instanceof Collections)+",");
System.out.print((v instanceof Arrays)+",");
System.out.print(v instanceof List);
}
}
1. Prints: false,false,false
2. Prints: false,false,true
3. Prints: false,true,false
4. Prints: false,true,true
5. Prints: true,false,false
Question -3: Consider the following piece of code and select all statements which yield a boolean value
of true as a result.
Double d1=new Double(10.0);
Double d2=new Double(10.0);
int x=10;
float f=10.0f;
1. d1 == d2;
2. d1 == x;
3. f == x;
4. d1.equals(d2);
5. None of the above
Question -4: What is the result of attempting to compile and run the following program?
class Amber {
public static void main(String[] args) {
int[][] a = {{1,2},{0,1,2},{-1,0,2}};
Object[] obj = (Object[])a.clone();
for(int i = 0;i<obj.length; i++) {
int[] ia = (int[])obj[i];
System.out.print(ia[i]);
}
}
}
Question-5 : Which of the following files is the correct name and location of deployment descriptor of a
web application. Assume that the web application is rooted at\doc-root. Select the one correct answer.
1. \doc-root\dd.xml
2. \doc-root\web.xml
3. \doc-root\WEB-INF\web.xml
4. \doc-root\WEB_INF\dd.xml
5. \doc-root\WEB-INF\lib\dd.xml
1. Exception
2. Session
3. application
4. page
5. All of these are available
Question-7: Which of the following statements regarding HttpRequest methods are correct?
Question-8: Which of the following is not a standard method called as part of the JSP life cycle?
1.jspInit()
2.JspService()
3._jspService()
4.jspDestory()
Question-9 : What are the possible results of attempting to compile and run the program?