100-100
100-0012FF7C
0012FF7C-100
0012FF7C-0012FF7C
第1题:
有如下语句序列: int k=0: d0{k+=5;cout<<‘$’;} while(k<19); while(k-->0)cout<<‘*’; 执行上面:的语句序列输出字符“$”和“*”的个数分别是( )。
A.4和20
B.5和20
C.4和21
D.5和21
第2题:
有如下语句序列: int k=0: do{k+=5;cout<<'$';} while(k<19); while(k-->0)cout<<'*'; 执行上面的语句序列输出字符“$”和“*”的个数分别是( )。
A.4和20
B.5和20
C.4和21
D.5和21
第3题:
有如下语句序列: intx=100,&r=x; cout<<x<<一<<r<<endl; 已知其中变量x的地址为0012FF2C,则执行该语句序列的输出结果为( )。
A.100—100
B.100—0012FF7C
C.0012FF7C一100
D.0012FF7C一0012FF7C
第4题:
执行下列语句: #include<iostream> using namespace std; int main() { int x=3; if(x=5) cout<<x++<<end1; else cout<<x<<end1; return 0; } 程序的输出是( )。
A.3
B.4
C.5
D.6
第5题:
有如下程序: #include<iostream> using namespace std; class Base{ public: Base(int x=0){cout<<x;} }; class Derived:public Base{ public: Derived(int x=0){cout<<x;} private: Base val; }; int main( ){ Derived d(1); return 0; } 程序的输出结果是
A.0
B.1
C.01
D.001
第6题:
有如下程序: #include<iostream.h> int func(int a, int b) { return(a+b) ;} void main( ) { int x=2,y=5,z=8,r; r=func(func(x,y) ,z) ; cout < < r; } 该程序的输出的结果是
A.12
B.13
C.14
D.15
第7题:
有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;) int getX()const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m,)Base(n){cout<<m;} Derived(int m):y(m){cout<<m;} }; int main(){ Derived d1(3),d2(5,7) return 0; }运行时的输出结果是
A.375
B.357
C.375
D.357
第8题:
有下列语句序列: int k=0; do{k+=5;cout<<'$';} while(k<19); while(k-->0)cout<<'*'; 执行上面的语句序列输出字符“$”和“*”的个数分别是( )。
A.4和20
B.5和20
C.4和21
D.5和21
第9题:
有如下语句序列:
int x=-10;while(++x){}
运行时while循环体的执行次数为______。
第10题:
以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y,int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第11题:
有如下语句序列: int k=0; do { k+=5;cout <<'$;}while (k<19); while(k-- >0)cout<<'*';执行上面的语句序列输出字符$和*的个数分别是______ 。
A.4和20
B.5和20
C.4和21
D.5和21
第12题:
以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第13题:
执行下列语句段后程序的输出结果是______。
int x[]={1,2,3,4,5};
int q=x;
cout<<*(++q)<<end1;
第14题:
以下程序执行后的输出结果是( )。 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = X*X; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第15题:
若有如下语句 #include<iostream.h> void main() { int x=3: do{ X=X-2; cout<<X; }while(!(--x)); } 则上面程序段
A.输出的是1
B.输出的是1和-2
C.输出的是3和0
D.是死循环
第16题:
有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x){cout< ~Part( ){cout<<val;} pritave: int val; }; class Whole{ public: Whole(int x,int Y,int z=0):p2(x),p1(Y),val(z){cout<<val;} ~Whole( ){cout<<val;} pritave: Part p1,p2; int val; f; int main( ){ Whole obj(1,2,3); return 0; } 程序的输出结果是
A.123321
B.213312
C.213
D.123123
第17题:
有如下程序: #include<iostream> using namespace std; int fun(int a, int b) {return(++a*b++);} void main() { int x=3,y=4,z=5,r; r=fun (fun (x,y),z); cout<<r>>endl; cout<<x<<endl; cout<<y<<endl; } 该程序的输出的结果是( )。
A.85 3 4
B.60 3 4
C.126 4 5
D.85 4 5
第18题:
设某程序中定义了全局整型变量x和r,且函数f()的定义如下所示,则在语句“x= r*r+1”中(49)。 int f(int r){ int x; X= r*r+1 ; return x; }
A.x和r均是全局变量
B.x是全局变量、r是形式参数
C.x是局部变量、r是形式参数
D.x是局部变量、r是全局变量
第19题:
若有如下语句 #include<iostream.h> void main() { int x=3; do{ x=x-2 cout<<x; {while (! (- -x); } 则上面程序段( )
A.输出的是1
B.输出的是1和一2
C.输出的是3和0
D.是死循环
第20题:
执行语句:
int result=100;
cout<<(((result>= 60)&&(result<=100))?"good":"general");结果是【 】。
第21题:
如下程序执行后的输出结果是【 】。
include <iostream>
using namespace std;
class Base
{
public:
Base(int x,int y)
{
a=x;
b=y;
}
void Show()
{
cout<<"Base: "<<a<< ',' <<b<<" ";
}
private:
int a,b;
};
class Derived : public Base
{
public:
Derived(int x, int y, int z) : Base(x,y),c(z) { }
void Show()
{
cout<<"Derived:"<<c<<end1;
}
private:
int c;
};
int main()
{
Base b(100,100),*pb;
Derived d(10,20,30);
pb=&b;
pb->Show();
pb=&d;
pb->Show();
return 0;
}
第22题:
有如下程序: #include<iostream) using namespace std; classBase{ public: Base(int x=0){cout<<x;} }; Class Derived:public Base{ public: Derived(int x=0){cout<<x;} private: Base Val; }; int main(){ Derived d(1); return
A.100
B.000
C.010
D.001
第23题:
执行语句序列 int x=1,&y=x; cout<<x<<'-'<<y<<endl; 输出结果为( )
A.x-x
B.1-1
C.1-0
D.异常
第24题:
100-100
100-0012FF7C
0012FF7C-100
0012FF7C-0012FF7C