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

题目内容 (请给出正确答案)
单选题
public void test(int x) {  int odd = x%2;  if (odd) {   System.out.println(“odd);  } else {  System.out.println(“even”);  }  }  Which statement is true?()
A

Compilation fails.

B

 “odd” will always be output.

C

 “even” will always be output.

D

 “odd” will be output for odd values of x, and “even” for even values.

E

 “even” will be output for add values of x, and “odd” for even values.


参考答案

参考解析
解析: 暂无解析
更多 “单选题public void test(int x) {  int odd = x%2;  if (odd) {   System.out.println(“odd);  } else {  System.out.println(“even”);  }  }  Which statement is true?()A Compilation fails.B  “odd” will always be output.C  “even” will always be output.D  “odd” will be output for odd values of x, and “even” for even values.E  “even” will be output for add values of x, and “odd” for even values.” 相关考题
考题 对输入一个整数进行判断,若是偶数,输出even,否则输出odd,在子函数fun2功能是判定整数是否为偶数,若是偶数,返回1,否则返回0int fun2(int x){if(x%2==0);return 0;}main(){int n;scanf("%d",n);ifprintf("even\n");else printf(odd\n");}

考题 下面程序段的输出结果是( )。 public class Test { public static void main(String args[ ]){ int x,y; x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2; y=(int)Math.sqrt(3)/2+(int)Math.random()*3/2; if (x>y) System.out.println("x>y"); else if (x==y) System.out.println("x=y"); else System.out.println("x<y"); } }A.x>yB.x=yC.x<yD.编译错误

考题 执行下面程序段,屏幕上将输出( )。 public class Test { private int x=10,y=20; public Test (int x,int y) { System.out.println (x+this.x); System.out.println (y+y); } public static void main (String[] args) { Testt= new Test(30,50); } }A.无输出B.20 40C.40 100D.40 70

考题 She packed all her _________ into a bag. A.odd and endB.odd and endsC.odds and endsD.odds and end

考题 下面程序段的输出结果是( )。 public class Test{ public static void main(String args[]){ int X,y; x=(int)Math.sqrt(5)/2+(int)Math.random*5/2; y=(int)Math.sqrt(3)/2+(int)Math.random*3/2; if(xv) System.OUt.println("xy"); elseif(x= =y) System.out.println("x=Y"); else System.out.println("xy"): } }A.xyB.x=YC.xyD.编译错误

考题 publicvoidtest(intx){intodd=x%2;if(odd){System.out.println(odd);}else{System.out.println(even”);}}Whichstatementistrue?() A.Compilationfails.B.“odd”willalwaysbeoutput.C.“even”willalwaysbeoutput.D.“odd”willbeoutputforoddvaluesofx,and“even”forevenvalues.E.“even”willbeoutputforaddvaluesofx,and“odd”forevenvalues.

考题 下面程序段的输出结果是 public class Test{ public static void main(Stringargs[]){ int x,y; x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2; y=(int)Math.sqrt(3)/2+(ht)Math.random()*3/2; if(x>y) System.out.println(”x>y”); else if(x=y) System.out.println(”x=y”); else System.out.Println(”x<y”); } }A.x>yB.x=yC.x<yD.编译错误

考题 请编制函数ReadDa(()实现从文件IN83.DAT中读取1000个十进制整数到数组xx中。请编制函数 Compute()分别计算出xx中奇数的个数odd、奇数的平均值avel、偶数的平均值ave2及所有奇数的方差totfc的值。最后调用函数WrireDat()把结果输出到OUT83.DAT文件中。计算方差的公式如下:设N为奇数的个数,xx[i]为奇数,ave1为奇数的平均值。原始数据的存放格式是:每行存放10个数,并用逗号隔开(每个数均大于0且小于等于2000)。注意:部分源程序已给出。请勿改动主函数main()和输写函数WriteDat()的内容。试题程序:include<stdio.h>include<stdlib.h>include<string.h>define MAX 1000int xx[MAX],odd=0,even=0;double avel=0.0,ave2=0.0,totfc=0.0;void WriteDat(void);int ReadDat (void){FILE *fp;if ( (fp=fopen ("IN83. DAT", "r") ) ==NULL) return 1;fclose (fp);return 0;}void Compute (void){}void main( ){int i;for (i=0; i<MAX; i++)xx[i]=0;if (ReadDat ()){printf ("数据文件IN83.DAT 不能打开!\007\n");return;}Compute ();printf ( "ODD=%d\nAVEl=%f\nAVE2=%f\nTOTFC=%f\n",odd,avel,ave2,totfc);WriteDat ();}void WriteDat(void){FILE *fp;int i;fp=fopen ("OUT83. DAT", "w");fprintf (fp,"%d\n%lf\n%lf\n%lf\n",odd,avel,ave2,totfc);fclose(fp);}

考题 设有如下程序: public class Sun { public static void main (String args[ ]) { int x,y; x= (int) Math.sqrt (2) /2+ (int) Math.random ()*2/2; y= (int) Math.sqrt (3) /3+ (int) Math.random ()*3/3; if (x>y) System.out.println ("x>y"); else if (x==y) System.out.println("x=y"); else System.out.println("x<y"); } } 程序运行的结果为( )。A.x>yB.x=yC.x<yD.以上都不对

考题 函数ReadDat()实现从文件IN.dat中读取1000个十进制整数到数组xx中;请编写函数 Compute()分别计算出数组xx中奇数的个数odd、偶数的个数even,以及所有数的平均值aver和方差totfc的值。最后调用函数WriteDat(),把结果输出到OUT. dat文件中。计算方差的公式如下:原始数据文件存放的格式是:每行存放10个数(每个数均大于0且小于等于2000),并用逗号隔开。注意:部分源程序已经给出。请勿改动主函数main()、读函数ReadDat()和输出数据函数 WriteDat()的内容。include <stdio. h>include <stdlib. h>include <string. h>define MAX 1000int xx[MAX], odd = 0, even = 0;double aver = 0.0, totfc = 0.0;void WriteDat(void);int ReadDat(void){ FILE *fp;int i, j;if ((fp = fopen("IN. dat", "r")) == NULL)return 1;for (i=0; i<100; i++){ for (j=0; j<10; j++)fscanf(fp, "%d,", xx[i*10+j]);fscanf(fp, "\n");if (feof(fp))break;}fclose(fp);return 0;}void Compute(void){}void main (){ int i;for (i=0; i<MAX; i++)xx[i] = 0;if (ReadDat()){printf (" 数据文件 IN. dar 不能打开! \007\n");return;}Compute ( );printf("odd=%d\neven=%d\naver=%f\ntotfc=%f\n", odd, even, aver, totfc);WriteDat ();}void WriteDat(void){ FILE *fp;fp = fopen("OUT.dat", "w");fprintf(fp, "%d\n%d\n%f\n%f\n", odd, even, aver, totfc);fclose (fp);}

考题 下面程序段的输出结果是______。 public class Test{ public static void main(String args[ ]){ int x,y; x=(int)Math.sqrt(5/2)+(int)Math.random( )*5/2; y=(int)Math.sqrt(3/2)+(int)Math.random( )*3/2; if(x>y) System.out.println("x>y"); else if(x==y) System.out.println("x=y"); else System.out.println("x<y"); } }A.x>yB.x=yC.x<yD.编译错误

考题 请编制函数ReadDat()实现从文件IN93.DAT中读取1000个十进制整数到数组xx中。请编制函数 Compute()分别计算出xx中奇数的个数odd、偶数的个数even、平均值aver及方差totfc的值,最后调用函数WriteDat()把结果输出到OUT93.DAT文件中。计算方差的公式如下:原始数据的存放格式是:每行存放10个数,并用逗号隔开(每个数均大于0且小于等于2000)。注意:部分源程序已给出。请勿改动主函数main()和写函数WriteDat()的内容。试题程序:include<stdio.h>include<stdlib.h>include<string.h>define MAX 1000int xx[MAX],odd=0,even=0;double aver=0.0,totfc=0.0;void WriteDat(void);int ReadDat(void){FILE *fp;if((fp=fopen("IN93.DAT","r"))==NULLreturn 1;fclose(fp);return O;}void Compute(void){}void main( ){int i;for(i=O;i<MAX;i++)xx[i] =0;if (ReadDat ( ) ){print f ("数据文件IN93.DAT不能打开! \007\n");return;}Compute();printf( "ODD=%d\nEVEN=%d\nAVER=%lf\nTOTFC=%lf\n",odd, even,aver,totfc);WriteDat();}void WriteDat(void){FILE *fp;int i;fp=fopen("OUT93.DAT","w");fprintf(fp,"%dln%dln%lf\n%lfkn",odd,even,aver,totfc);fclose(fp);}

考题 What is odd is that they have perhaps most benefited from ambition — if not always their own then that of their parents and grandparents.

考题 public void test(int x) {  int odd = x%2;  if (odd) {   System.out.println(“odd);  } else {  System.out.println(“even”);  }  }  Which statement is true?() A、Compilation fails.B、 “odd” will always be output.C、 “even” will always be output.D、 “odd” will be output for odd values of x, and “even” for even values.E、 “even” will be output for add values of x, and “odd” for even values.

考题 package test1;  public class Test1 {  static int x = 42;  }  package test2;  public class Test2 extends test1.Test1 {  public static void main(String[] args) { System.out.println(“x = “ + x);  }  }  What is the result?() A、 x = 0B、 x = 42C、 Compilation fails because of an error in line 2 of class Test2.D、 Compilation fails because of an error in line 3 of class Test1.E、 Compilation fails because of an error in line 4 of class Test2.

考题 有一个表格,如果匹配所有行数为偶数的,用even实现,奇数的用odd实现。()

考题 public class Test {  public static void main(String[] args) {  int x = 0;  assert (x  0) ? “assertion failed” : “assertion passed”;  System.out.println(“Finished”);  }  }  What is the result?()  A、 finishedB、 Compilation fails.C、 An AssertionError is thrown and finished is output.D、 An AssertionError is thrown with the message “assertion failed”.E、 An AssertionError is thrown with the message “assertion passed”.

考题 单选题If a and b are integers and the sum of ab and b is even, which of the following could be true?Ⅰ. a and b are both odd.Ⅱ. a is even and b is odd.Ⅲ. a is odd and b is even.A Ⅰ onlyB ⅡonlyC Ⅲ onlyD Ⅰ and ⅡE Ⅰand Ⅲ

考题 单选题a and b are positive, a is even and b is odd. Which of the following must also be odd?A abB a/bC a + 2bD baE (ab) a

考题 单选题Set X = even integers and Set Y = odd integers. Therefore X ∩ Y = ______.A prime numbersB integersC empty setD composite numbersE whole numbers

考题 问答题If w+x+y=42, what is the value of wxy?  (1) x and y are consecutive odd integers  (2) w=2x

考题 单选题When a buoy marks a channel bifurcation,the preferred channel is NOT indicated by().A the shape of an unlighted buoyB the light color of a lighted buoyC the color of the topmost bandD whether the number is odd or even

考题 单选题Lifeboats are numbered().Odd numbers to starboard and even numbers to port.A from forward to aftB from aft to forwardC at master's optionD as per owner's instruction

考题 单选题If m and n are positive integers and 3m+n-1=2m+2n, which of the following must be true?I. m and n are consecutive integers.II. m is even.III. n is odd.A NoneB I onlyC II onlyD III onlyE I, II, and III

考题 单选题public void test(int x) {  int odd = x%2;  if (odd) {   System.out.println(“odd);  } else {  System.out.println(“even”);  }  }  Which statement is true?()A Compilation fails.B  “odd” will always be output.C  “even” will always be output.D  “odd” will be output for odd values of x, and “even” for even values.E  “even” will be output for add values of x, and “odd” for even values.

考题 单选题public class Test {  public static void main(String[] args) {  int x = 0;  assert (x  0) ? “assertion failed” : “assertion passed”;  System.out.println(“Finished”);  }  }  What is the result?()A  finishedB  Compilation fails.C  An AssertionError is thrown and finished is output.D  An AssertionError is thrown with the message “assertion failed”.E  An AssertionError is thrown with the message “assertion passed”.

考题 问答题4 9 6 2 3 4 7 8 2 1 9 6 4 3 2  Multiply by 7 the number of odd numbers which are immediately followed by an even number in the list above. What is the answer?

考题 单选题x, y, and z are positive integers. Which of the following lists all the possible ways for x + y + z to be an odd number?I. One of the numbers is odd.II. Two of the numbers are odd.III. Three of the numbers are odd.A IB I and IIC I and IIID II and III