网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
以下代码运行后,result的值为() var result = 0; for (var i = 1; i <= 10; i++) { result = result * i }
A.0
B.1
C.9的阶乘
D.10的阶乘
参考答案和解析
9 的阶乘
更多 “以下代码运行后,result的值为() var result = 0; for (var i = 1; i <= 10; i++) { result = result * i }A.0B.1C.9的阶乘D.10的阶乘” 相关考题
考题
关于JAVA初级的代码计算问题
下面的方法,当输入为2的时候返回值是多少?()publicintgetValue(inti){intresult=0;switch(i){case1:result=result+i;case2:result=result+i*2;case3:result=result+i*3;}returnresult;}
考题
下面程序的运行结果是#includeint fun(int a[]. int n){int result=l:for(int i=1;iresult=result*a[i];return result;}void main(){int a[3]={3,4,5};cout}A.12;B.15;C.20;D.60
考题
下面程序的运行结果是 include int fun(int a[ ] ,int n) { int result=1; for(in
下面程序的运行结果是#include<iostream.h>int fun(int a[ ] ,int n){int result=1;for(int i=1;i<n;i++)result=result * a[i] ;retum result;}void main( ){int a[3] ={3,4,5};coutA.12B.15C.20D.60
考题
下面程序段的输出结果是( )。 public class Test { public static void main ( String[] args) { int result=0; for ( int i=1;i<=5;i++) { if ( i%2==0 ) continue; result + =i; } System. out. println ("result is " + result ); } }A.result is 7B.result is 8C.result is 9D.result is 10
考题
public static void main(String[]args){for(inti=0;i=10;i++){if(i6)break;}System.out.println(i);}What is the result?()
A.6B.7C.10D.11E.Compilation fails.F.Anexception is thrown at runtime.
考题
下面程序的运行结果是( )。 #includeiostream.h int fun(int a[],int n) { int resuh=1; for(inl i=1;i11;1‘++) result=result * a[i]; retum result; } void main int a[3]={3,4,5}: coutfun(a,3)endl: }A.12B.15C.20D.60
考题
下面程序的运行结果是()。includeintfun(inta[],int n){int result=1;for(int i=“i
下面程序的运行结果是( )。 #include<iostream.h> intfun(inta[],int n) { int result=1; for(int i=“i<n;i++) result’resultxa[i]; return result; } void main() { inta[3]={3,4,5}; cout<<fun(a,3)<<endl; }A.12B.15C.20D.60
考题
假定a=3,下列程序的运行结果是()。ineludeint fun(int n);void main(){cout
假定a=3,下列程序的运行结果是( )。 #inelude<iostream.h> int fun(int n); void main() { cout<<"Please input a number:"; int a,result=0; cin>>a; result=fun(a); tout<<result<<end1; } intfun(int n) { int p=1,result=0; for(int i=1;i<=n;i++) { p*=i; result+=p; } return result; )A.4B.8C.9D.20
考题
下面程序的输出结果是 public class Test{ public static void main(String[] args){ int[]array={2,4,6,8,10}; int size=6; int result=-1: try{ for(int i=0;i<sizeresult==-1;i++) if(array[i]==20)result=i; }catch(ArithmeticException e){ System.out.println("Catch---1"); }catch(ArrayIndexOutOfBoundsException e){ System.out.println("Catch---2"); }catch(Exception e){ System.out.println("Catch---3"); } } }A.Catch---1B.Catch一--2C.Catch---3D.以下都不对
考题
若有以下窗体单击事件过程:Private Sub Form_Click()result=1For i=1 To 6 step 3result=result*iNext iMsgBox resultEnd Sub打开窗体运行后,单击窗体,则消息框的输出内容是A.1B.4C.15D.120
考题
阅读以下说明及C++程序代码,将应填入(n)处的语句写在对应栏内。【说明】本程序的功能是实现任意两个大整数的乘法运算,例如:输入整数1:8934793850094505800243958034985058输入整数2:234584950989689084095803583095820923二者之积:209596817742739508050978890737675662366433464256830959194834854876 8534【C++代码】include<iostream.h>const int MAXINPUTBIT=100;const int MAXRESULTBIT=500;class LargeNumber{int i,j;int temp;int one[MAXINPUTBIT+1];int onebit; //one的位数int two[MAXINPUTBIT+1];int twobit; //two的位数int result[MAXRESULTBIT+1];public:LargeNumber();~LargeNumber();int inputone(); //出错返叫0,否则返回1int inputtwo(); //同上void multiplication(); //乘void clearresult(); //清零void showresult(); //显示};LargeNumber∷LargeNumber(){for(i=0;i<=MAXINPUTBIT;i++){one[i]=0;two[i]=0;}nebit=0;twobit=0;inputone();inputtwo();}LargeNumber∷~LargeNumber(){}int LargeNumber∷inputone(){char Number[MAXINPUTBIT+1];cout<<"Please enter one:";cin>>Number;i=0;j=MAXINPUTBIT;while(Number[i]!='\0')i++;nebit=i;for(i--;i>=0;i--,j--){if(int(Number[i])>=48int(Number[i])<=57)(1); //由字符转换为数字elsereturn 0;}return 1;}int LargeNumber∷inputtwo(){char Number[MAXINPUTBIT+1];cout<<"Please enter two:";cin>>Number;i=0;j=MAXINPUTBIT;while(Number[i]!='\0')i++;twobit=i;for(i--;i>=0;i--,j--){if(int(Number[i])>=48int(Number[i])<=57)two[j]=int(Number[i]-48); //由字符转换为数字elsereturn 0;}return 1;}void LargeNumber∷multiplication() //乘法{clearresult();int m;for(i=MAXINPUTBIT;i>=0;i--){temp=two[i];for(j=(2),m=MAXINPUTBIT;m>=0;m--,j--){result[j]+=temp*one[m];if(result[j]>9){result[j-1]+=result[j]/10;(3);}}&n
考题
下列程序的功能是:输入10个整数,逆序后输出。请在程序空白处填入适当语句使程序完成指定的功能。Private Sub Command2_Click()Dim i, j, k,temp, arr(11) As lntegerDim result As StringFor k=1 To 10arr(k) =Val (InputBox( "请输入第" k "个数:","数据输入窗口"))Next ki=1j = 10Dotemp=arr(i)arr(i)=arr(j)arr(j)=tempi=i+1j=【12】Loop While【13】result =""For k=1 To 10result=result arr(k) Chr(13)NeXt kMsgBox resultEnd Sub
考题
下面程序的运行结果是( )。 #includeiostream.h intfun(inta[],intn) { intresult=1; for(inti=1;i(n;i++) result=result*a[i]; returnresult; } voidmain( ) { inta[3]={3,4,5); coHtfun(a,3)endl; }A.12B.15C.20D.60
考题
在窗体中使用一个文本框名为n.接受输入的值,有一个命令按钮run,事件代码如下: Private Sub run_Click( ) result = "" For i = 1 To Me!n For j = 1 To Me!n result = result + "*" Next j result = result + Chr(13) + Chr(10) Next i MsgBox result End Sub 打开窗体后,如果通过文本框输入的值为4,单击命令按钮后输出的图型是A. * * * * * * * * * * * * * * * *B. * * * * * * * * * * * * * * * *C. * * * * * * * * * * * * * * * * * * * * * * * * * * * *D. * * * * * * * * * * * * * * * *
考题
若有以下窗体单击事件过程:Private SubForm_Click( ) result=1 For i=1To 6 Step 3 result=result*i Next i MsgBoxresult End Sub打开窗体运行后,单击窗体,则消息框的输出内容是( )。A.1B.4C.15D.120
考题
下面程序的运行结果是includeint fun(inta[],int n){ int result=1; for(int i=1:i
下面程序的运行结果是 #include<iostream.h> int fun(inta[],int n) { int result=1; for(int i=1:i<n;i++) result=result*a[i]; remm result; } void main() { int a[3]={3,4,5}; cout <<fun(a,3) <<end1; }A.12B.15C.20D.60
考题
在窗体中使用一个文本框(名为n)接受输入的值,有一个命令按钮run,事件代码如下; Ptivate Sub run_Click() Yesult=" " For i=1 To Me!n For j=1 To Me!n result=result +"*" Next j result=resuh+Chr(13)+Chr(10) NexL i MsSBOx result End Sub 打开窗体后,如果通过文本框输入的值为4,单击命令按钮后输出的图型是A. * * * * * * * * * * * * * * * *B. * * * * * * * * * * * * * * * *C. * * * * * * * * * * * * * * * * * * * * * * * * * * * *D. * * * * * * * * * * * * * * * *
考题
若有以下窗体单击事件过程:Private SubForm_Click( )result=1For i=1To 6 Step 3result=result*iNext iMsgBoxresultEnd Sub打开窗体运行后,单击窗体,则消息框的输出内容是( )。A.1B.4C.15D.120
考题
试题31若有以下窗体事件过程:Private Sub Form_Click()result=1For i=1 To 6 step 3Result = result * 1Next iMsgBox resultEnd Sub打开窗体运行后,单击窗体,则消息框的输出内容是()A.1B.4C.15D.120
考题
( 17 )下列程序的输出结果是public class Test{public static void main(String[] args){int [] array={2,4,6,8,10};int size=6;int result=-1;try{for{int i=0;isize result==-1;i++}if(array[i]==20) result=i;}catch(ArithmeticException e){System.out.println( " Catch---1 " );catch(ArrayIndexOutOfBoundsException e){System.out.println( " Catch---2 " );catch(Exception e){System.out.println( " Catch---3 " );}}A ) Catch---1B ) Catch---2C ) Catch---3D )以上都不对
考题
以下代码的输出结果是() while(1) { $var++; $result=$var; if($result==17)break; $var--; } echo($result);A、0B、17C、18D、这是一个无限循环,没有输出
考题
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.
考题
public static void main(String[]args){ for(inti=0;i=10;i++){ if(i6)break; } System.out.println(i); } What is the result?()A、6B、7C、10D、11E、Compilation fails.F、Anexception 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.
考题
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.
考题
单选题以下代码的输出结果是() while(1) { $var++; $result=$var; if($result==17)break; $var--; } echo($result);A
0B
17C
18D
这是一个无限循环,没有输出
考题
单选题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, 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.
热门标签
最新试卷