网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
int i = 0;  for (; i <4; i += 2) {  System.out.print(i + “”);  }  System.out.println(i);  What is the result?()
A

 0 2 4

B

 0 2 4 5

C

 0 1 2 3 4

D

 Compilation fails.

E

 An exception is thrown at runtime.


参考答案

参考解析
解析: 暂无解析
更多 “单选题int i = 0;  for (; i 4; i += 2) {  System.out.print(i + “”);  }  System.out.println(i);  What is the result?()A  0 2 4B  0 2 4 5C  0 1 2 3 4D  Compilation fails.E  An exception is thrown at runtime.” 相关考题
考题 有以下程序#include stdio.hmain(){ int a[ ]={2,3,5,4},i;for(i=0;i4;i++)switch(i%2){ case 0:switch(a[i]%2){case 0:a[i]++;break;case 1:a[i]--;}break;case 1:a[i ] =0;}for(i=0;i4;i++) printf("%d",a[i]); printf("\n");}程序运行后的输出结果是A)3 3 4 4B)2 0 5 0C)3 0 4 0D)0 3 0 4

考题 下列代码的执行结果是______。int numbers[]=new int[6];for(int i=1;i<numbers.length;i++){numbers[i]=i-1;System.out.print(numbers[i]+"");}A) 0 1 2 3 4 5B) 1 2 3 4 5 6C) 0 1 2 3 4D) 1 2 3 4 5A.B.C.D.

考题 以下程序的运行结果是( ) #define MAX 10 int a[MAX],i; main() { printf("\n");sub1();sub3(A) ,sub2(),sub3(A) ; } sub2() { int a[MAX],i,max; max=5; for(i=0;i<max;i++)a[i]=i; } sub1() {for(i=0;i<MAX;i++)a[i]=i+i; } sub3(int a[]) { int i; for(i=0;i<MAX,i++)printf("%d",a[i]); printf("\n"); }A.0 2 4 6 8 10 12 14 16 18 0 1 2 3 4B.0 1 2 3 4 0 2 4 6 8 10 12 14 16 18C.0 1 2 3 4 5 6 7 8 9 0 1 2 3 4D.0 2 4 6 8 10 12 14 16 18 0 2 4 6 8 10 12 14 16 18

考题 下面程序的执行结果是______。 #define MAX 10 nt a[MAX],i; main() { printf("\n"); sub1();sub3(A) ; sub2();sub3(A) ; } sub1() {for(i=0;i<1MAX;i++) a[i]-i+i; } sub2() {int a[MAX],i,max; max=5; for(i=0;i<max;i++) a[i]=i; } sub3(int a[]) { int i; for(i=0;i<MAX;i++) printf("%d",a[i]); printf("\n"); }A.0 2 4 6 8 10 12 14 16 18 0 1 2 3 4B.0 1 2 3 4 0 2 4 6 8 10 12 14 16 18C.0 1 2 3 4 5 6 7 8 9 0 1 2 3 4D.0 2 4 6 8 10 12 14 16 18 0 2 4 6 8 10 12 14 16 18

考题 有以下程序#includestdio.hmain( ){int a[]={2,3,5,4},i;for(i=0;i4;i++)switch(i%2){case 0:switch(a[i]%2){case 0:a[i]++;break;case 1:a[i]--;}break;case 1:a[i]=O;}for(i=O;i4;i++)prinff(“%d”,a[i]);prinff(“\n”);}程序运行后的输出结果是A.3 3 4 4B.2 0 5 0C.3 0 4 0D.0 3 0 4

考题 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.println(i.intValue());  }  }   What is the result? () A、 0B、 3C、 Compilation fails.D、 An exception is thrown at runtime.

考题 int i = 0, j = 5;  tp;   for (;;) {  i++;  for(;;) {  if (i --j) {  break tp;  break tp;  }  }  System.out.println(“i=” +i “,j =”+j); } What is the result?()  A、 i = 1, j = 0B、 i = 1, j = 4C、 i = 3, j = 4D、 i = 3, j = 0E、 Compilation fails.

考题 int i = 0, j = 1;  if ((i++ == 1)  (j++ == 2)) {  i = 42;  }  System.out.println(“i = “ + i + “, j = “ + j);   What is the result?()  A、 i = 1, j = 2B、 i = 1, j = 1C、 i = 42, j = 2D、 i = 42, j = 1E、 Compilation fails.

考题 int i = 0;  while (true) { if(i==4) {  break;  }  ++i;  }  System.out.println(“i=”+i);  What is the result?()  A、 i = 0B、 i = 3C、 i = 4D、 i = 5E、 Compilation fails.

考题 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(String args[]) {  Sub sub = new Sub(“Hello”);  System.out.println(sub.i);  }  }  What is the result?()  A、 0B、 1C、 2D、 Compilation fails.

考题 public class Test {  public static void main(String Args[]) {  int i =1, j = 0;  switch(i) {  case 2: j +=6;  case 4: j +=1;  default: j +=2;  case 0: j +=4;  }  System.out.println(“j =” +j);  }  }  What is the result? () A、 0B、 2C、 4D、 6E、 9F、 13

考题 public static void main(String[] args) {  for (int i=0;i= 10;i++){  if( i6) break;  }  System.out.println(i);  }  What is the result?() A、 6B、 7C、 10D、 11E、 Compilation fails.F、 An exception is thrown at runtime.

考题 public class Delta {  static boolean foo(char c) {  System.out.print(c);  return true;  }  public static void main( String[] argv ) {  int i =0;  for ( foo(‘A’); foo(‘B’)(i2); foo(‘C’)){  i++ ;  foo(‘D’);  }  }  }  What is the result?()  A、 ABDCBDCBB、 ABCDABCDC、 Compilation fails.D、 An exception is thrown at runtime.

考题 int i = 0;  for (; i 4; i += 2) {  System.out.print(i + “”);  }  System.out.println(i);  What is the result?()  A、 0 2 4B、 0 2 4 5C、 0 1 2 3 4D、 Compilation fails.E、 An exception is thrown at runtime.

考题 int i = 1,j = -1;  switch (i) {  case 0, 1:j = 1;  case 2: j = 2;  default; j = 0;  }  System.out.println(“j=”+j);  What is the result?()  A、 j = -1B、 j = 0C、 j = 1D、 j = 2E、 Compilation fails.

考题 class Computation extends Thread {  private int num;  private boolean isComplete;  private int result;  public Computation(int num) { this.num = num; }  public synchronized void run() {  result = num * 2;  isComplete = true;  notify();  }  public synchronized int getResult() {  while (!isComplete) {  try {  wait();  } catch (InterruptedException e) { }  }  return result;  }  public static void main(String[] args) {  Computation[] computations = new Computation [4];  for (int i = 0; i  computations.length; i++) {  computations[i] = new Computation(i);  computations[i] .start();  }  for (Computation c : computations)  System.out.print(c.getResult() +“ “);  }  }  What is the result?() A、 The code will deadlock.B、 The code may run with no output.C、 An exception is thrown at runtime.D、 The code may run with output “0 6”.E、 The code may run with output “2 0 6 4‟.F、 The code may ruin with output “0 2 4 6”.

考题 单选题int i = 0;  while (true) { if(i==4) {  break;  }  ++i;  }  System.out.println(“i=”+i);  What is the result?()A  i = 0B  i = 3C  i = 4D  i = 5E  Compilation fails.

考题 单选题import java.util.*;  class KeyMaster {  public int i;  public KeyMaster(int i) { this.i = i; }  public boolean equals(Object o) { return i == ((KeyMaster)o).i; }  public int hashCode() { return i; }  }  public class MapIt {  public static void main(String[] args) {  Set set = new HashSet();  KeyMaster k1 = new KeyMaster(1);  KeyMaster k2 = new KeyMaster(2);  set.add(k1); set.add(k1);  set.add(k2); set.add(k2);  System.out.print(set.size() + “:”);  k2.i = 1;  System.out.print(set.size() + “:”);  set.remove(k1);  System.out.print(set.size() + “:”);  set.remove(k2);  System.out.print(set.size()); }  }  What is the result?()A  4:4:2:2B  4:4:3:2C  2:2:1:0D  2:2:0:0E  2:1:0:0F  2:2:1:1G  4:3:2:1

考题 单选题public class Test {  public static void main(String Args[]) {  int i =1, j = 0;  switch(i) {  case 2: j +=6;  case 4: j +=1;  default: j +=2;  case 0: j +=4;  }  System.out.println(“j =” +j);  }  }  What is the result? ()A  0B  2C  4D  6E  9F  13

考题 单选题public class Delta {  static boolean foo(char c) {  System.out.print(c);  return true;  }  public static void main( String[] argv ) {  int i =0;  for ( foo(‘A’); foo(‘B’)(i2); foo(‘C’)){  i++ ;  foo(‘D’);  }  }  }  What is the result?()A  ABDCBDCBB  ABCDABCDC  Compilation fails.D  An exception is thrown at runtime.

考题 单选题int i = 0, j = 1;  if ((i++ == 1)  (j++ == 2)) {  i = 42;  }  System.out.println(“i = “ + i + “, j = “ + j);   What is the result?()A  i = 1, j = 2B  i = 1, j = 1C  i = 42, j = 2D  i = 42, j = 1E  Compilation fails.

考题 单选题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(String args[]) {  Sub sub = new Sub(“Hello”);  System.out.println(sub.i);  }  }  What is the result?()A  0B  1C  2D  Compilation fails.

考题 单选题class Computation extends Thread {  private int num;  private boolean isComplete;  private int result;  public Computation(int num) { this.num = num; }  public synchronized void run() {  result = num * 2;  isComplete = true;  notify();  }  public synchronized int getResult() {  while (!isComplete) {  try {  wait();  } catch (InterruptedException e) { }  }  return result;  }  public static void main(String[] args) {  Computation[] computations = new Computation [4];  for (int i = 0; i  computations.length; i++) {  computations[i] = new Computation(i);  computations[i] .start();  }  for (Computation c : computations)  System.out.print(c.getResult() +“ “);  }  }  What is the result?()A  The code will deadlock.B  The code may run with no output.C  An exception is thrown at runtime.D  The code may run with output “0 6”.E  The code may run with output “2 0 6 4‟.F  The code may ruin with output “0 2 4 6”.

考题 单选题public static void main(String[] args) {  for (int i=0;i6) break;  }  System.out.println(i);  }  What is the result?()A  6B  7C  10D  11E  Compilation fails.F  An exception is thrown at runtime.

考题 单选题int i = 1,j = -1;  switch (i) {  case 0, 1:j = 1;  case 2: j = 2;  default; j = 0;  }  System.out.println(“j=”+j);  What is the result?()A  j = -1B  j = 0C  j = 1D  j = 2E  Compilation fails.

考题 单选题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.println(i.intValue());  }  }   What is the result? ()A  0B  3C  Compilation fails.D  An exception is thrown at runtime.

考题 单选题下列代码的执行结果是(  )。int numbers[] = new int[6];for(int i=1;i numbers[i] =i-1;System.out.print(numbers[i]+" ");}A 0 1 2 3 4 5B 1 2 3 4 5 6C -1 0 1 2 3 4 D 0 1 2 3 4