第1题:
Given: 6.<% int[] nums = {42, 420, 4200}; 7.request.setAttribute("foo", nums); %> Which two successfully translate and result in a value of true?()
第2题:
5. String foo = “base”; 6. foo.substring(0,3); 7. foo.concat(“ket”) 8. Type the value of foo at line 8.()
第3题:
1. class SuperFoo { 2. SuperFoo doStuff(int x) { 3. return new SuperFoo(); 4. } 5. } 6. 7. class Foo extends SuperFoo { 8. //insert code here 9. } 下面哪三项分别插入到第8行,可以编译?()
第4题:
2. public class Foo implements Runnable ( 3. public void run (Thread t) { 4. system.out.printIn(“Running.”); 5. } 6. public static void main (String[] args) { 7. new thread (new Foo()).start(); 8. ) 9. ) What is the result?()
第5题:
3. string foo = “ABCDE”; 4. foo.substring(3); 5. foo.concat(“XYZ”); 6. Type the value of foo at line 6.()
第6题:
Given 1. public class Foo { 2. public static void main (String [] args) } 3. try { return;} 4. finally { Syste.out.printIn (“Finally”);} 5. } 6. } What is the result( )?
第7题:
第8题:
-1
255
127
Compilation will fail.
Compilation will succeed but the program will throw an exception at line 4.
第9题:
Foo has the value “”
Foo has the value null
An exception is thrown
The code will not compile
第10题:
An exception is thrown.
The program exists without printing anything.
An error at line 1 causes compilation to fail.
An error at line 6 causes the compilation to fail.
“Running” is printed and the program exits.
第11题:
Baz has the value of “”
Baz has the value of null
Baz has the value of “red”
Baz has the value of “blue”
Bax has the value of “green”
The program throws an exception.
第12题:
String value = getServletConfig( ).getParameter(“foo”);
String value = getServletContext( ).getAttribute(“foo”);
Object value = getServletContext( ).getInitParameter(“foo”);
String value = getServletContext( ).getInitParameter(“foo”)
第13题:
1. public class Test { 2. public static String output =””; 3. 4. public static void foo(int i) { 5. try { 6. if(i==1) { 7. throw new Exception(); 8. } 9. output += “1”; 10. } 11. catch(Exception e) { 12. output += “2”; 13. return; 14. } 15. finally { 16. output += “3”;17. } 18. output += “4”; 19. } 20. 21. public static void main(String args[]) { 22. foo(0); 23. foo(1); 24. 25. }26. } What is the value of the variable output at line 23?()
第14题:
1. interface foo { 2. int k = 0; 3. } 4. 5. public class test implements Foo ( 6. public static void main(String args[]) ( 7. int i; 8. Test test = new test (); 9. i= test.k; 10.i= Test.k; 11.i= Foo.k; 12.) 13.) 14. What is the result?()
第15题:
String foo = “blue”; Boolean[]bar = new Boolean [1]; if (bar[0]) { foo = “green”; } What is the result? ()
第16题:
Given the JSP code: <% request.setAttribute("foo", "bar"); %>and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()
第17题:
public class test( public static void main(stringargs){ string foo = args [1]; string foo = args ; string foo = args ; } ) And command line invocation: Java Test red green blue What is the result? ()
第18题:
int index = 1; String [] test = new String[3]; String foo = test[index]; What is the result?()
第19题:
第20题:
Baz has the value of “”
Baz has the value of null
Baz has the value of “red”
Baz has the value of “blue”
Bax has the value of “green”
The program throws an exception.
第21题:
第22题:
Foo has the value “”
Foo has the value null
An exception is thrown
The code will not compile
第23题:
${true or false}
${requestScope[foo][0] > 500}
${requestScope[’foo’][1] = 420}
${(requestScope[’foo’][0] lt 50) && (3 gt 2)}
第24题:
String x = (String) pageContext.getAttribute(foo)
String x = (String) pageContext.getRequestScope(foo)
It is NOT possible to access the pageContext object from within doStartTag
String x = (String) pageContext.getRequest().getAttribute(foo)
String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)