0

programming languages Online Quiz - 99

Description: programming languages Online Quiz - 99
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0
  1. It must have a package statement

  2. It must be named Test.java

  3. It must import java.lang

  4. It must declare a public class named Test


Correct Option: B

Given the JSP code: 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 pageContext object, inserted at line 6, assigns "bar" to the variable x?

  1. String x = (String) pageContext.getAttribute("foo");

  2. String x = (String) pageContext.getRequestScope("foo");

  3. It is NOT possible to access the pageContext object from within doStartTag.

  4. String x = (String)


Correct Option: D
  1. Collections.reverseSort(list, new MyComparator());

  2. Collections.sort(list, new MyComparator());

  3. Collections.sort(list, new InverseComparator(

  4. Collections.sort(list, Collections.reverseOrder(


Correct Option: D
  1. The type List is assignable to List.

  2. The type List is assignable to List>.

  3. The type List is assignable to List extends B>.

  4. The type List extends B> is assignable to List extends A>.

  5. The type List is assignable to any List reference.


Correct Option: B,C,D
  1. 3

  2. compilation error at line 1

  3. compilation error at line 2

  4. compilation error at line 3

  5. compilation error at line 4


Correct Option: B
  1. compilation error at line 1

  2. compilation error at line 2

  3. compilation error at line 3

  4. compilation error at line 4

  5. RuntimeException

  6. 3


Correct Option: E
  1. compilation error at line 1

  2. compilation error at line 2

  3. compilation error at line 3

  4. compilation error at line 4

  5. 3

  6. Runtime Exception


Correct Option: D
  1. compilation error at line 1

  2. compilation error at line 2

  3. compilation error at line 3

  4. compilation error at line 4

  5. 3

  6. Runtime Exception


Correct Option: A
  1. compilation error at line 1

  2. compilation error at line 2

  3. compilation error at line 3

  4. 2

  5. Runtime Exception


Correct Option: D

1.main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("%c%c%c%c",s[ i ],(s+i),(i+s),i[s]); }

  1. mmmmaaaannnn

  2. aaaammmmnnnn

  3. aaaannnnmmmm

  4. Compilation Error


Correct Option: A

main() { static int var = 5; printf("%d ",var--); if(var) main(); }

  1. 1 2 3 4 5

  2. 5 4 3 2 1

  3. compilation error

  4. None


Correct Option: B

main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

  1. 1 3 1 0 0

  2. 0 1 0 1 3

  3. 0 0 3 1 1

  4. 0 0 1 3 1


Correct Option: D
- Hide questions