《C语言程序设计》模拟卷
题号一二三四总分
得分
评卷人
一、选择题:
1.一个C语言的源程序中____A__。
A)必须有一个主函数 B)可以有多个主函数
C)必须有主函数和其他函数 D)可以没有主函数
2.执行以下语句的结果为____C__。
y=10; x=y++;
A)x=10, y=10 B)x=11, y=11
C)x=10, y=11 D)x=11, y=10
3.执行以下程序段后,c3的值是__A____。
int c1=1,c2=2,c3;
c3=c1/c2;
A) 0 B) 1/2 C) 0.5 D) 1
4.C语言中字符型(char)数据在内存中的形式存储是____D__。
A) 原码 B) 补码 C)反码 D) ASCII码
5.下列常数中不能作为C的常量的是____D__。
A) 0xA5 B) 2.5e-2 C) 3e2 D) 2e32.6
6.C语言中整数-8在内存中的存储形式是___B___。
A) 1111 1111 1111 1000 B) 1000 0000 0000 1000
C) 0000 0000 0000 1000 D) 1111 1111 1111 0111
7.已知 int i,a;执行语句"i=(a=2*3,a*5),a+6;"后,变量i的值是___B___。
A)6 B)12 C)30 D)36
8.执行以下程序段后,a,b,c的值分别是______。
int a,b=100,c,x=10,y=9;
a=(--x==y++)?--x:++y;
if(x<9)b=x++; c=y;
A)9,9,9 B)8,8,10 C)9,10,9 D)1,11,10
9.一个C语言程序的基本组成单位是______C。
A)主程序 B)子程序 C)函数 D)过程
10.已知函数abc的定义为:
void abc ( )
{ ....... }
则函数定义中void的含义是___A_。
A)执行函数abc后,函数没有返回值
B)执行函数abc后,函数不再返回
C)执行函数abc后,可以返回任意类型
D)以上三个答案全是错误的
11.以下程序的输出结果是___C_。
main()
{ int i,x[3][3]={1,2,3,4,5,6,7,8,9};
for(i=0;i<3;i++) printf("%d,",x[i][2-i]);
}
A) 1,5,9, B) 1,4,7, C) 3,5,7, D) 3,6,9, 12.已知:double *p[6];它的含义是___C__。
A)p是指向double型变量的指针 B)p是double型数组
C)p是指针数组 D)p是数组指针
13.已知:int *p, a; 则语句"p=&a;"中的运算符"&"的含义是_____。
A)位与运算 B)逻辑与运算 C)取指针内容 D)取变量地址
14.变量的指针,其含义是指该变量的()
A)值 B)地址 C)名 D)一个标志
15.下面程序段的运行结果是:( C )
char c[ ]=”\t\v\\\0will\n”
printf(“%d”,strlen(c));
A)14 B)3 C)9 D)字符串中有非法字符,输出值不确定
二、填空题:
1.表达式10+16%3的值为_____15______。
2.写出满足下列条件的表达式:a和b都不小于c______a>=c&&b>=_c______________。
3.若有定义:int a[3][4]={{1,2},{0},{4,6,8,10}};则初始化后,a[1][2]得到的初值为___0__。
4.下面函数的功能是求整数1到n的和请把程序补充完整。
long sum( int n)
{ int i;
____int s=0;_____
for(i=1;i<=n;i++)
______s+=i;_________
return s;
}
三、程序阅读题,写出程序的输出结果:
1.#include “stdio.h”
main()
{int i, j;
i=j=2;
if(i==1)
if(i==2)
printf(“%d”,i=i+j);
else
printf(“%d”,i=i-j);
printf(“%d”,i);
}
__________2_________________________。
2.main()
{int i=3
while(i<10))
{if(i<6)
{i+=2;
continue;
}
else
printf(“%d ”,++i);
}
}
___________8910________________________。
3.#include “stdio.h”
#define X 5
#define Y X+1
#define Z Y*X/2
main( )
{int a;
a=Y;
printf(“%d %d\n”,Z,--a);
}
____________15 5___________________________。
四、编程题:(共45分)
1.编程求分段函数y=f(x)的值,f(x)的表达式如下:
2x+3 x<-1
f(x)= 5x+10 -1≤x≤1
12x x>1
2.用switch语句编写程序,实现以下功能:从键盘输入数字1、2、3、4。分别显示excellent,good,pass,fail.输入其它键时显示error。
3.编写一函数,找出一整数的全部因子。
参考答案:
1、
#include "math.h"
main( )
{float x,y;
printf("input x\n");
scanf("%f",&x);
if(x<-1) y=2*x+3;
else if(x>=-1&&x<=1) y=5*x+10;
else y=12*x;
printf("x=%f,y=%f",x,y);
}
2、
main()
{ int x;
printf("please input a number\n");
scanf("%d",&x);
switch (x)
{ case 1: printf("excellent\n");break;
case 2: printf("good\n");break;
case 3: printf("pass\n");break;
case 4: printf("fail\n");break;
default : printf("error\n");
}
}
3、
void yz(int n)
{ int i;
for(i=1;i<=n;i++)
I f(n%i==0) printf("%5d",i);
return ;
}
模拟题一 第一部分:交际用语 此部分共有5个未完成的对话,针对每个对话是未完成的部分有4个选项,请从A、B、 C、D四个选项中选出可以填入空白处的最佳选项,并用铅笔将答题卡上的相应字母涂黑。 1. — Hello! May I talk to the manager about the price —. A. Sorry, he is out at the moment B. No, you can’t C. Sorry, y ou can’t D. I don’t know 2. —I’m terribly sorry that I made your table cloth dirty. —______. A. Never mind B. Don’t mention it C. That’s right D. Sorry 3. ― Do you mind if I open the window ―______ I feel a bit cold. A. Of course not. B. I’d rather you didn’t. C. Go ahead. D. Why not 4. —Excuse me, sir. Where is Dr. Smith’s office —. A. You can’t ask me B. Good question C. Please don’t say so D. Sorry I don’t know, but you can as k the man over there 5. — Good morning, sir. May I help you —. A. No, I don’t buy anything B. No, I don’t need your help C. Yes, I need some salt D. Oh, no. That’s Ok 第二部分:阅读理解 此部分共有2篇短文,每篇短文后有5个问题。请从每个问题后的A、B、C、D四个选项中,选出可以填入空白处的最佳选项,并用铅笔将答题卡上的相应字母涂黑。 Passage 1
模拟题三 第一部分:交际用语 此部分共有5个未完成的对话,针对每个对话有4个选项,请从A、B、C、D四个选项中选出可以填入空白处的最佳选项,并用铅笔将答题卡上的相应字母涂黑。 1. –Hello! I want to make a person-to-person call to Toronto, Canada. The number is 932-0806. --___B_____. A. But I don’t know whom do you want to call. B. What’s the name of the party you’re calling? C. What’s the address of the person you’re calling? D. What’s the extension number you’re calling? 2. ---Have you ever been to the Temple of Heaven in Beijing? -- ___B__. A. No, but I have no time. B. No, but I’d like to. C. Yes. I was too busy then. D. Yes. I couldn’t do it right now. 3. –Is everyone always so helpful to you in your office? --- __D___. A. Yes. What can I do for you now? B. Yes, there is a hotel nearby. C. Yes. Can I help you? D. Yes. It’s a great place to work. 4. ---It’s a beautiful day today! How about a little trip out into the country? --- ___A______. A. That sounds great. What should I do for the preparation? B. I don’t know. I really haven’t thought about what we’d do. C. Well, would you like me to pack picnic or to buy something? D. It’s all right. Thank you. 5. –Excuse me. Could you show me the way to the nearest subway station? --- ___C____. A. Any time. It’s next to the post office. B. All right. Do you want me to go with you? C. No problem. With pleasure. D. Of course not. Go down this street and turn right. 第二部分:阅读理解 此部分共有2篇短文,每篇短文后有5个问题。请从每个问题后的A、B、C、D四个选项中,选出可以填入空白处的最佳选项,并用铅笔将答题卡上的相应字母涂黑。 Passage 1 The greatest recent social changes have been in the lives of women. During the twentieth century there has been a remarkable shortening of the proportion of a woman’s life spent in caring for children. A woman marrying at the end of the nineteenth century world probably have been in her middle twenties, and would be likely to have seven or eight children, of whom four or five lived till they were five years old. By the time the youngest was fifteen, the mother would have been in her early fifties and would expect to live a further twenty years, during which custom, opportunity and health made it unusual for her to get paid work. Today women marry younger and have fewer children. Usually a woman’s youngest child will be fifteen when she is forty-five and can be expected to live another thirty-five years and is likely to take paid work until retirement at sixty. Even while she has the care of children, her work is lightened by household appliances and convenience foods. The important change in women’s life-pattern has only recently begun to have its full effect on women’s economic p osition. Even a few years ago most girls left school at the first opportunity, and most of them took a full-time job.
网页设计与制作模拟题2 一、单项选择题 1.在配置连接一个SQL Server数据库的ODBC,下列说法中,(C)是不准确的。 A. 配置时,可以直接测试数据源 B. 配置时,必须指定数据库的主机地址 C. 配置时无须输入用户和密码 D. 对Web应用而言,应该建立System DSN 2.因特网上的域名服务称为( B )。 A. WINS B. DNS C. ARP D. TELNET 3.构成DHTML的各种技术中不包括( B )。 A. 客户机端脚本 B. 服务器端脚本 C. CSS D. DOM 4.HTML是一种页面( D )型的语言。 A. 程序设计 B. 执行 C. 编译 D. 描述 5.在HTML中定义一个表单应该使用以下标记( A ) A.