80.1
-80.0
90.5
70.1
第1题:
(35)有下列程序段,单击命令按钮执行程序后,输出结果是 。Option Base 1Private Sub Commandl_Click() Dim x x=Array(23,-5,17,38,-31.46,11,8,5,-4) s1=0 s2=0 For k=1 To 10 If(x(k)>0)Then s1=sl+x(k) Else s2=s2+x(k) End If Next k Y=s1/Abs(s2) Print Y End SubA.148 B.40 C.-40 D.3.7
第2题:
以下程序的执行结果是【 】。
include<iostream.h>
include<stdlib.h>
class Sample
{
public:
int x,y;
Sample(){x=y=0;}
Sample(int a,int b) {x=a;y=b; }
void disp()
{
cout<<"x="<<x<<",y="<<y<<end1;
}
};
void main() {
Sample s1(2,3);
s1.disp();
}
第3题:
下列程序的执行结果是( )。 #include<iostream.h> #include<stdlib.h> Class TestClass { public: int x,y; TestClass(){x=y=0;} TestClass(int a,int b){x=a;y=b;} void disp() { cout<<"x="<<x<<",y="<<y<<end1; } }; void main() { TestClass s1(2,3); s1.disp(); }
A.x=2,y=2
B.x=3,y=3
C.x=2,y=3
D.x=3,y=2
第4题:
有以下程序: void swap(char*x,char*y) { char t; t=*x;*x=*y;*y=t; } main { char*s1="abe",*s2="123": swap(s1,s2); printf("%s,%s\n",s1,s2); } 程序执行后的输出结果是( )。
A.123,abe
B.abc.123
C.1bc,a23
D.321,cba
第5题:
下列程序的执行结果是( )。 #include<iostream.h> class Sample { int x,y; public: Sample() {x=y=0;} Sample(int a,int b) {x=a;y=b;} ~Sample() { if(x==y) cout<<"x=y"<<end1; else cout<<"x!=y"<<end1; } void disp() { cout<<"x="<<x<<",y="<<y<<end1; } }; void main() { Sample s1(2,3); s1.disp(); }
A.x=2,y=2
B.x=3,y:3
C.x=2,y=3
D.x=3,y=2
第6题:
下列程序执行的结果为 x=25:y=20:z=7 Print "S";x+z*y;")"
A.S(47)
B.S(165)
C.S(25+7*20)
D.S(87)
第7题:
有下列程序段,单击命令按钮执行程序后,输出结果为( )。 Option Base 1 Private Sub Command1_Cliek() Dim x x=Array(23, -5, 17, 38, -31, 46, 11, 8, 5, -4) s1=0 s2=0 Fork=1 To 10 If (x(k)>0) Then s1=s1+x(k) Else s2=s2+x(k) End If Next k Y=s1/Abs(s2) Print Y End Sub
A.148
B.40
C.-40
D.3.7
第8题:
有如下程序: Private Sub Command1 Click() Dim a As Single Dim b As Single a=5:b=4 Call S(a,B)End Sub Sub S(x As Single,y As Single) t=x x=t\y y=t Mod y End Sub 在调用运行上述程序后,a和b的值分别为
A.0 0
B.1 1
C.2 2
D.1 2
第9题:
执行以下程序后的输出结果为( )。#include<iostream. b>class Sample{ int x, y; public: Sample() { x=y=0;} Sample(int a, int b) {x=a; y=b; } void disp () { cout<<"x="<<x<<"y="<<y<<end1; }};void main(){ Sample s(2,3), *p=&s; p->disp();}
A.x=1, y=3
B.x=2, y=4
C.x=3, y=2
D.x=2, y=3
第10题:
有程序:CHARACTER*6SS=‘ABCDEF’CALLSS(S)ENDSUBROUTINESS(S1)CHARACTERS1*3WRITE(*,*)S1END此程序执行后的输出结果为:()
第11题:
ABC
BCD
CDE
DEF
第12题:
abe,123
123,abc
321,cba
1bc,a23
第13题:
分析以下程序的执行结果【 】。
include<iostream.h>
class Sample
{
int x, y;
public:
Sample() {x=y=0; }
Sample(int a, int b) { x=a; y=b;}
~Sample()
{
if(x==y)
cout<<"x=y"<<end1;
else
cout<<"x!=y" <<end1;
}
void disp()
{
cout<<"x="<<x<<",y="<<y<<end1;
}
};
void main()
{
Sample s 1 (2,3);
s1.disp();
}
第14题:
下列程序的运行结果是【 】。
include <iostream. h>
class Sample {
int x,y;
public:
Sample() {x=y=0; }
Sample(int a, int b) {x=a;y=b;}
void disp() {
cout<<" x=" <<x<<" , y="<<y<<end1;
}
};
void main() {
Sample s1, s2(1, 2);
s1. disp0;
s2. disp ();
}
第15题:
以下程序的执行结果是【 】。
include<iostream. h>
class Sample
{
public:
int x:
int y;
void disp()
{
cout<<"x="<<x<<",y="<<y<<end1;
}
};
void main()
{
int Sample:: ** pc;
Sample s;
pc=& Sample: :x;
s.*pc=10;
pc:=&Sample: :y;
s.*pc=20;
s.disp();
}
第16题:
以下程序的执行后,x和y的值是 ______ 。 #include <iostream. h> class Sample { public: int x; int y; void disp() { cout<<"x="<<x<<", y="<<y<<end1; } }; void main() int Sample: :*pc; Sample s; pc=&Sample:: x; s. *pc=10; pc=&Sample: :y; s. *pc=.20; s. disp ();
A.x=10, y=20
B.x=20, y=10
C.x=10, y=10
D.x=20, y=20
第17题:
有以下程序:#include <iostream>using namespace std;class sample{private: int x; static int y;public: sample(int a); static void print(sample s);};sample:: sample(int a){ x=a; y+=x;}void sample:: print(sample s){ cout<<"x="<<s. x<<",y="<<y<<end1;}int sample:: y=0;int main(){ sample s1(10); sample s2(20); sample:: print(s2); return 0;}程序运行后的输出结果是( )。
A.x=10,y=20
B.x=20,y=30
C.x=30,y=20
D.x=30,y=30
第18题:
下列程序的输出结果是______。#includemain(){ char *a="abcdefghi";int k; fun(a);puts(a);}fun(char*s){ int x,y;char c; for(x=0,y=strlen(s)-1;x<y;x++,y--) { c=s[y];s[y]=s[x];s[x]=c;}}
A.ihgfsdcba
B.abcdcfghi
C.abcdedeba
D.ihgfefghi
第19题:
下列程序执行的结果为 x=25:y=20: z=7 Print"S(";x+2*y;")"
A.S(47)
B.S(165)
C.S(25+7*20)
D.S(87)
第20题:
有以下程序:#include <stdio.h>void swap(char * x,ehar * y){ char t; t= *x; *x: *y; *y=t;main ( ){ char *s1 ="abc", * s2 ="123"; swap(s1 ,s2); printf("%s,%s \n" ,s1 ,s2);}程序执行后的输出结果是( )。
A.123,abe
B.abe,123
C.1bc,a23
D.321,cba
第21题:
有以下程序:void swap (char *x,char *y){char t; t=*x,*x=*y;*y=t;}main(){char* s1="abc",*s2="123"; swap(s1,s2); printf("%s,%s\n",s1,s2);}程序执行后的输出结果是( )。
A.123,abc
B.abc,123
C.1bc,a23
D.321,cba
第22题:
有以下程序 void swap(Char *x,Char *y) {Char t; t=*x;*x=*y;*y=t; } main( ) {Char *s1=”abc”,*s2=”123”; swap(sl,s2); printf(”%s,%s/n”,s1,s2); } 程序执行后的输出结果是()
第23题:
80.1
-80.0
90.5
70.1
第24题:
1bc,a23
abc,123
123,abc
321,cba