网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
if(true){int i=17;} System.out.println(i); 运行此程序的结果是输出17。
参考答案
更多 “ if(true){int i=17;} System.out.println(i); 运行此程序的结果是输出17。” 相关考题
考题
有以下程序#include stdio.hint a=1;int f(int c){ static int a=2;c=c+1;return (a++)+c;}main(){ int i,k=0;for(i=0;i2;i++){int a=3;k+=f(a);}k+=a;printf( " %d\n " ,k);}程序运行结果是A) 14B) 15C) 16D) 17
考题
mystrlen函数的功能是计算str所指字符串的长度,并作为函数值返回。请填空。int mystrlen(char *str){ int i;for(i=0;【17】!= ′\0′;i++);return(i);}
考题
以下程序运行后的输出结果是【】。main()int p[7]={11,13,14,15,16,17,18};int i=0,j=0;while(i7p[i]%2! =1) j+=p[i++];printf("%d\n",j);}
考题
阅读下列代码段Class Test implements Runnable {Public int run( ) {Int i = 0;While (true) {i++;System.out.println ( “ i= ” +i);}}}上述代码的编译结果是A )程序通过编译并且 run () 方法可以正常输出递增的 i 值B )程序通过编译,调用 run () 方法将不显示任何输出C )程序不能通过编译,因为 while 的循环控制条件不能为 “ true ”D )程序不能通过编译,因为 run () 方法的返回值类型不是 void
考题
请阅读下面程序 public class ThreadTest{ public static void main(String args[])throws Ex- ception{ int i=0; Hello t=new Hello; ; while(true){ System.Out.println("Good Morning"+i++): if(i= =2t.isAlive){ System.out.println("Main waiting for Hel- lo!"); join;//等待t运行结束 } if(i= =5)break;} } } class Hello extends Thread{ int l; public void run{ while(true)( System.Out.println("Hell0"+i++); if(i= =5)break;)))A.t.sleepB.t.yieldC.t.interruptD.t.start
考题
下列选项中哪一个编译不出现错误 ( )A.int i=0; if(i){ System.out.println("Hi"); }B.int il=5; int i2=5; if(i1=i2){ System.out.println("So true"); }C.int i=1; int j=2; if(i==1||j==2) System.out.println("OK");D.int i=1; int j=2; if (i==1 |j==2) System.out.println("OK");
考题
以下程序的输出结果是【】。 main() { int p[7]=(11,13,14,15,16,17,18}; int i=0,j=0; while(i
以下程序的输出结果是【 】。main(){int p[7]=(11,13,14,15,16,17,18};int i=0,j=0;while(i<7p[i]%2==1)j+=p[i++];printf("%d\n",j);}
考题
有以下程序 include int a=1; int f(int c) { stati
有以下程序 #include <stdio.h> int a=1; int f(int c) { static int a=2; c=c+1; return (a++) + c; } main() { int i, k=0; for(i=0;i<2;i++) { int a=3; k += f(a); k +=a; printf("%d\n",k); }A.14B.15C.16D.17
考题
执行下列程序段之后,变量b的值为( )。 public class Test { public static void main (String[] args) { int i = 12; int j = 24; boolean b1 = true; booleanb=(j%i==0)(! b1) || (j/i! =2); System. out. println (B); } }A.trueB.falseC.0D.1
考题
下面程序的输出结果是______。 main() { int a[3][4]={1,3,5,7,9,11,13,15,17,19,21,23}; int(*p)[4]=a,i,j,k=0; for(i=0;i<3;i++) for(j=0;j<2;j++) k=p[i][j]; printf("%d\n",k); }A.17B.18C.19D.23
考题
下面程序段的输出结果是 public class Test { public static void main (String args[]){ int[] a=new int[11]; int[] p=new int [4]; int k=5; for(int i=1;i<=10;i++) a[i]=i; for(int i=1;i<=3;i++) p[i]=a[i*i]; for(int i=1;i<=3;i++) k=k+p[i]*2; System.out.println(k); } }A.17B.31C.33D.35
考题
有以下程序 #includestdio.h int a=1; intf(int c) {static int a=2: c=c+1: return(a++)+C; } main ( int i,k=0; for(i=0;i2;i++){int a=3;k+=f(a);} k+=a: printf("%d\n",k); } 程序运行结果是( )。A.14B.15C.16D.17
考题
假设i是int类型的变量,并初始化为1,则下列( )是合法的条件语句。A.if (i) { }B.if (i<<=3) { }C.if (i=2) { }D.if (true) { }
考题
有以下程序#includestdio.hint a=1;intf(int c){static int a=2;c=c+1;return(a++)+C;}main( int i,k=0;for(i=0;i2;i++){int a=3;k+=f(a);}k+=a;printf(%d\n,k);}程序运行结果是( )。A.14B.15C.16D.17
考题
有以下程序#include stdio.hint a=1;int f(intC.{ static int a=2;c=c+1;return (a++)+c;}main(){int i,k=0;for(i=0;i2;i++) {int a=3;k+=f(A.; }k+=a;printf(“%d\n”,k);}程序的运行结果是( )。A.14B.15C.16D.17
考题
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.
考题
对于变量的初始化,以下几种方法中错误的是() A、int a; for (int i=0;i《12;i++) a=i;B、int a; if (true) a=7;C、int a; int b=a;D、int a=0;E、int a; a=0;
考题
单选题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.
考题
多选题对于变量的初始化,以下几种方法中错误的是()Aint a; for (int i=0;i《12;i++) a=i;Bint a; if (true) a=7;Cint a; int b=a;Dint a=0;Eint a; a=0;
考题
单选题public class SyncTest { private int x; private int y; private synchronized void setX( int i ) { x = i; } private synchronized void setY( int i ) { y = i; } public void setXY( int i ) { setX(i); setY(i); } public synchronized boolean check() { return x != y; } } Under which condition will check return true when called from a different class? ()A
check can never return true.B
check can return true when setXY is called by multiple threads.C
check can return true when multiple threads call setX and setY separately.D
check can return true only if SyncTest is changed to allow x and y to be set separately.
考题
单选题11. class Converter { 12. public static void main(String[] args) { 13. Integer i = args[0]; 14. int j = 12; 15. System.out.println(”It is “ + (j==i) + “that j==i.”); 16. } 17. } What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?()A
It is true that j==i.B
It is false that j==i.C
An exception is thrown at runtime.D
Compilation fails because of an error in line 13.
考题
单选题public class SyncTest { private int x; private int y; public synchronized void setX (int i) (x=1;) public synchronized void setY (int i) (y=1;) public synchronized void setXY(int 1)(set X(i); setY(i);) public synchronized Boolean check() (return x !=y;) } Under which conditions will check () return true when called from a different class?A
Check() can never return true.B
Check() can return true when setXY is called by multiple threads.C
Check() can return true when multiple threads call setX and setY separately.D
Check() can only return true if SyncTest is changed to allow x and y to be set separately.
考题
单选题有以下程序:#include #define N 4void fun(int a[][N]){ int i; for(i=0;i
A
16,6,11,16,B
1,6,11,16,C
4,7,10,13,D
17,17,17,17,
考题
判断题if(true){int i=17;} System.out.println(i); 运行此程序的结果是输出17。A
对B
错
热门标签
最新试卷