logo资料库

2023年湖北武汉工程大学C语言与程序设计基础考研真题.doc

第1页 / 共9页
第2页 / 共9页
第3页 / 共9页
第4页 / 共9页
第5页 / 共9页
第6页 / 共9页
第7页 / 共9页
第8页 / 共9页
资料共9页,剩余部分请下载后查看
2023年湖北武汉工程大学C语言与程序设计基础考研真题 一 、单项选择题(本大题共 15 小题, 每小题 3 分 ,共 45 分) 1. 下面语句中正确的表达式有 ( ) 条。 (1)cout >> 3 + 4; (2)COUT << 3 * 4; (3)cout << 3 / 4; (4)cout < < 3 - 4; A . 3 B. 2 C. 1 D. 0 2. 能用来判断变量 z“在 2018 到 2022 之间(含 2018 和 2022)”的表达式是 ( )。 (1)( x <= 2022 & x >= 2018 ) (2)( x >= 2018 ) && ( x <= 2022) (3)( 2018 <= x) && ( x <= 2022) (4)( 2018 <= x <= 2022) A.只有(2)正确 B.只有(2)、(3)正确 C.只有(2)、(3)、(4)正确 D.均正确 3. 以下程序片段共输出( )个"WIT"。 for (int i=0; i<3; i++) for(int j=1; j<=6; j++) { cout <<"WIT"<
B.int a[10]; C.int a[] = {0}; D.int a[]; 5.以下选项中均满足 C 语言标识符命名规则的是( )。 A. PI is bad-person _main B. float HK C. 3cal _4NT D.that_ 6.设有定义语句 int a[3][3];和函数调用语句 sort(a,3); 则正确的函数声明语句是( 。 ) A.void sort(int a,n); B.void sort(int a[][],int n); C.void sort(int a[][3],int n); D.void sort(int a[][3], n); 7. 以下代码执行后,变量 k 的值是( )。 int k=0; while (k<=3) k++; A.4 B.3 C.0 D.1 8.以下关于运算符优先顺序的描述中,正确的是( )。 A.关系运算符<算术运算符<赋值运算符<逻辑与运算符; B.算术运算符<关系运算符 <赋值运算符<逻辑与运算符; C.赋值运算符<逻辑与运算符<关系运算符<算术运算符; D.赋值运算符<关系运算符<逻辑与运算符<算术运算符。 9. 以下关于运算符 new 的用法,正确的有( )个。 (1)int *p=new int[4]; (2)int*q=new int{100}; (3)char *s=new char[34.5]; (4)double *pd= new double[10* 15]; A.0 B.1 C.2 D.3 10. 根据下面的定义,能输出字母 s 的语句是( )。 struct Person { char title[20];int code;}; Person book[4]={"Physics", 17,"Mathematics", 18,"English",20,"History", 18}; A.cout<
B.cout<0) .a>=a B.!a||a C. a%=a D 12. 若有以下的声明语句,则下列选项中,其结果与表达式"*(a+2) "相等的是( )。 int i=2,a[]={0,2,4},*b; b=&i; A.a[0] D.*(a+*b) B.*a+i C.*(a+b) 13. 在类型相同的两个指针变量之间,不能进行的运算是( )。 A.< B.= C./ D. - 14. 若有以下的定义语句,则数值为 3 的表达式是( )。 int w[3][4]={{0, 1}, {2,3}, {4,5}}; int (*p)[4]=w; A.*w[1]+1 B.p++,*(p+1) C.w[2][2] D.p[1][1] 15. 以下程序运行后,输出结果是( )。 int main( ) { char good_man='Y'; if (good_man>='F') good_man=good_man-'F'+'f'; else good_man='X'; cout<c) b=a;a=c;c=b;
2.若 x 为整型变量,计算表达式 x='c' -'a'后,x 的值为 。 3.以下程序的功能是:从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩,当 输 入负数时结束输入,试根据程序功能填空。 #include int main() { double x,max,min; cin>>x; max=x; min=x; while( ) {if(x>max) if(x
return 0; } 输出结果是 2. #include int main() { int a= 10; if(a>10) cout<<(a>10); else cout<<(a<10); cout< int main() { int n=7; while(n<10) { n=n+1; cout< int main( ) { int a[5],i,k=0;
for(i=0;i<5;i++) a[i]=i; for(i=0;i<5;i++) k=k+a[i]+i; cout< int d= 1; void fun(int p) {int d=5;d=d+p--; cout< int main() { int x,y; for(y= 1,x= 1;y<=40;y++) { if(x>= 10) break; if(x%3==1) {x=x+5;continue;} x=x-3;
} cout<<"x="< int fun2(int a,int b) { int c; c=(a*b)%3; return c; } int fun1(int a,int b) { int c; a=a*a; b=b*b; c=fun2(a,b+fun2(a,b)); return c*c; } int main() { } int x=2,y=8; cout< int main() { int a= 1,b=2; int mm(int,int);
cout< struct Student { int id; double score; }; int main() { Student a[3]={2022001,89,2022002,92,2022003,90}; Student *p=a; cout<< p->id++ <<"\t"<score<id <<"\t"<score<score<
分享到:
收藏