niusouti.com

单选题public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()AThe program runs and prints “0”BThe program 

题目
单选题
public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()
A

 The program runs and prints “0”

B

 The program runs and prints “1”

C

 The program runs but aborts with an exception.

D

 An error “possible undefined variable” at line 4 causes compilation to fail.

E

 An error “possible undefined variable” at line 9 causes compilation to fail.


相似考题
更多“单选题public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()A  The program runs and prints “0”B  The prog”相关问题
  • 第1题:

    public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()  

    • A、 The program runs and prints “0”
    • B、 The program runs and prints “1”
    • C、 The program runs but aborts with an exception.
    • D、 An error “possible undefined variable” at line 4 causes compilation to fail.
    • E、 An error “possible undefined variable” at line 9 causes compilation to fail.

    正确答案:B

  • 第2题:

    public class test(    public int aMethod()[   static int i=0;   i++;   return I;   )    public static void main (String args){   test test = new test();    test.aMethod();   int j = test.aMethod();   System.out.printIn(j);   ]  }   What is the result?()

    • A、 Compilation will fail.
    • B、 Compilation will succeed and the program will print “0”
    • C、 Compilation will succeed and the program will print “1”
    • D、 Compilation will succeed and the program will print “2”

    正确答案:D

  • 第3题:

    public class Test {  public int aMethod() {  static int i = 0;  i++;  return i;  }  public static void main (String args[]) {  Test test = new Test();  test.aMethod();  int j = test.aMethod();  System.out.println(j);  }  }  What is the result?()  

    • A、 0
    • B、 1
    • C、 2
    • D、 Compilation fails.

    正确答案:D

  • 第4题:

    public class test (      private static int j = 0;  private static boolean methodB(int k) (  j += k;  return true;  )  public static void methodA(int  i)(  boolean b:     b = i < 10 | methodB (4);  b = i < 10 || methodB (8);  )  public static void main (String args[])(   methodA (0);  system.out.printIn(j);  )  )   What is the result?()  

    • A、 The program prints “0”
    • B、 The program prints “4”
    • C、 The program prints “8”
    • D、 The program prints “12”
    • E、 The code does not complete.

    正确答案:B

  • 第5题:

    public class IfTest (   public static void main(stringargs) {   int x = 3;  int y = 1;   if (x = y)   system.out.printIn(“Not equal”);   else   system.out.printIn(“Equal”);   }   )   What is the result?()

    • A、 The output is “Equal”
    • B、 The output in “Not Equal”
    • C、 An error at line 5 causes compilation to fall.
    • D、 The program executes but does not print a message.

    正确答案:C

  • 第6题:

    class super (   public int I = 0;   public super (string text) (   I = 1   )   )     public class sub extends super (   public sub (string text) (   i= 2   )   public static void main (straing args) (  sub sub = new sub (“Hello”);   system.out. PrintIn(sub.i);  )   )   What is the result?()

    • A、 Compilation will fail.
    • B、 Compilation will succeed and the program will print “0”
    • C、 Compilation will succeed and the program will print “1”
    • D、 Compilation will succeed and the program will print “2”

    正确答案:A

  • 第7题:

    单选题
    1. public class X {  2. public static void main (String[]args)   {  3. int [] a = new int [1]  4. modify(a);  5. System.out.printIn(a[0]);  6. }  7.    8. public static void modify (int[] a)  {  9.   a[0] ++;  10.    } 11. }       What is the result?()
    A

     The program runs and prints “0”

    B

     The program runs and prints “1”

    C

     The program runs but aborts with an exception.

    D

     An error “possible undefined variable” at line 4 causes compilation to fail.

    E

     An error “possible undefined variable” at line 9 causes compilation to fail.


    正确答案: D
    解析: 暂无解析

  • 第8题:

    单选题
    public class X {   public static void main (Stringargs) {   String s1 = new String (“true”);   Boolean b1 = new Boolean (true);   if (s2.equals(b1)) {   System.out.printIn(“Equal”);   }   }   }   What is the result? ()
    A

     The program runs and prints nothing.

    B

     The program runs and prints “Equal”

    C

     An error at line 5 causes compilation to fail.

    D

     The program runs but aborts with an exception.


    正确答案: D
    解析: 暂无解析

  • 第9题:

    单选题
    public class IfTest (   public static void main(stringargs) {   int x = 3;  int y = 1;   if (x = y)   system.out.printIn(“Not equal”);   else   system.out.printIn(“Equal”);   }   )   What is the result?()
    A

     The output is “Equal”

    B

     The output in “Not Equal”

    C

     An error at line 5 causes compilation to fall.

    D

     The program executes but does not print a message.


    正确答案: C
    解析: 暂无解析

  • 第10题:

    单选题
    public class Test {  public int aMethod() {  static int i = 0;  i++;  return i;  }  public static void main (String args[]) {  Test test = new Test();  test.aMethod();  int j = test.aMethod();  System.out.println(j);  }  }  What is the result?()
    A

     0

    B

     1

    C

     2

    D

     Compilation fails.


    正确答案: D
    解析: 暂无解析

  • 第11题:

    单选题
    public class test {  public static void add3 (Integer i)  int val = i.intValue ( );  val += 3;  i = new Integer (val);  } public static void main (String args [ ] )  {  Integer  i = new Integer (0);  add3 (i);  system.out.printIn (i.intValue ( )  );  } What is the result?()
    A

     Compilation will fail.

    B

     The program prints “0”.

    C

     The program prints “3”.

    D

     Compilation will succeed but an exception will be thrown at line 3.


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    public class test (      private static int j = 0;  private static boolean methodB(int k) (  j += k;  return true;  )  public static void methodA(int  i)(  boolean b:     b = i < 10 | methodB (4);  b = i < 10 || methodB (8);  )  public static void main (String args[])(   methodA (0);  system.out.printIn(j);  )  )   What is the result?()
    A

     The program prints “0”

    B

     The program prints “4”

    C

     The program prints “8”

    D

     The program prints “12”

    E

     The code does not complete.


    正确答案: B
    解析: 暂无解析

  • 第13题:

    public class ForBar {   public static void main(String args) {   int i = 0, j = 5;   tp: for (;;) {   i ++;   for(;;)   if(i > --j) break tp;   }   system.out.printIn(“i = ” + i + “, j = “+ j);   }   }   What is the result? () 

    • A、 The program runs and prints “i=1, j=0”
    • B、 The program runs and prints “i=1, j=4”
    • C、 The program runs and prints “i=3, j=4”
    • D、 The program runs and prints “i=3, j=0”
    • E、 An error at line 4 causes compilation to fail.
    • F、 An error at line 7 causes compilation to fail.

    正确答案:A

  • 第14题:

    public class X {   public static void main (Stringargs) {   String s1 = new String (“true”);   Boolean b1 = new Boolean (true);   if (s2.equals(b1)) {   System.out.printIn(“Equal”);   }   }   }   What is the result? () 

    • A、 The program runs and prints nothing.
    • B、 The program runs and prints “Equal”
    • C、 An error at line 5 causes compilation to fail.
    • D、 The program runs but aborts with an exception.

    正确答案:A

  • 第15题:

     public class X {   public static void main (String[]args)   {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s)  {   s += “world!”;      }   }      What is the result?()    

    • A、 The program runs and prints “Hello”
    • B、 An error causes compilation to fail.
    • C、 The program runs and prints “Hello world!”
    • D、 The program runs but aborts with an exception.

    正确答案:A

  • 第16题:

    public class X {   public static void main (Stringargs) {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s) {   s += “world!”;   }   }   What is the result?() 

    • A、The program runs and prints “Hello”
    • B、An error causes compilation to fail.
    • C、The program runs and prints “Hello world!”
    • D、The program runs but aborts with an exception.

    正确答案:A

  • 第17题:

    public class test {   public static void add3 (Integer i){  int val = i.intValue ( );   val += 3;   i = new Integer (val);    }     public static void main (String args [ ] )  { Integer i = new Integer (0);    add3 (i);   system.out.printIn (i.intValue ( ) );   }    }   What is the result?()

    • A、 Compilation will fail.
    • B、 The program prints “0”.
    • C、 The program prints “3”.
    • D、 Compilation will succeed but an exception will be thrown at line 3.

    正确答案:B

  • 第18题:

    What will be written to the standard output when the following program is run?()   public class Qcb90 {   int a;   int b;   public void f() {  a = 0;   b = 0;   int[] c = { 0 };   g(b, c);   System.out.println(a + " " + b + " " + c[0] + " ");   }   public void g(int b, int[] c) {   a = 1;  b = 1;  c[0] = 1;  }   public static void main(String args[]) {   Qcb90 obj = new Qcb90();   obj.f();   }   }  

    • A、0 0 0
    • B、0 0 1
    • C、0 1 0
    • D、1 0 0
    • E、1 0 1

    正确答案:E

  • 第19题:

    单选题
    public class ForBar {   public static void main(String args) {   int i = 0, j = 5;   tp: for (;;) {   i ++;   for(;;)   if(i > --j) break tp;   }   system.out.printIn(“i = ” + i + “, j = “+ j);   }   }   What is the result? ()
    A

     The program runs and prints “i=1, j=0”

    B

     The program runs and prints “i=1, j=4”

    C

     The program runs and prints “i=3, j=4”

    D

     The program runs and prints “i=3, j=0”

    E

     An error at line 4 causes compilation to fail.

    F

     An error at line 7 causes compilation to fail.


    正确答案: C
    解析: 暂无解析

  • 第20题:

    单选题
    public class X {   public static void main (Stringargs) {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s) {   s += “world!”;   }   }   What is the result?()
    A

    The program runs and prints “Hello”

    B

    An error causes compilation to fail.

    C

    The program runs and prints “Hello world!”

    D

    The program runs but aborts with an exception.


    正确答案: D
    解析: 暂无解析

  • 第21题:

    单选题
    public class X {   public static void main (String[]args)   {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s)  {   s += “world!”;      }   }      What is the result?()
    A

     The program runs and prints “Hello”

    B

     An error causes compilation to fail.

    C

     The program runs and prints “Hello world!”

    D

     The program runs but aborts with an exception.


    正确答案: B
    解析: 暂无解析

  • 第22题:

    单选题
    public class test(  public int aMethod()[  static int i=0;  i++;  return I;  )  public static void main (String args[]){  test test = new test();  test.aMethod();  int j = test.aMethod();  System.out.printIn(j);  ]  }        What is the result?()
    A

     Compilation will fail.

    B

     Compilation will succeed and the program will print “0”

    C

     Compilation will succeed and the program will print “1”

    D

     Compilation will succeed and the program will print “2”


    正确答案: B
    解析: 暂无解析

  • 第23题:

    单选题
    What will be written to the standard output when the following program is run?()   public class Qcb90 {   int a;   int b;   public void f() {  a = 0;   b = 0;   int[] c = { 0 };   g(b, c);   System.out.println(a + " " + b + " " + c[0] + " ");   }   public void g(int b, int[] c) {   a = 1;  b = 1;  c[0] = 1;  }   public static void main(String args[]) {   Qcb90 obj = new Qcb90();   obj.f();   }   }
    A

    0 0 0

    B

    0 0 1

    C

    0 1 0

    D

    1 0 0

    E

    1 0 1


    正确答案: B
    解析: 暂无解析

  • 第24题:

    单选题
    public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()
    A

     The program runs and prints “0”

    B

     The program runs and prints “1”

    C

     The program runs but aborts with an exception.

    D

     An error “possible undefined variable” at line 4 causes compilation to fail.

    E

     An error “possible undefined variable” at line 9 causes compilation to fail.


    正确答案: C
    解析: 暂无解析