[职称英语等级考试模拟题理工类AB级]第1部分 词汇 选择(第1-15题,每题1分,共15分,建议10分钟以内完成)下面共有15句子,每个句子均有一个词或短语划有底横线,请从每个句子后面所给的四个选项中选择一个与划线部分意义...+阅读
说明:满分为100分,60分及格。前两题为DOS操作题,每题15分,共计30分;后两题为C语言编程题或调试题,共计70分; 测试时间60分钟。
一、DOS操作题
1 删除当前目录下的目录ZSF\DAS。
答案:RD ZSF\DAS
2 将当前目录下的目录KUY\GWE中的文件BTY.EXE改名为KJH.EXE。
答案:REN KUY\GWE\BTY.EXE KJH.EXE
二、调试修改程序题
下面程序中函数fun的功能是:根据整型形参m,计算如下公式的值:y=1+1/2!+1/3!+1/4!+...+1/m!
例如:若m=6,则应输出:1.718056。
请改正函数fun中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
#include〈conio.h〉
#include〈stdio.h〉
/ *错误在fun函数中 * /
double fun(int m)
{int y=1, t=1;
int i;
for(i=2; i〈=m; i++)
{t=t*1/i; y+= t; }
return(y);
}
main()
{int n;
clrscr();
printf("Enter n: ");
scanf("%d", &n);
printf("\nThe result is %1f\n", fun(n));
}
答案:对fun子程序进行修改,修改以后的程序如下:
double fun(int m)
{ double y=1, t=1; /*类型应为 double*/
int i;
for(i=2; i〈=m; i++)
{t=t*1.0/i; y+= t; }
/* 此处应为 double 类型的数据进行运算*/
return(y);
}
三、编程题
请编一个函数int fun(int pm),它的功能是:判断pm是否是素数。
若pm是素数,返回1;若不是素数,返回0。pm的值由主函数从键盘读入。
请勿改动主函数main和其它函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
#include 〈conio.h〉
#include 〈stdio.h〉
#include 〈math.h〉
int fun(int a)
{ /*答案开始 */
┇
┇
/*答案结束 */
}
main() / * 主函数* /
{ int x;
clrscr();
printf("\nPlease enter a number:");
scanf("%d", &x);
printf("%d\n", fun(x));
}
答案:在函数fun中添加程序段如下:
int fun(int a)
{ /*参考答案开始 */
int i;
if(a==2) return 1;
i=2;
while ((a%i)!=0 && i〈=sqrt((float) a)) i++;
if ((a%i)==0)
{ printf("%d not is a prime!",a); return 0; }
printf("%d is a prime!",a); return 1;
/*参考答案结束 */ }
以下为关联文档:
职称英语等级考试模拟题综合类AB级第1部分 词汇 选择(第1-15题,每题1分,共15分,建议10分钟以内完成)下面共有15句子,每个句子均有一个词或短语划有底横线,请从每个句子后面所给的四个选项中选择一个与划线部分意义...
2009年度全国职称外语等级考试用书目录书 名 单价(元) 订数(册) 全国专业技术人员职称英语等级考试大纲 20 全国专业技术人员职称日语等级考试大纲 18 全国专业技术人员职称俄语等级考试大纲 11 全国专业技术人员职称...
全国职称外语等级考试综合类概括大意7PASSAGE 14 Earthquake Every year earthquakes are responsible for a large number of deaths and a vest amount of destruction in various parts of the world. Mos...
全国职称外语等级考试综合类概括大意2PASSAGE 3 Science Fiction Amongst the most popular books being written today are those which are usually classified as science fiction. Hundreds of titles ar...
全国职称外语等级考试综合类概括大意3PASSAGE 5 Recreation and Sports “All work and no play makes Jack a dull boy” is a popular saying in the United States. Other countries he similar sayings....
全国职称外语等级考试综合类概括大意6PASSAGE 12 Adult Education Voluntary learning in anized courses by mature men and women is called adult education. Such education is offered to make people a...
全国职称外语等级考试综合类概括大意4PASSAGE 8 Radio and Television There are few homes in Britain today that do not he either a radio or television set. Both of them he bee an essential part of...
全国职称英语等级考试阅读题Passage 2 Football is, I believe, the most popular game in England: one has only to go to one of the important matches to see this. Rich and poor, young and old...
全国职称外语等级考试综合类概括大意1PASSAGE 1 Successful Language Learners Some people seem to he a knack for learning languages. They can pick up new vocabulary, master rules or grammar, and lea...