ImageVerifierCode 换一换
格式:DOCX , 页数:12 ,大小:52.67KB ,
资源ID:1502202      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/1502202.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C语言期末考试试题南昌航空大学.docx)为本站会员(b****1)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C语言期末考试试题南昌航空大学.docx

1、C语言期末考试试题南昌航空大学C语言期末考试试题-南昌航空大学C语言期末考试试题 南昌航空大学一、单选题(1) 若要定义一个具有5个元素的整型数组,以下错误的定义语句是A)int a5=0;B)int b=0,0,0,0,0;C)int c2+3;D)int i=5,di;(2)以下选项中可用作C程序合法实数的是A).1e0 B)3.0e0.2C)E9 D)9.12E(3)有以下程序段char name20;int num;scanf(name=%s num=%d,name,&num);当执行上述程序段,并从键盘输入:name=Lili num=1001后,name的值为A)LiliB)nam

2、e=LiliC)Lili num=D)name=Lili num=1001(4)if语句的基本形式是:if(表达式) 语句,以下关于“表达式”值的叙述中正确的是A)必须是逻辑值 B)必须是整数值C)必须是正数 D)可以是任意合法的数值(5)若i和k都是int类型变量,有以下for语句for(i=0,k=-1;k=1;k+) printf(*n);下面关于语句执行情况的叙述中正确的是A)循环体执行两次B)循环体执行一次C)循环体一次也不执行D)构成无限循环(6)有以下程序#include void main() int x=1,y=0;if(!x) y+;else if(x=0)if (x) y

3、+=2;else y+=3;printf(%dn,y);程序运行后的输出结果是A)3 B)2 C)1 D) 0(7)设有如下函数定义int fun(int k) if (k1) return 0;else if(k=1) return 1;else return fun(k-1)+1;若执行调用语句:n=fun(3);,则函数fun总共被调用的次数是确语句是A)scanf(%f,&x6); B)scanf(%lf,*(x+6);C)scanf(%lf,p+6); D)scanf(%lf,p6);(15)有以下程序段#include void main() while( getchar()!=n

4、);以下叙述中正确的是A)此while语句将无限循环B)getchar()不可以出现在while语句的条件表达式中C)当执行此while语句时,只有按回车键程序才能继续执行D)当执行此while语句时,按任意键程序就能继续执行(16)若有定义语句:char s310,(*k)3,*p;,则以下赋值语句正确的是A)p=s; B)p=k; C)p=s0; D)k=s;(17)有以下程序#include void fun(char *c) while(*c) if(*c=a&*c=z) *c=*c-(a-A);c+;void main() char s81;gets(s); fun(s); puts

5、(s):当执行程序时从键盘上输入Hello Beijing,则程序的输出结果是A)hello beijing B)Hello Beijing C)HELLO BEIJING D)hELLO Beijing(18)有以下程序#include void main() char a30,b30;scanf(%s,a);gets(b);printf(%sn %sn,a,b);程序运行时若输入:how are you? I am fine则输出结果是A)how are you? B)how are you? C)how are you? I am fine D)howare you? I am fine

6、(19)有以下程序#include int fun (int x,int y) if (x!=y) return (x+y)/2);else return (x);void main() int a=4,b=5,c=6;printf(%dn,fun(2*a,fun(b,c);程序运行后的输出结果是A)3 B)6 C)8 D)12(20)有以下程序#include struct S int a,b;data2=10,100,20,200;void main() struct S p=data1;printf(%dn,+(p.a);程序运行后的输出结果是A)10 B)11 C)20 D)21二、读

7、程序写结果(1)阅读下列程序:#include void main()int a; a=(int)(double)(3/2)+0.5+(int)1.99*2); printf(%dn,a);上述程序的输出结果是(2)阅读下列程序:#include int main() int i; int branch; double bonus,bon1,bon2,bon4,bon6,bon10; bon1=100000*0.1; bon2=bon1+100000*0.075; bon4=bon2+200000*0.05; bon6=bon4+200000*0.03; bon10=bon6+400000*0

8、.015; scanf(%d,&i); branch=i/100000; if (branch10) branch=10; switch(branch) case 0:bonus=i*0.1;break; case 1:bonus=bon1+(i-100000)*0.075;break; case 2: case 3: bonus=bon2+(i-200000)*0.05;break; case 4: case 5: bonus=bon4+(i-400000)*0.03;break; case 6: case 7: case 8: case 9: bonus=bon6+(i-600000)*0

9、.015;break; case 10: bonus=bon10+(i-1000000)*0.01; printf(奖金是 %10.2fn,bonus); return 0; 输入“234000”,上述程序的输出结果是(3)阅读下列程序:#include #include int main()double x1,x0,f,f1; x1=1.5; do x0=x1; f=(2*x0-4)*x0+3)*x0-6; f1=(6*x0-8)*x0+3; x1=x0-f/f1; while(fabs(x1-x0)=1e-5); printf(The root of equation is %5.2fn,

10、x1); return 0; 上述程序的输出结果是(4)阅读下列程序:#include int main() int a11=1,4,6,9,13,16,19,28,40,100; int temp1,temp2,number,end,i,j; scanf(%d,&number); end=a9; if (numberend) a10=number; else for (i=0;inumber) temp1=ai; ai=number; for (j=i+1;j11;j+) temp2=aj; aj=temp1; temp1=temp2; break; for (i=0;i11;i+) pri

11、ntf(%5d,ai); printf(n); return 0; 输入“50”,上述程序的输出结果是(5) 阅读下列程序:#include struct student int num; char name20; float score; ; int main() struct student stu3=10101,Zhang,78,10103,Wang,98.5,10106,Li,86; struct student temp; const int n=3; int i,j,k; for(i=0;in-1;i+) k=i; for(j=i+1;jstuk.score) k=j; temp=

12、stuk;stuk=stui;stui=temp; for(i=0;in;i+) printf(%6d %8s %6.2fn,stui.num,stui.name,stui.score); printf(n); return 0;上述程序的输出结果是(6) 阅读下列程序:#include int main()void copy_string(char *from, char *to); char *a=a teacher.; char b=a student.; char *p=b; printf(string a=%snstring b=%sn,a,b); printf(ncopy string a to string b:n); copy_string(a,b); printf(string a=%snstring b=%sn,a,b); return 0;void copy_string(char *from, char *to) for(;*from!=0;from+,to+) *to=*from; *to=0; 上述程序的输出结果是三、改写程序1.输出结果如图A所示,修改程序,要求(1)不输出第一行的空行;(2)“3”这行输出空行,如图B所示。 #include int main() int i,

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1