下列程序段执行后,输出结果是: def square(x): total = x * x x += total x = -5 total = 0 square(x) print(x, total, sep=',')A.出错B.-5,25C.20,25D.-5,0

下列程序段执行后,输出结果是: def square(x): total = x * x x += total x = -5 total = 0 square(x) print(x, total, sep=',')

A.出错

B.-5,25

C.20,25

D.-5,0


参考答案和解析
因为运算出错而结束

相关考题:

程序片段int x=5;do{ printf( “%d “, x ); x=x-2; }while( x>=0 );执行后的输出结果是( )。 A.5 3B.5 3 0C.5 3 1D.3 2 1

若有如下程序:public class Test {public static void main (String[] args) {int x=20;if (x>10) System.out.print(x-=5);if (x>5) System.out.print(x--);}}则程序运行后的输出结果是【 】。

以下程序的输出结果是【 】。x=12.7x=Int(x+0.5)Print X

有如下程序段,该程序段执行完后,执行循环的次数是total=0Counter=1DoPrint Countertotal=total + CounterPrint totalCounter=Counter + 1If total 10 ThenExit DoEnd IfLoop While Counter =10( )。A.5B.10C.15D.20

执行以下程序段 Dim i As Integer,X As Integer x=0 For i=20 To 1 Step -2 x=x+i\5 Next Print x 后,x的值为______。A. 16B.17C.18D.19

执行以下程序段的输出结果是( )。 int m=0x12,n=0x12; m=m-n; printf("%X\n",m);A.0X0B.0X12C.0x0D.0

有以下程序include using namespace std;class sample{private:int x;public:sample( 有以下程序#include <iostream>using namespace std;class sample{private: int x;public: sample(int a) { x=a; } friend double square(sample s);};double square(sample s){ return s. x*s. x;}int main(){ sample s1(20),s2(30); cout<<square(s2)<<end1; return 0;}执行结果是( )。A.20B.30C.900D.400

下列程序的输出结果是【】 includeusing namespace std; template T total 下列程序的输出结果是【 】include<iOStream>using namespace std;template <typename T>T total (T*datA){T s=0;while(*datA){s+=*data++;}return s;}int main(){int x[]={2,4,6,8,0,12,14,16,18};cout<<total(x)<<end1;return 0;}

下面程序段的输出结果是【 】。For X=1.5 To 5 Step 1.5Print X;Next X

程序的结果为______。include"iostream.h" template T total(T*data) { Ts=0; while( 程序的结果为______。include"iostream.h"template<typename T>T total(T*data){Ts=0;while(*data){S+=*data++;}return S;}int main(){int x[]={2,4,6,8,0,12,14,16,18};cout<<total(x);retum 0;cout<<endl;}

下列程序段的执行结果为 X=2 Y=5 If X * Y 0A.TrueB. 下列程序段的执行结果为 X=2 Y=5 If X * Y <1 Then Y=Y - 1 Else Y=-1 Print Y-X>0A.TrueB.FalseC.-1D.1

有如下的程序段,该程序段执行完后,共执行的循环次数是 total=0 Counter=1 Do Print Counter total=total * Counter + 1 Print total Counter=Counter +1 If total > 10 Then Exit Do End If Loop While Counter<=10A.4B.10C.15D.20

有如下程序: include using namespace std; template T total(T * data) 有如下程序:include<iostream>using namespace std;template<typename T>T total(T * data) {T s=0;While(* data)s+ = *data + +;return s;}int main(){int x[]:{2,4,6,8, 10, 12, 14, 16, 18};cout<<total(x);

下列程序执行后的输出结果是( )。 main { char x=0xFFFF;printf("%d\n",x--);}A. -32767SXB 下列程序执行后的输出结果是( )。 main { char x=0xFFFF;printf("%d\n",x--);}A. -32767B.FFFEC.1D.32768

有如下程序段,该程序段执行完后,执行循环的次数是 total=0 Counter=1 Do Print Counter total=total + Counter Print total Counter=Counter+1 If total>10 Then Exit Do End If Loop While Counter <=10A.5B.10C.15D.20

下列程序段的执行结果为______。 x = 0: y = 1 z = 1: n = 0 Do x = x + y + z n = n + 1 Loop While x < 10 Print x; nA.10 5B.x nC.9 5D.10 6

有如下的程序段,该程序段的执行完后,共执行循环的次数是 Private Sub Command1_Click() total=0 Counter=l Do Print Counter total=total+Counter Print total Counter=Counter+1 If total>=10 Then Exit Do End If Loop While Counter<=10 End SubA.5B.10C.12D.20

下列程序段的执行结果为 X=5 Y=-20 If Not X>0 Then X=Y-3 Else Y=X+3 Print X-Y;A.-3B.5C.3D.25

下列程序执行后,输出的结果是______。 public class exl7 { public static void main(String[] args) int a=3; int b=4; int x=5; if(++a<b) x=x+a; else if(a--<-b) x-x-a; System.cut.print(x); } }A.4B.5C.3D.2

有以下程序include using namespace std; class sample { private: int x; public: 有以下程序 #include <iostream> using namespace std; class sample { private: int x; public: sample(int a) { x=a; } friend double square(sample s); }; double square(sample s) { return s.x*s.x; } int main() { sample s1 (20),s2(30); cout<<square(s2)<<end1; return 0; } 执行结果是A.20B.30C.900D.400

下述程序段的执行结果是()。includeVoid main(){int x; for(x=1;x 下述程序段的执行结果是( )。 #include <stdio.h> Void main() { int x; for(x=1;x<=100;x++) if(++x%3==0) if(++x%4==0) if(++x%7==0) printf("%d",x); }A.75B.76C.77D.84

有下列程序: fun(int x) {int p; if(x= =0 ‖ x= =1) return(3); p=x-fun(x-2); return p; } main( ) { print f("%d\n",fun(7 ));} 执行后输出的结果是( )。A.7B.3C.2D.0

下列程序的输出结果是( )。 include int fun(int x) {int p;if(x==0‖x==1) return 3;el 下列程序的输出结果是( )。 #include<stdio.h> int fun(int x) { int p; if(x==0‖x==1) return 3; else p=x-fun(x-2); return p; } void main() { print f("\n%d", fun(5)); }A.5B.3C.7D.1

下列程序段的执行结果为 X=5 Y=-20 If Not X0 Then X=Y-3 Else Y=X+3 Print X-Y;A.-3B.5C.3D.25

下面程序段运行后,显示结果是()。DimxIf x Then Print x Else Print x+1A、0B、1C、-1D、显示出错信息

下列程序段执行结果为() x = 5 y = -6 If Not x 0 Then x = y - 3 Else y = x + 3 Print y - x; x - yA、3;-3B、-9;5C、-3;3D、5;-6

下列程序段:Dim x If x Then Print x Else Print x+1运行后,显示的结果是()。A、1B、0C、-1D、出错

单选题下列程序段:Dim x If x Then Print x Else Print x+1运行后,显示的结果是()。A1B0C-1D出错