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

题目内容 (请给出正确答案)

What’s the final result?

(下面这段代码的最终运行结果是什么)

double expectedValue = 1/2;

if(expectedValue > 0)

{

expectedValue = expectedValue + 0.5;

}

Console.WriteLine(expectedValue);


参考答案

更多 “ What’s the final result?(下面这段代码的最终运行结果是什么)double expectedValue = 1/2;if(expectedValue 0){expectedValue = expectedValue + 0.5;}Console.WriteLine(expectedValue); ” 相关考题
考题 考虑下面的代码片段。?phpdefine(‘STOP_AT’,1024);$result = array();/在此处填入代码/{$result[]=$idx;}print_r($result);标记处填入什么代码才能产生如下的数组输出?( )Array([0]=1[1]=2[2]=4[3] =8[4] =16[5] =32[6] =64[7] =128[8] =256[9] =512) A.foreach($result as $key =$val)B.while($idx=2) C.for($idx=1 D.$idxSTOP_AT E.$idx=2)F.for($idx*=2G.STOP_AT=$idxH.$idx=0)

考题 考虑下面的代码片段。?phpdefine(“STOP_AT”,1024);$result = array();/在此处填入代码/{$result[] = $idx;}print_r($result );?标记处填入什么代码才能产生如下数组输出?( )Array( [0] = 1 [1] = 2 [2] = 4 [3] = 8[4] = 16[5] = 32 [6] = 64 [7] = 128 [8] = 256 [9] = 512)A.for($idx *= 1B.$idx STOP_ATC.$idx *= 2)D.foreach($result as $key = $val)E.while($idx *= 2)F.for($idx *= 2G.STOP_AT = $idxH.$idx =0)

考题 关于JAVA初级的代码计算问题 下面的方法,当输入为2的时候返回值是多少?()publicintgetValue(inti){intresult=0;switch(i){case1:result=result+i;case2:result=result+i*2;case3:result=result+i*3;}returnresult;}

考题 下面程序代码运行结果为( )。 import java.awt.*; public class Test { public static void main (String args[]) { String s1="a+b+c"; String s2="+"; int i=s1.lastIndexOf (s2); System.out.println(i); } }A.0B.1C.2D.3

考题 下面代码输出结果是()。inti=0,s=0;do{if(i%2==0){i++;continue;}i++;s=s+i;}while(i A、16B、12C、28D、21

考题 下面程序的运行结果是( )。 include main() {int a,s,n,m; a=2;s=0;n=1;m=1; while(m 下面程序的运行结果是( )。 include<stdio.h> main() {int a,s,n,m; a=2;s=0;n=1;m=1; while(m<=4){n=n*a;s=s+n;++m;} printf("s=%d",s); }

考题 下面程序运行后的输出结果是()。includemain(){int a[5]={1,0,4,2,0},b[5]={1,2,3,4,5} 下面程序运行后的输出结果是( )。 #include<stdio.h> main() {int a[5]={1,0,4,2,0},b[5]={1,2,3,4,5},i,s=0; for(i=0;i<5;i++)s=s+b[a[i]]; printf("%d\n”,s); }A.12B.15C.11D.8

考题 下面这段代码输出什么?为什么?int i=5;int j=5;if (Object.ReferenceEquals(i,j))Console.WriteLine("Equal");elseConsole.WriteLine("Not Equal");

考题 下面程序运行后输出结果是( )。 For I=1 to 2 S=1 For j=0 to I-1 S=S+S*I Next j Print S Next IA.1 1B.0 2C.2 9D.6 9

考题 下面程序的运行结果是______。 Dim a,i,s a=Array("6","5","a","b","2","1") s=0 i=0 Dw While a(i)>="0" And a(i)<="9" s=10* s+a(i)-"0" Print s i=i+2 LoopA.12ba56B.652C.6D.62

考题 下面的语句片段中,变量result结果为( )。 public class Test { public static void main (String args[ ]) { int sum=0; int r=2; iht result=(sum==1?sum:r); System. out. println (result); } }A.1B.2C.10D.0

考题 下面代码输出结果是( )。inti=0,s=0;do{if(i%2==0){i++;continue;}i++;s=s+i;}while(i 下面代码输出结果是( )。inti=0,s=0;do{if(i%2==0){i++;continue;}i++;s=s+i;}while(iSystem.out.println(s);A、16B、12C、28D、21

考题 有如下程序: public class MethLoad { public static void main(String args[]) { MethLoad classObj=new MethLoad(); classObj.methtest(4); classObj.methtest(0); } void methtest(double d) { double sum=2*d; System.out.println("The result is:"+sum); } void methtest(int n) { int sum=4*n; System.out.println("The result is:" +sum); } }程序的运行结果为( )。A.The result is:16 The result is:0B.The result is:0 The result is:16C.The result is:8 The result is:0D.The result is:0 The result is:8

考题 对于下列代码段,执行后输出结果是()。 int n,m; int[] a=new int[5]; n=10; m=10; try{ for(inti=0;i=a.Length;i++); a[i]=i; n=1/(n-m); } catch(DivideByZeroExceptione1){ Console.WriteLine(“产生零除异常!”); } catch(IndexOutOfRangeExceptione2) { Console.WriteLine(“产生数组访问越界异常!”); }

考题 下面这段代码的运行结果是()。 Dim MyStringBuilder As New StringBuilder("Hello World!") MyStringBuilder.Remove(5, 7) Console.WriteLine(MyStringBuilder)A、"Hello_"B、"Hello"C、"_World!"D、"World!"

考题 下面这段代码的运行结果是()。 Dim MyStringBuilder As New StringBuilder("Hello World!") MyStringBuilder.Replace("!"c, "?"c) Console.WriteLine(MyStringBuilder)A、HelloWorld?cB、HelloWorld?C、HelloWorld!cD、HelloWorld!

考题 在C#中〃下列代码的运行结果是()。int[]age1=newint[]{10,20};int[]age2=age1;age2[1]=30;Console.WriteLine(age1[1]);A、0B、10C、20D、30

考题 下列程序的运行结果是() classProgramx=0,y=-1; { publicstaticvoidMain(string[]args) { int i=0,s=1; do{s/=s+1;i++; } while(i=10); Console.WriteLine(“i={0},s={1}”,i,s);

考题 下面程序的运行结果是() classProgram{ publicstaticvoidMain(string[]args) { stringstr1="星期一//星期二//星期三"; stringstr2=@"星期一//星期二//星期三"; Console.WriteLine("str1={0}",str1); Console.WriteLine("str2={0}",str2);

考题 以下的C#代码:static void Main(string[]args){Console.WriteLine("运行结果:{0}",Console.ReadLine());Console.ReadLine();}代码运行结果为()。A、在控制台窗口显示“运行结果:”B、在控制台窗口显示“运行结果:{0}”C、在控制台窗口显示“运行结果:,Console.ReadLine”D、如果用户在控制台输入“A”,那么程序将在控制台显示“运行结果:A”

考题 以下是表单的Activate事件的代码: s=0 n=5 do while n0 s=s+n n=n-1 enddo this.label1.caption=str(s,2) 这段代码执行后,标签Label1的标题为()A、0B、10C、15D、20

考题 填空题下列程序的运行结果是() classProgramx=0,y=-1; { publicstaticvoidMain(string[]args) { int i=0,s=1; do{s/=s+1;i++; } while(i=10); Console.WriteLine(“i={0},s={1}”,i,s);

考题 单选题以下是表单的Activate事件的代码: s=0 n=5 do while n0 s=s+n n=n-1 enddo this.label1.caption=str(s,2) 这段代码执行后,标签Label1的标题为()A 0B 10C 15D 20

考题 单选题以下是表单的Activate事件的代码: s=0 for n=10 to 0 step -2 s=s+n endfor this.text1.value=s 这段代码执行后,文本框Text1的值为()A 30B 10C 0D -2

考题 单选题下面这段代码的运行结果是()。 Dim MyStringBuilder As New StringBuilder("Hello World!") MyStringBuilder.Remove(5, 7) Console.WriteLine(MyStringBuilder)A Hello_B HelloC _World!D World!

考题 填空题下面程序的运行结果是() classProgram{ publicstaticvoidMain(string[]args) { stringstr1="星期一//星期二//星期三"; stringstr2=@"星期一//星期二//星期三"; Console.WriteLine("str1={0}",str1); Console.WriteLine("str2={0}",str2);

考题 单选题以下的C#代码:static void Main(string[]args){Console.WriteLine("运行结果:{0}",Console.ReadLine());Console.ReadLine();}代码运行结果为()。A 在控制台窗口显示“运行结果:”B 在控制台窗口显示“运行结果:{0}”C 在控制台窗口显示“运行结果:,Console.ReadLine”D 如果用户在控制台输入“A”,那么程序将在控制台显示“运行结果:A”