We have sent an email with your new password.

Close this window

Java 6 Test

40 Questions  I  By Pearlox
Java 6 Test
Pearlox Corp.

Java 6 Test

  
Changes are done, please start the quiz.


Question Excerpt

Removing question excerpt is a premium feature

Upgrade and get a lot more done!
1.  Which of these statements are true. Select the two correct answers
A.
B.
C.
D.
2.  Which of the following classes  will not allow unsynchronized read operations by multiple threads?
A.
B.
C.
D.
E.
3.   Which of the following statements are correct. Select the one correct answer
A.
B.
C.
D.
4.  class C {public static void main(String[] args) {double d1 = Math.floor(0.5);double d2 = Math.floor(1.5);System.out.print(d1 + "," + d2);}}
A.
B.
C.
D.
E.
5.  StringBuffer objects once created can not be modified
A.
B.
6.  Class C {public static void main(String[] args) {int[]a1[]=new int[3][3]; //3int a2[4]={3,4,5,6}; //4int a2[5]; //5}}What is the result of attempting to compile and run the program ?.
A.
B.
C.
D.
E.
7.  Using up to four characters what is the Java representation of the number 23 in hex?..............
8.  Given the following declarationsString s1=new String("1")String s2=new String("2");String s3=new String("true");String s3=new String("false");Which of the following are legal operations?
A.
B.
C.
D.
E.
9.  What gets printed when the following program is compiled and run? Select the one correct answer.class test { public static void main(String args[]) { int i; do { i++; } while(i < 0); System.out.println(i); }}
A.
B.
C.
D.
E.
10.  Which of the following are correct. Select the one correct answer.
A.
B.
C.
D.
11.  Which data type is wider for the purpose of casting: float or long?
A.
B.
12.  What should be done to invoke the run() method on a thread for an object derived from the Thread class. Select the one correct answer.
A.
B.
C.
D.
13.  What is the best way to findout the time/memory consuming process?
A.
B.
C.
D.
E.
14.  class C {  public static void main ( String ka [ ] ) {          while ( false ) {                  System.out.println ( "Value" ) ;          }  }}
A.
B.
C.
D.
15.  class c1{   void go(){}}class c2 extends c1{ String go(){  return null;}}
A.
B.
C.
D.
16.   In implementing two classes Employee and Manager, such that each Manager is an Employee, what should be the relationship between these classes. Select the one correct answer.
A.
B.
C.
D.
E.
17.  class c2{{ System.out.println("initializer");}public static void main(String a[]){System.out.println("main"); c2 ob1=new c2();}}
A.
B.
C.
D.
18.   Given two non-negative integers a and b and a String str, what is the number of characters in the expression str.substring(a,b) . Select the one correct answer.
A.
B.
C.
D.
E.
19.  if(0.0 == -0.0) {  System.out.println("true");}else{    System.out.println("false");}
A.
B.
20.  In Java technology what expression can be used to represent number of elements in an array named arr ? ...........
21.  class C{public static void main (String[] args) {String s1="hjhh";        // 1String s2="\u0002";      //2String s3="'\\'";        //3}}
A.
B.
C.
D.
E.
22.  class H {  public static void main (String[] args) {    String s1 = "HHH";    StringBuffer sb2 = new StringBuffer(s1);    System.out.print(sb2.equals(s1) + "," + s1.equals(sb2));}}
A.
B.
C.
D.
E.
23.  What is the number displayed when the following program is compiled and run.class test {    public static void main(String args[]) {        test test1 = new test();            System.out.println(test1.xyz(100));        }    public int xyz(int num) {        if(num == 1) return 1;        else return(xyz(num-1) + num);    }}
24.  Consider the codeint[] x = {5,6,7,8,9};int[] y = x;y[2] = 10;What is the value of x[2]?
A.
B.
C.
D.
E.
25.  class C{static String m(int i) {return "int";}static String m(float i) {return "float";}public static void main (String[] args) {long a1 = 1; double b1 = 2;System.out.print(m(a1)+","+ m(b1));}}
A.
B.
C.
D.
E.
26.  interface I{void f1();              // 1public void f2();       // 2protected void f3();    // 3private void f4();      // 4abstract void f5();     // 5}
A.
B.
C.
D.
E.
27.  What gets printed when the following program is compiled and run? Select the one correct answer.class xyz {    static int i;    public static void main(String args[]) {        while (i < 0) {            i--;        }        System.out.println(i);    }}
A.
B.
C.
D.
E.
28.  What is the number of bytes used by Java primitive long. Select the one correct answer.
A.
B.
C.
D.
E.
29.  The relationship between a class and its superclass is
A.
B.
C.
30.  What will be the output if you compile and run the following code ?public class Main{ private static int i; public static void main(String[] args){ System.out.println(i); }}
A.
B.
C.
D.
E.
31.  When a byte is added to a char, what is the type of the result?
A.
B.
C.
D.
32.  Which of the following modifiers can be applied to a class that is not a nested class?
A.
B.
C.
D.
33.  Is the following statement true or false. The constructor of a class must not have a return type.
A.
B.
34.  What Locale object represent?
A.
B.
C.
D.
E.
35.  What is the result of evaluating the expression 14 ^ 23. Select the one correct answer
A.
B.
C.
D.
E.
36.  class C {  private String get ( String str ) {          try          {                  throw new Exception ( ) ;                  return str ;          }          catch ( Exception e )          {                  return null ;          }  }  public static void main ( String peace [ ] ) {          try          {                  System.out.println ( ( new C ( ) ).get ( " C " ) ) ;          }          catch ( Exception e )          {                  System.out.println( "Exception" ) ;          }  }};
A.
B.
C.
D.
37.  class c1{public static void main(String a[]){    System.out.println(Double.NaN==Double.NaN);    System.out.println(Double.NaN!=Double.NaN);    System.out.println(Float.NaN==Double.NaN);}}
A.
B.
C.
D.
E.
38.  What is returned when the method substring(2, 4) is invoked on the string "example"? Include the answer in quotes as the result is of type String. .........
39.  class c1{public static void main(String a[]){c1 ob1=new c1();Object ob2=ob1;System.out.println(ob2 instanceof Object);System.out.println(ob2 instanceof c1);}}
A.
B.
C.
D.
E.
40.   Which of the following are true. Select the one correct answers
A.
B.
C.
D.
Back to top

Removing ad is a premium feature

Upgrade and get a lot more done!
Take Another Quiz