C++期末考试题及答案[1]

合集下载

C语言程序设计期末试题B及答案

C语言程序设计期末试题B及答案

C语言程序设计教程期末考试试卷(B卷)(考试时间90分钟,满分100分)一、选择题(每小题1分,共20分)下面各题A、B、C、D四个选项中,只有一个选项是正确的,请将正确选项涂抹在答题卡相应的位置上,答在试卷上不得分。

1. 在C语言中,下列标识符中合法的是( )A. -intB. in1_3C. A_B!DD. const2. 不属于C语言基本数据类型的是( )A. intB. unionC. charD. unsigned3. 下面是对宏定义的描述。

不正确的是( )A. 宏不存在类型问题,宏名无类型,它的参数也无类型B. 宏替换不占用运行时间C. 宏替换只是字符串的简单替代D. 宏替换时先检查类型,类型一致时才可以替换4. C语言中,″\\xfds″在内存中占用的字节数是( )A. 3B. 4C. 5D. 65. 设int x;则执行printf(″%x\n″,~x^x);的结果是( )A. ffffffffB. ffC. 0D. 16. 对于while语句,错误的说法是( )A. 用条件控制循环体的执行次数B. 循环体至少要执行一次C. 循环体有可能一次也不执行D. 循环体中可以包含若干条语句7. 执行下列语句后输出的结果是( )int a=8,b=7,c=6;if(a<b)if(b>c){a=c;c=b;}printf("%d,%d,%d\n",a,b,c);A. 6,7,7B. 6,7,8C. 8,7,6D. 8,7,88. 设int a=9,b=20;则printf(″%d,%d\n″,a--,--b);的输出结果是( )A. 9,19B. 9,20C. 10,19D. 10,209. 设static char x[ ]=″12345″,y[ ]={′1′,′2′,′3′,′4′,′5′,′\0′};那么( )A. x数组的长度等于y数组的长度B. x数组的长度大于y数组的长度C. x数组的长度少于y数组的长度D. x数组与y数组的存储区域相同10. 设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. 147B. 159C. 357D. 36911. 执行完下列语句后,n的值是( )int n;for (n=0 ; n<100 ; n=2*n+1);A. 125B. 126C. 127D. 12812. 有以下语句:int a=6;a+=a-=a*a;printf(“%d”,a);输出结果( )A. –132B. –60C. -24D. 013. 为了连接两个字符串s1与s2,应当使用( )A. strcat( s1,s2 )B. strcpy( s1, s2 )C. strlen( s1, s2 )D. strcmp( s1, s2 )14. 设int a,*p;则语句p=&a;中的运算符“&”的含义是( )A. 位与运算B. 逻辑与运算C. 取指针内容D. 取变量地址15. 下面输出的结果为( )int a=13, b=64;printf(“%d\n”, !a || (b>>3) );A. 13B. 64C. 1D. 016. 下列定义正确的是( )A. enum t={a,b}x;B. enum t{1,2}x;C. enum {′+′,′-′}x;D. enum t{a,b}x;17. 设有定义:struct u{int a[4];float b[3]; char c[16];}aa;则printf(″%d\n″,sizeof(aa));的输出是( )A. 32B. 36C. 12D. 818. 数据-54.78在文本文件中占用的字节个数是( )A. 4B. 5C. 6D. 819. 在宏定义#define p(r) 3.14*r中,请问宏名是( )A. pB. p(r)C. 3.14*rD. p(r) 3.14*r20. 要打开一个已存在的用于修改的非空二进制文件“hello.txt”,正确语句是( )A. fp=fopen( "hello.txt ","r" )B. fp=fopen( "hello.txt ","ab+" )C. fp=fopen( "hello.txt ","w" )D. fp=fopen( "hello.txt ","r+" )二、填空题(每小题4分,共36分)请将每一个空的正确答案写在答题卡相对应的横线上,答在试卷上不得分。

期末c语言考试题库及答案

期末c语言考试题库及答案

期末c语言考试题库及答案一、选择题(每题2分,共20分)1. C语言中,以下哪个关键字用于定义一个结构体?A. structB. unionC. enumD. typedef答案:A2. 下列哪个选项是合法的C语言变量名?A. 2nd_variableB. _variableC. variable-nameD. variable$name答案:C3. 在C语言中,以下哪个函数用于将字符串转换为浮点数?A. atoiB. atofC. itoaD. sprintf答案:B4. 下列哪个选项是C语言中的逻辑运算符?A. &&B. ||C. ==D. =答案:A5. C语言中,以下哪个关键字用于定义一个函数?A. classB. functionC. intD. void答案:C6. 在C语言中,以下哪个选项表示“不等于”?A. ==B. !=C. =D. <=答案:B7. 下列哪个选项是C语言中的循环结构?A. ifB. forC. switchD. case答案:B8. 在C语言中,以下哪个函数用于计算字符串的长度?A. strlenB. strcpyC. strcatD. strcmp答案:A9. C语言中,以下哪个关键字用于定义一个指针?A. *B. &C. %D. #答案:A10. 下列哪个选项是C语言中的数组?A. int a[10];B. int *a;C. int a=10;D. int a;答案:A二、填空题(每题2分,共10分)1. 在C语言中,用于定义一个字符常量的数据类型是______。

答案:char2. 在C语言中,用于定义一个整型变量的数据类型是______。

答案:int3. 在C语言中,用于定义一个浮点型变量的数据类型是______。

答案:float4. 在C语言中,用于定义一个双精度浮点型变量的数据类型是______。

答案:double5. 在C语言中,用于定义一个布尔型变量的数据类型是______。

c语言期末考试题库大题及详解答案

c语言期末考试题库大题及详解答案

c语言期末考试题库大题及详解答案C语言期末考试题库大题及详解答案一、简答题1. 请简述C语言的基本数据类型及其特点。

答案:C语言的基本数据类型包括整型(int)、浮点型(float和double)、字符型(char)和枚举型(enum)。

整型用于存储整数,浮点型用于存储小数,字符型用于存储单个字符,枚举型用于定义一组命名的常量。

每种数据类型都有其特定的取值范围和占用内存大小。

2. 请解释C语言中的数组和指针的区别。

答案:数组是一种数据结构,用于存储固定数量的相同类型元素,可以通过下标访问元素。

指针是一个变量,它存储另一个变量的内存地址。

数组名可以作为指向数组第一个元素的指针使用,但数组本身是一个固定大小的内存块,而指针可以被赋值为不同的地址,具有动态性。

二、编程题1. 编写一个C语言程序,实现输入三个整数,找出其中的最大值并输出。

答案:```c#include <stdio.h>int main() {int num1, num2, num3, max;printf("请输入三个整数:");scanf("%d %d %d", &num1, &num2, &num3);max = (num1 > num2) ? ((num1 > num3) ? num1 : num3) : ((num2 > num3) ? num2 : num3);printf("最大值是:%d\n", max);return 0;}```2. 编写一个C语言程序,实现字符串的反转。

答案:```c#include <stdio.h>#include <string.h>int main() {char str[100];printf("请输入一个字符串:");fgets(str, sizeof(str), stdin); // 使用fgets以包含空格int len = strlen(str) - 1; // 减去换行符长度for (int i = len; i >= 0; --i) {printf("%c", str[i]);}printf("\n");return 0;}```三、综合题1. 请编写一个C语言程序,实现一个简单的计算器,能够进行加、减、乘、除四种基本运算。

数据结构c语言期末考试题库及详解答案

数据结构c语言期末考试题库及详解答案

数据结构c语言期末考试题库及详解答案数据结构C语言期末考试题库及详解答案一、选择题1. 在数据结构中,线性表的顺序存储结构被称为:A. 链式存储结构B. 栈C. 队列D. 数组答案:D2. 下列关于栈的描述,错误的是:A. 栈是一种特殊的线性表B. 栈的特点是后进先出C. 栈顶元素是最后插入的元素D. 栈的插入和删除操作都发生在栈顶答案:C二、填空题1. 在C语言中,定义一个具有10个元素的整型数组可以使用语句:________。

答案:int arr[10];2. 链表与数组相比,其优点是________。

答案:动态内存分配,不需要预先知道数据规模三、简答题1. 简述二叉树的遍历方法有哪些,并说明它们的特点。

答案:二叉树的遍历方法主要有前序遍历、中序遍历和后序遍历三种。

前序遍历首先访问根节点,然后递归地遍历左子树和右子树;中序遍历首先遍历左子树,然后访问根节点,最后遍历右子树;后序遍历首先遍历左子树和右子树,最后访问根节点。

每种遍历方法都可以用来对二叉树进行不同的操作和分析。

2. 什么是哈希表?它在实际应用中有哪些优点?答案:哈希表是一种通过哈希函数将键映射到表中一个位置来访问记录的数据结构。

它的优点包括:快速的数据访问速度,因为哈希表通常在常数时间内完成查找;动态的内存分配,可以根据需要调整存储空间;以及灵活的键值对存储方式。

四、编程题1. 编写一个C语言函数,实现单链表的逆序输出。

答案:```c#include <stdio.h>#include <stdlib.h>typedef struct Node {int data;struct Node *next;} Node;void reversePrint(Node *head) {if (head == NULL) return;reversePrint(head->next);printf("%d ", head->data);}int main() {Node *head = (Node *)malloc(sizeof(Node));head->data = 1;head->next = NULL;// 假设链表已经构建完毕reversePrint(head);return 0;}```2. 请实现一个C语言函数,用于计算一个字符串中不同字符的数量。

c语言考试题及答案百度文库

c语言考试题及答案百度文库

c语言考试题及答案百度文库一、选择题1. C语言中,以下哪个关键字用于定义一个结构体?A. structB. unionC. enumD. typedef答案:A2. 在C语言中,以下哪个函数用于将字符串从源地址复制到目标地址?A. strcpyB. strncpyC. strcatD. strcmp答案:A3. 下列哪个选项是C语言中合法的整型常量?A. 0x4FB. 4.5EC. 0b1010D. 0L答案:A二、填空题1. C语言中,用于定义一个变量为静态存储期的关键字是________。

答案:static2. C语言中,用于定义一个变量为自动存储期的关键字是________。

答案:auto3. C语言中,用于定义一个变量为寄存器存储期的关键字是________。

答案:register三、简答题1. 请简述C语言中指针的作用。

答案:指针在C语言中用于存储变量的内存地址,通过指针可以间接访问和修改变量的值,实现动态内存分配和数组操作等功能。

2. 请解释C语言中数组和指针的关系。

答案:在C语言中,数组名可以被当作指向数组第一个元素的指针。

数组的每个元素可以通过指针访问,指针的偏移量可以用于遍历数组。

四、编程题1. 编写一个C语言程序,实现两个整数的加法运算。

答案:```c#include <stdio.h>int main() {int a = 5, b = 10;int sum = a + b;printf("Sum of %d and %d is %d\n", a, b, sum);return 0;}```2. 编写一个C语言程序,实现字符串的反转。

答案:```c#include <stdio.h>#include <string.h>void reverseString(char *str) {int i, j;char temp;for (i = 0, j = strlen(str) - 1; i < j; i++, j--) { temp = str[i];str[i] = str[j];str[j] = temp;}}int main() {char str[] = "Hello, World!";reverseString(str);printf("Reversed string: %s\n", str);return 0;}```。

数据结构c语言期末考试试题及答案

数据结构c语言期末考试试题及答案

数据结构c语言期末考试试题及答案一、选择题(每题2分,共20分)1. 在C语言中,以下哪个关键字用于定义结构体?A. structB. unionC. enumD. typedef答案:A2. 在C语言中,以下哪个函数用于创建链表节点?A. mallocB. callocC. reallocD. free答案:A3. 如果一个链表的头指针为NULL,这意味着什么?A. 链表为空A. 链表已满C. 链表正在使用中D. 链表已损坏答案:A4. 在C语言中,以下哪个数据结构允许快速随机访问?A. 链表B. 数组C. 栈D. 队列5. 在二叉树中,以下哪个术语描述了没有子节点的节点?A. 根节点B. 叶节点C. 内部节点D. 父节点答案:B6. 以下哪个算法用于在二叉搜索树中查找一个元素?A. 深度优先搜索B. 广度优先搜索C. 插入排序D. 二分查找答案:D7. 在C语言中,以下哪个关键字用于定义一个函数?A. intB. voidC. returnD. struct答案:A8. 以下哪个选项是正确的递归函数定义?A. int fact(int n) { if (n > 1) return n * fact(n-1); else return 1; }B. int fact(int n) { if (n > 1) return n * fact(n); else return 1; }C. int fact(int n) { if (n > 1) return n * fact(n+1); else return 1; }D. int fact(int n) { if (n > 1) return n; else return 1; }9. 在C语言中,以下哪个函数用于释放动态分配的内存?A. mallocB. callocC. reallocD. free答案:D10. 在C语言中,以下哪个关键字用于定义一个指针?A. intB. charC. *D. &答案:C二、填空题(每题2分,共20分)1. 在C语言中,结构体的成员可以通过其结构体变量名和______访问。

c语言考试题及答案

c语言考试题及答案

c语言考试题及答案一、选择题(每题2分,共20分)1. 下列关于C语言的描述中,错误的是:A. C语言是一种高级语言B. C语言可以直接被计算机执行C. C语言具有结构化的特点D. C语言具有跨平台的特性答案:B2. C语言中,用于定义一个整型变量的关键字是:A. intB. floatC. doubleD. char答案:A3. 在C语言中,以下哪个运算符用于取模运算?A. %B. /C. *D. -答案:A4. 下列关于数组的描述中,正确的是:A. 数组必须在程序开始时初始化B. 数组的元素可以是不同的数据类型C. 数组的索引从1开始D. 数组的声明必须指定数组的大小答案:D5. 在C语言中,以下哪个关键字用于定义一个函数?A. intB. voidC. functionD. define答案:B6. C语言中,用于表示逻辑“与”操作的运算符是:A. &&B. ||C. !D. &答案:A7. 下列哪个选项是C语言中合法的注释?A. // 这是一个注释B. /* 这是一个注释 */C. // 这是一个注释/* 这是一个注释 */D. /* 这是一个注释 */答案:A8. C语言中,用于定义一个空指针的值是:A. NULLB. 0C. falseD. none答案:A9. 下列关于指针的描述中,错误的是:A. 指针可以存储变量的地址B. 指针可以存储函数的地址C. 指针可以存储数组的索引D. 指针可以存储指针的地址答案:C10. 在C语言中,用于定义一个字符型指针的声明是:A. char *ptr;B. int *ptr;C. float *ptr;D. double *ptr;答案:A二、填空题(每题2分,共20分)1. 在C语言中,定义一个整型数组的语法是:______ int array[10];。

答案:int2. 如果一个变量的值是10,那么表达式sizeof(&var)的结果是:______。

国家开放大学电大考试《C语言程序设计》题库及答案

国家开放大学电大考试《C语言程序设计》题库及答案

《C语言程序设计》期末综合练习题模拟试题一一、单选题1.在每个C语言程序中都必须包含有这样一个函数,该函数的函数名为(A)。

A. mainB. MAINC. nameD. function2.每个C语言程序文件的编译错误分为(B)类。

A. 1B. 2C. 3D. 43.字符串"a+b=12\n"的长度为(B)。

A. 6B. 7C. 8D. 94.在switch语句的每个case块中,假定都是以break语句结束的,则此switch语句容易被改写为(D)语句。

A. forB. whileC. doD. if5.在下面的do-while循环语句中,其循环体语句被执行的次数为(C)。

int i=0; do i++; while(i<10);A. 8B. 9C. 10D. 116.将两个字符串连接起来组成一个字符串时,选用的字符串函数为(C)。

A. strlen( )B. strcpy( )C. strcat( )D. strcmp( )7.若用数组名作为函数调用的实参,传递给形参的是(A)。

A. 数组的首地址B. 数组中第一个元素的值C. 数组中全部元素的值D. 数组元素的个数8.假定a为一个整数类型的数组名,整数类型的长度为4,则元素a[4]的地址比a数组的首地址大(C)个字节。

9.假定s被定义为指针类型char *的变量,初始指向的字符串为"Hello world!",若要使变量p 指向s所指向的字符串,则p应定义为(A)。

A. char *p=sB. char *p=&sC. char *p;p=*sD. char *p; p=&s10.从一个数据文件中读入以换行符结束的一行字符串的函数为(B)。

A. gets( )B. fgets( )C. getc( )D. fgetc( )二、填空题1.执行“printf("%c",'A'+2);”语句后得到的输出结果为(C)。

c期末考试题及答案

c期末考试题及答案

c期末考试题及答案一、选择题(每题2分,共20分)1. 下列哪项不是C语言的基本数据类型?A. intB. floatC. stringD. char答案:C2. 在C语言中,用于定义一个结构体的关键字是?A. structB. unionC. enumD. typedef答案:A3. 下列哪个选项不是C语言中的循环语句?A. forB. whileC. do-whileD. switch答案:D4. 在C语言中,以下哪个运算符用于取地址?A. *B. &C. %D. #答案:B5. C语言中,用于定义一个函数的关键字是?A. functionB. defineC. defD. void答案:D6. 下列哪个选项是C语言中的文件操作函数?A. printfB. scanfC. fopenD. fclose答案:C7. 在C语言中,哪个关键字用于声明一个全局变量?A. externB. staticC. autoD. register答案:A8. 下列哪个选项不是C语言中的逻辑运算符?A. &&B. ||C. =D. !答案:C9. C语言中,用于数组定义的关键字是?A. arrayB. listC. vectorD. []答案:D10. 在C语言中,哪个函数用于输出字符串?A. printfB. scanfC. putsD. getchar答案:C二、填空题(每题3分,共15分)1. 在C语言中,______关键字用于定义一个指针。

答案:*2. C语言中,______函数用于计算字符串的长度。

答案:strlen3. ______关键字用于在C语言中定义一个二维数组。

答案:[ ][ ]4. C语言中,______函数用于将字符串从源字符串复制到目标字符串。

答案:strcpy5. 在C语言中,______运算符用于比较两个值是否相等。

答案:==三、简答题(每题5分,共10分)1. 简述C语言中函数的调用过程。

C语言程序设计期末考试试题含答案

C语言程序设计期末考试试题含答案

C语言程序设计期末考试试题含答案一、选择题(每题 3 分,共 30 分)1、以下选项中,不是 C 语言关键字的是()A intB floatC classD char答案:C解析:在 C 语言中,class 不是关键字,int、float 和 char 都是常见的数据类型关键字。

2、以下变量定义中,正确的是()A int a=b=5;B char a='A';C float a=55, b=66;D double a; b;答案:C解析:A 选项中不能在定义时连续赋值;B 选项应该是 char a ='A';注意单引号;D 选项应该是 double a, b; 中间用逗号分隔。

3、以下程序段的输出结果是()```cint a = 5, b = 4, c = 6;if (a > b && a > c)printf("a 最大\n");else if (b > a && b > c)printf("b 最大\n");elseprintf("c 最大\n");```A a 最大B b 最大C c 最大D 编译错误答案:C解析:因为 5 不大于 6,所以执行 else 部分,输出“c 最大”。

4、以下循环语句执行的次数是()```cfor (int i = 0; i < 5; i++){printf("%d ", i);}```A 4 次B 5 次C 6 次D 无限次答案:B解析:从 0 到 4 ,一共 5 次。

5、以下数组定义中,正确的是()A int a5 ={1, 2, 3, 4, 5, 6};B int a ={1, 2, 3};C int a5 ={1, 2};D int a3 =(1, 2, 3);答案:B解析:A 选项数组长度为 5,却初始化了 6 个元素;C 选项只初始化了前两个元素,后面三个元素默认为 0;D 选项初始化方式错误,应该用花括号。

(完整版)C语言程序设计试卷及参考答案

(完整版)C语言程序设计试卷及参考答案

《C语言程序设计》期末考试模拟试卷及参考答案(B)2012.6.5整理一、选择题(每题2分,共30分)1、# include 〈stdio.h〉的结果是______void main ( ){ int a[3][3]={1,2,3,4,5,6,7,8,9};int s=0,i;for (i=0;i〈3;i++)s+=(*(a+i))[i];printf("%d",s);}A.9 B。

12 C.14 D。

15参考答案—D2、设有说明语句:char a= ’\123abc';则变量a __________A. 包含7个字符B.包含6个字符 C。

包含5个字符 D。

包含4个字符参考答案-D 3、有以下程序段int k=0while(k=1)k++;while 循环执行的次数是_____A。

无限次B。

有语法错,不能执行 C。

一次也不执行D。

执行1次参考答案—A4、在C语言中,_____。

A。

函数定义可以嵌套,但函数调用不能嵌套 B。

函数定义不可以嵌套,但函数调用可以嵌套C.函数定义和调用均不能嵌套 D.函数定义和调用均可以嵌套参考答案—B 5、以下叙述正确的是________A)do—while语句构成的循环不能用其它语句构成的循环代替.B)do-while语句构成的循环只能用break语句退出。

C)用do—while语句构成的循环,在while后的表达式为非零时结束循环.D)用do—while语句构成的循环,在while后的表达式为零时结束循环。

参考答案—D 6、以下关于函数叙述中,正确的是。

A。

在函数体中可以直接引用另一个函数中声明为static类别的局部变量的值B.在函数体中至少必须有一个return 语句C.在函数体中可以定义另一个函数D。

在函数体中可以调用函数自身参考答案—D 7、以下数组声明语句中正确的是。

A。

int a,a[n]; B。

int a[]; C. int a[2][3]={{1},{2},{3}}; D.int a[][3]={{1},{2},{3}};参考答案—C8、以下不能正确进行字符串赋初值的语句是________A。

C语言程序设计期末考试试题(江西理工)1

C语言程序设计期末考试试题(江西理工)1

二、填空题
1. 2. 数学式 所对应的c语言表达式为pow(x, __(1)__)。 已知有声明"char ch='g';",则表达式ch=ch-'a'+'A'的值为字符 (2) G 的编码。 3. 在C语言系统中,如果一个变量能正确存储的数据范围为整数-32768 ~32767,则该变量在内存中占_____(3)_2____个字节。 4. 已知有声明"int a[3][2]={{1,2),{3,4},{5,6}},*p=a[0];",则执 行语句"printf("%d\n",*(p+4));"后的输出结果为__(4)_0__ 。 5. 已知有声明和语句"int a;scanf("a=%d",&a);",欲从键盘上输入数 据使a中的值为3,则正确的输入应是 _____(5)_a=3____ 。 6. C语言源程序中用十六进制表示整型常数必须以___(6)_OX__开 头。 7. 如果一个循环结构的循环体至少要执行一遍,则最适合描述该循 环结构的语句是do while___(7)___语句。 8. 若要声明一个无符号整型变量x,则正确的声明形式是" _unsigned__(8)___ int x;"。 9. 已有声明"int n=12;double a;",则执行语句"a=n/=5;"后,a的 值为___(9)2.000000___。 10. 若有数据类型定义如下: a) union A{float a1;float a2;}; b) 则表达式sizeof(union A)的值为___(10)___。 11. C语言源程序的扩展名为.c,可执行文件的扩展名为 ______(11)__.exe_______。 12. 数组 int a[4][5];共定义了__(12)__20__个数组元素。 13. 若char str[7]={“cake”};int k=strlen(str);则k的值为 ______(13)_5_____。 14. C语言中,用_____(14)__include___ 关键字来包含如stdio.h 之类的头文件。 15. 函数的返回值是通过函数中的_________(15)_return______语 句来获得的。 16. 静态局部变量应该用关键字_____(16)__static_____来进行声 明。 17. 对于不带返回值的函数,应当用关键字 ________(17)_void_____定义函数。

(完整版)C语言程序设计试卷及参考答案

(完整版)C语言程序设计试卷及参考答案

《C语言程序设计》期末考试模拟试卷及参考答案(B)2012.6.5整理一、选择题(每题2分,共30分)1、# include <stdio.h>的结果是______void main ( ){ int a[3][3]={1,2,3,4,5,6,7,8,9};int s=0,i;for (i=0;i<3;i++)s+=(*(a+i))[i];printf("%d",s);}A.9B.12C.14D.15参考答案—D2、设有说明语句:char a= '\123abc';则变量a __________A. 包含7个字符B.包含6个字符C. 包含5个字符D. 包含4个字符参考答案—D3、有以下程序段int k=0while(k=1)k++;while 循环执行的次数是_____A. 无限次B.有语法错,不能执行C. 一次也不执行D. 执行1次参考答案—A4、在C语言中,_____。

A.函数定义可以嵌套,但函数调用不能嵌套B.函数定义不可以嵌套,但函数调用可以嵌套C.函数定义和调用均不能嵌套D.函数定义和调用均可以嵌套参考答案—B 5、以下叙述正确的是________A)do-while语句构成的循环不能用其它语句构成的循环代替。

B)do-while语句构成的循环只能用break语句退出。

C)用do-while语句构成的循环,在while后的表达式为非零时结束循环。

D)用do-while语句构成的循环,在while后的表达式为零时结束循环。

参考答案—D6、以下关于函数叙述中,正确的是。

A.在函数体中可以直接引用另一个函数中声明为static类别的局部变量的值B.在函数体中至少必须有一个return 语句C.在函数体中可以定义另一个函数D.在函数体中可以调用函数自身参考答案—D7、以下数组声明语句中正确的是。

A.int a,a[n];B.int a[ ];C. int a[2][3]={{1},{2},{3}};D.int a[ ][3]={{1},{2},{3}};参考答案—C8、以下不能正确进行字符串赋初值的语句是________A.char str[5]= "good!";B.char str[ ]= "good!";C.char *str="good!";D.char str[5]={ 'g','o','o','d'};参考答案—A9、以下关于switch语句和break语句的描述中,只有______是正确的。

南京信息工程大学2009-2010(1)C语言期末考试试卷A(后附答案)

南京信息工程大学2009-2010(1)C语言期末考试试卷A(后附答案)

南京信息工程大学试卷2009 - 2010 学年第 1学期程序设计基础/C语言程序设计课程试卷( A 卷) 本试卷共 9 页;考试时间 120分钟;任课教师;出卷时间 2010 年 1月学院专业2009 年级班学号姓名得分一、单项选择题 (每小题 1分,共 12分)1.一个C程序的执行是从A.本程序的main函数开始,到main函数结束B.本程序文件的第一个函数开始,到本程序文件的最后一个函数结束C.本程序的main函数开始,到本程序文件的最后一个函数结束D.本程序文件的第一个函数开始,到本程序main函数结束2.下面四个选项中,均是不合法的用户标识符的选项的是A. A p_o doB. float lao _AC. b-a while intD. _123 temp INT3.表达式18/4*sqrt(4.0)/8值的数据类型为A.floatB. charC.doubleD.不确定4.设有如下定义struct ss{ char name[10];int age;char sex;}std[3],*p=std;下面各输入语句中错误的是。

A.scanf("%d",&(*p).age); B.scanf("%s",&);C.scanf("%c",&std[0].sex); D.scanf("%c",&(p->sex));5.有如下定义:int a[3][4]={1,3,5,7,9,11,13,15,17,19,21,23},(*p)[4];下面表示正确的是A.p=a[0]; B.p=*a;C.p=&a[0][0]; D.p=a;6.能正确表示“当x的取值在[1,10]和[200,210]范围内为真,否则为假”的表达式是。

A.(x>=1) && (x<=10) && (x>=200) && (x<=210)B.(x>=1) | | (x<=10) | | (x>=200) | | (x<=210)C.(x>=1) && (x<=10) | | (x>=200) && (x<=210)D.(x>=1) | | (x<=10) && (x>=200) | | (x<=210)7.以下程序段的循环次数是。

C语言程序设计期末考试试题含答案

C语言程序设计期末考试试题含答案

C语言程序设计期末考试试题含答案一、选择题(每题 2 分,共 40 分)1、以下选项中,不是 C 语言关键字的是()A intB floatC charD string答案:D解释:string 不是 C 语言的关键字,C 语言中表示字符串通常使用字符数组。

2、以下能正确表示八进制整数的是()A 0o123B 0123C 0x123D 123答案:B解释:在 C 语言中,八进制整数以数字 0 开头,所以 0123 是八进制整数。

3、以下变量定义中,合法的是()A int a=b=1;B char a='\0';C float 2a;D double a&;答案:B解释:A 选项中不能连续赋值;C 选项变量名不能以数字开头;D 选项变量名不能包含特殊字符&。

4、若有定义:int a=5, b=2; 则表达式 a/b 的值是()A 25B 2C 20D 3答案:B解释:C 语言中,两个整数相除结果为整数,舍去小数部分。

5、若有定义:int a5 ={1, 2, 3, 4, 5};则 a2的值是()A 2B 3C 4D 5答案:B解释:数组下标从 0 开始,所以 a2对应的值是 3 。

6、以下关于函数的叙述中,正确的是()A 函数可以嵌套定义B 函数可以嵌套调用C 函数可以没有返回值D 以上都不对答案:C解释:函数不能嵌套定义,但可以嵌套调用。

函数可以没有返回值,此时函数类型为 void 。

7、若有以下函数定义:```cint fun(int a, int b){return a + b;}```则调用 fun(1, 2)的返回值是()A 1B 2C 3D 4答案:C解释:函数 fun 实现了两个整数的相加,所以 fun(1, 2)的返回值是3 。

8、以下关于指针的叙述中,错误的是()A 指针可以指向变量B 指针可以指向数组C 指针可以指向函数D 指针不可以进行加减运算答案:D解释:指针可以进行加减运算,但运算的结果要根据指针所指向的数据类型来确定。

c语言期末考试填空题题库及详解答案

c语言期末考试填空题题库及详解答案

c语言期末考试填空题题库及详解答案1. C语言是一种______语言,它支持______和______两种编程范式。

答案:高级,过程式,面向对象2. 在C语言中,变量的声明必须在程序的______部分进行。

答案:开始3. C语言标准库中,用于输入输出的头文件分别是______和______。

答案:<stdio.h>,<stdlib.h>4. 一个C语言程序的执行从______函数开始,到______函数结束。

答案:main,main5. C语言中,字符常量可以用单引号括起来,例如'A'表示______。

答案:字符A6. 在C语言中,整数类型int的范围是______到______。

答案:-32767,32767(在16位系统中)7. 表达式 (a > b) ? (a) : (b) 是一个______表达式,用于返回a 和b中的______值。

答案:三元,较大8. C语言中,数组的索引从______开始。

答案:09. 函数声明必须在函数定义之前,或者在______中声明。

答案:头文件10. C语言中,指针是一种变量,它存储了另一个变量的______。

答案:内存地址11. 字符串在C语言中以______字符结尾。

答案:'\0'12. 在C语言中,使用______关键字可以定义一个函数。

答案:void 或其他数据类型13. C语言中,结构体是一种______数据类型,它允许将多个不同类型的数据项组合成一个单一的类型。

答案:复合14. 动态内存分配使用的函数是______,______和______。

答案:malloc,calloc,realloc15. C语言中,______关键字用于定义一个全局变量。

答案:extern16. 在C语言中,______运算符用于计算两个数的乘积。

答案:*17. 函数的参数可以是______、______或______。

(完整版)C语言考试题库及答案

(完整版)C语言考试题库及答案

(完整版)C语言考试题库及答案一、选择题1. 以下哪个选项是C语言的合法标识符?A. intB. 2abcC. voidD. a+b答案:C2. 在C语言中,下列哪个选项是正确的数据类型?A. floatB. integerC. doubleD. All of the above答案:D3. 若变量定义如下:int a = 5;,则执行语句printf("%d", a++); 后,a的值是多少?A. 4B. 5C. 6D. 无法确定答案:C4. 以下哪个函数用于动态分配内存?A. malloc()B. alloc()C. new()D. calloc()答案:A5. 在C语言中,哪个运算符用于取模(取余)?A. %B. /C. &D. |答案:A以下是判断题部分:6. C语言中的数组名可以作为指向该数组首元素的指针使用。

()答案:正确7. 在C语言中,结构体变量可以作为函数的参数传递。

()答案:正确8. 在C语言中,静态存储类别的变量在程序运行期间始终占据内存空间。

()答案:正确二、填空题9. 在C语言中,定义一个整型变量需要使用关键字______。

答案:int10. 若变量定义如下:int a = 10;,则执行语句printf("%d", a--); 后,a的值是______。

答案:911. 在C语言中,用于动态分配内存的函数是______。

答案:malloc12. 在C语言中,用于释放动态分配的内存的函数是______。

答案:free13. 在C语言中,用于清空标准输入缓冲区的函数是______。

答案:getchar()三、编程题14. 编写一个C语言程序,实现以下功能:输入一个整数,输出它的阶乘。

答案:```c#include <stdio.h>int main() {int n, i;long factorial = 1;printf("Enter an integer: ");scanf("%d", &n);if (n < 0) {printf("Factorial of a negative number doesn't exist.\n");} else {for (i = 1; i <= n; i++) {factorial = i;}printf("Factorial of %d is %ld\n", n, factorial);}return 0;}```15. 编写一个C语言程序,实现以下功能:输入一个字符串,判断它是否是回文(正读和反读都一样的字符串)。

c语言期末考试试题及答案

c语言期末考试试题及答案

c语言期末考试试题及答案一、选择题1. C语言中,用于表示整数常量的数据类型是()。

A. floatB. doubleC. intD. char答案:C2. 若有定义:int a = 5; float b =3.14; 则下列表达式中错误的是()。

A. a + bB. a * bC. a / bD. b % a答案:D3. C语言中,用于输入的函数是()。

A. printf()B. scanf()C. puts()D. gets()答案:B4. 下列关于数组的说法,正确的是()。

A. 数组大小是动态的,可以在运行时改变B. 数组一旦定义,其大小不可改变C. 数组可以存储不同类型的数据D. 数组的索引必须从0开始答案:B5. 在C语言中,一个合法的指针变量是()。

A. int *pB. *int pC. float *pD. p int答案:A二、填空题1. 在C语言中,使用关键字________定义一个全局变量。

答案:extern2. 若有定义:int x = 10; 则表达式 `x + (x++) * 2` 的值是________。

答案:303. 在C语言中,使用________可以将字符串常量输出到控制台。

答案:printf4. 一个整型变量可以存储的最大值(假设为int max)与最小值(假设为int min)的范围是________ < int max < int min。

答案:-32768, 32767(假设是16位整型)5. 函数________用于计算一个字符串的长度。

答案:strlen三、判断题1. C语言中的注释可以使用“//”或“/* */”两种形式。

()答案:正确2. 在C语言中,所有的函数都有返回值。

()答案:错误3. 指针变量的地址可以通过使用&运算符获得。

()答案:正确4. 在C语言中,long int和int类型的大小是相同的。

()答案:错误5. 使用switch语句时,case标签后的值必须是整型或字符型。

C语言期末考试试卷附参考答案

C语言期末考试试卷附参考答案

一、单项选择题(请将答案填在下面表格中20×1)1. 以下叙述中正确的是()。

A. C语言比其他语言高级B. C语言可以不用编译就能被计算机识别执行C. C语言以接近英语国家的自然语言和数学语言作为语言的表达形式D. C语言出现的最晚,具有其他语言的一切优点2. 以下叙述中正确的是()。

A.构成C程序的基本单位是函数B.可在一个函数中定义另一个函数C. main函数必须放在其他函数之前D.所有被调用的函数一定要在调用之前进行定义3. 以下叙述中正确的是()。

A. C语言程序总是从第一个函数开始执行B.在C语言程序中,要调用函数必须在main()函数中定义C. C语言程序总是从main()函数开始执行D. C语言程序中的main()函数必须放在程序的开始部分4. 以下有关for循环的正确描述是()。

A. for循环只能用于循环次数已经确定的情况B. for循环是先执行循环体语句,后判断表达式C.在for循环中,不能用break语句跳出循环体D. for循环的循环体语句中,可以包含多条语句,但必须用花括号括起来5. 对下面程序段的描述,正确的是()。

x=-1;do{x=x*x;}while(!x);A.是死循环B. 循环执行一次C. 循环执行两次D. 有语法错误6. 以下有关C语言数组说法正确的是()。

A.数组元素的数据类型可以不一致B.数组元素的个数可以不确定,允许随机变动C.可以使用动态内存分配技术,定义元素个数可变的数组D.定义一个数组后,就确定了它所容纳的具有相同数据类型元素的个数7.以下数组定义正确的是()。

A. int a(20);B. int a[ ]={1,2,5,7,0};C. int a[n];D. int a[2]={1,2,4,6};8.在定义int b[2][10];之后,对b数组元素引用正确的是( )。

A. b[0][9]B. b[2,3]C. b(1)(5)D. b[10] [0]9. 如有定义语句int c[ ]={1,5,3,4,6,7,0};,则数组c有()个元素。

-全国大学生英语竞赛c类真题及答案[1]之欧阳道创编

-全国大学生英语竞赛c类真题及答案[1]之欧阳道创编

2008 National English Contest for College Students(Level C--- Preliminary)Part I Listening Comprehension (25 minutes, 30 marks) Section A (5 marks)In this section, you will hear five short conversations. At the end of each conversation, a question will be asked about what was said. Both the conversation and the question will be read only once. After each question, there will be a pause. During the pause, read the three choices marked A, B and C, and decide which is the best answer. Then mark the corresponding letter on the Answer Sheet with a single line through the center.1. A. To buy a newspaper. B. To find a chemist.C. To post a letter.2. A. Their billing system has been efficient.B. Their old billing system is outdated.C. He’s unimpressed with the new billing system.3. A. She’s been on vacation. B. She’s been at the grocery store.C. She’s been on a business trip.4. A. To go to the market. B. To have coffee.C. To have a discussion.5. A. Changing a flight reservation. B. Canceling a hotel reservation.C. Reserving an extra hotel room.Section B (10 marks)In this section, you will hear two long conversations. Each conversation will be read only once. At the end of each conversation, there will be a one-minute pause. During the pause, read the five questions, each with three choices marked A, B and C, and decide which is the best answer. Then mark the corresponding letter on the Answer Sheet with a single line through the center. Conversation one6. What’s Tania’s phone number?A. 506-6178B. 501-6678C. 501-66877. Who is going shopping at Harrods?A. Tania.B. Karl.C. Karl’s mother.8. How is Tania going to get to Harrods?A. On foot.B. By taxi.C. By tube.9. Which street plan shows the way from the station?A. B.C.10. What kind of wine does Karl want?A. Red Merlot.B. White Bordeaux.C. Rose Chianti.Conversation Two11. Which drawing shows the position of the handle?A. B.C.12. What other product features are included?A. A range of handle sizes.B. A variety of color combinations.C. A set of rings for different-sized tins.13. What’s the purpose of the V-clip?A.To hold the paint brush so it drips in the can.B.To prevent paint from getting onto the paintedsurfaces.C.To prevent the brush drying out if the painter isinterrupted.14. Who will probably use the can-holder?A. Artists.B. Decorators.C. Soldiers.15. How much does the product cost?A. £4.B. £5.C. $4.Section C (5 marks)In this section, you will hear five short news item. Each item will be read only once. After each item, there will be a pause. During the pause, read the question and the three choices marked A, B and C, and decide which is the best answer. Then mark the corresponding letter on the Answer Sheet with a single line through the center. 16. What has prompted the new administration to review the Australia’s citizenship test?A. It’s out of date.B. Higher immigration rates.C. Many applicants failing it.17. Which train provides the easiest way to see Mount Fuji?A. From Tokyo to Yokohama.B. From Osaka to Yokohama.C. From Tokyo to Osaka.18. How many U.N. employees were killed in 2007?A. 17.B. 42.C. 59.19. What have studies found out about severe pneumonia treatment?A.No medication works in developing countries.B.It can be effectively treated at home with oralantibiotics.C.It can only be treated in the hospital withinjectable antibiotics.20. What was the bar’s business like before the smoking ban?A. Almost empty every day.B. Usually crowded at midday.C. Empty on Wednesdays.Section D (10 marks)In this section, you will hear a short passage. There are ten missing words or phrases. Fill in the blanks with the exact words you hear on the tape. Remember to write the answers on the Answer Sheet.Crime isn’t rising because the laws are not strict enough, or because the (21) ________ are not tough enough, or simply because there aren’t enough policemen on the beat. It is rising because the agencies and individuals who can have a (22) _______ effect on crime are not pulling together or in the same (23) ______. The police are one of those agencies, of course. But crime prevention is also a matter for (24) ______ who are content to see mass (25) _______ turn into a way of life, for councils who prefer to shout yah-boo at the police, (26) _____ getting on with making life safer for local people, for architects who design exposed and indefensible buildings, for parents who don’t take enough interest in what their teenage children are getting up to and for (27) ______ who sit inside and moan (28) ______ do anything about the state of the neighborhood or the street. Crime prevention has been neglected for too many by too many. Over the last ten years it has been willfully neglected in defiance of mounting (29) _______ that it is the central hope of (30) ________ action against crime.Part II Vocabulary and Structures (10 minutes, 15 marks)There are 15 incomplete sentences in this part. For each blank there are four choices, marked A, B C and D. Choose the one that best completes the sentence, then mark the corresponding letter on the Answer Sheet witha single line through the center.31. They are looking for _______ man with _______ long dark hair. He is armed and dangerous.A. a; aB. the; aC. a; /D. /; the32. It was unfortunate, but she had no _____ but to act as she did.A. chance.B. opportunityC. optionD. solution33. The _____ driver thinks that accidents only happen to other people.A. generalB. usualC. commonD. average34. How did they manage to steal the Van Gogh? It was right ____ the security guard’s nose.A. belowB. beforeC. underD. beside35. The student ______ continuing his studies when he had to return to his home country unexpectedly.A. is consideringB. was consideringC. should considerD. has considered36. My friends and I enjoy doing many of the same things. In that respect, we have a lot _______.A. in similarB. in particularC. in commonD. in accordance37. Our planned visit to the United States _______ because we were unable to get the visas.A. fell overB. fell downC. fell throughD. fell on38. Lest anyone _____ it strange, let me assure you that it is quite true.A. thoughtB. should thinkC. had thoughtD. thinking39. When Sally ______ the criminal ______ her house, she screamed at the top of her voice because she didn’t want ______.A. saw; enter; killedB. saw; enter; to be killedC. sees; entering; be killedD. sees; enter; killing40. Tina’s children, _____ all live nearby, organized a big party for her eightieth birthday.A. whoB. thatC. whichD. as41. Sometimes it is necessary to be careful _______ theright date to sit for a test.A. when choosingB. when you will chooseC. when you have chosenD. when you chose42. Einstein’s theory of relativity seemed hard to believe at the time _______.A. when he first introducedB. that he first introduced itC. he first introducedD. which he first introduced it43. ________ really. I like both public transport and driving.A. On second thoughtsB. I could go either wayC. I will never learn to driveD. But then again44. _____ I’m getting married!A. Can you keep a secret?B. Well I never!C. Many happy returns.D. Congratulations!45. --- So, do you know where you’d like to go?--- Actually, I’ve heard that it’s very expensive and it’s cold all the time.A. I beg your pardon?B. Yeah, but it’s not very good.C. Do you know any good hotels?D. Do you have any suggestions?Part III Reading Comprehension (20 minutes, 40 marks) Section A (4 marks)There is one passage in this section with 4 questions. For each question, there are four choices marked A, B C and D. You should decide on the best choice, then mark the corresponding letter on the Answer Sheet with a single line through the center.Questions 46-49 are based on the following passage.Most sore throats are caused by an infection whichtreatment with antibiotics cannot cure. But with simple remedies the patient normally gets better in 4 or 5 days. Tonsillitis, however, usually starts with a sore throat which causes pain on swallowing. With children and some adults there may be a fever and the patient is obviously not feeling well. It may be possible to see white spots on the back of the throat. The neck may also swell, both of which are the normal response to infection.Sometimes a sore throat may occur with the common cold, and with influenza there may be dryness of the throat, pain on coughing and loss of voice. TREATMENTAspirin: To help relieve the pain on swallowing and (if there is one) the fever, use aspirin tablets dissolved in water, so that the patient can gargle before swallowing. Repeat the treatment every 4 hours.Drink: Encourage the patient to drink plenty of liquids.Food: Food should not be forced on a patient who does not want to eat.Steam: If there is pain in the throat on coughing, breathing in steam may help.CHILDRENYoung children, who may not be able to gargle, should be given aspirin dissolved in water every 4 hours at the right dose for their age.At one year: a single junior aspirin.At five years: half an adult aspirin.At eight years: one whole adult aspirin.WHEN TO SEE THE DOCTORIf the sore throat is still getting worse after 2 days.If the patient complains of earache.If the patient or parent is very worried.46. According to the passage, it would appear that most sore throats _________.A.require an immediate visit to a doctorB.respond quickly to treatment with an antibioticC.rarely turn out to be symptoms of serious illnessD.result in tonsillitis even when treated47. In order to treat a sore throat one should ________.A.prevent the patient from eating too muchB.give the patient up to 4 aspirin tablets every dayC.advise the patient to drink large amounts ofliquidsD.make the patient gargle with hot liquids48. You should call the doctor in if _________.A.swelling occurs in the region of the earsB.the patient’s condition worsens after 2 daysC.the patient’s throat is still sore after a weekD.the disease spreads to another member of the family49. What difference is there in the way adults and young children should be treated with aspirin?A.Young children should not be allowed to garglewith it.B.Adults should be given tablets to swallow whole.C.Young children should be given aspirin more oftenthan adults.D.Adults should be given larger doses of aspirin thanchildren.Section B (14 marks)There is one passage in this section with 10 questions. Go over the passage quickly and answer the questions on the Answer Sheet.For questions 50-55, markY (for YES) if the statement agrees with the information given in the passage;N (for NO) if the statement contradicts the information given in the passage;NG (for NOT GIVEN) if the information is not given in the passage.For questions 56-59, complete the sentences with the information given in the passage.In 1945 leaders from 51 countries met in San Francisco, California, and organized the United Nations (often called the UN). World War II had just ended. Millions of people had died, and there was destructioneverywhere. People hoped they could build a future of world peace through this new organization.The United Nations has four main goals and purposes:1.To work together for international peace and tosolve international problems;2.To develop friendly relations among nations;3.To work together for human rights for everyoneof all races, religions, and of both sexes;4.To build a center where nations can worktogether for these goals.Today almost every country in the world is a member of the UN. Each country has signed an agreement that says:1. All members are equal.2. All members promise to solve international problems in a peaceful way.3. No member will use force against another member.4. All members will help the UN in its actions.5.The UN will not try to solve problems within countries except to enforce international peace.Obviously, the United Nations has not been completely successful in its goals. There have been several wars since 1945. However, the organization has helped bring peace to some countries that were at war. It has helped people who left their countries because of wars. It has helped bring independence to colonies.The main United Nations organization is in New York City, but the UN has a “family” of other related organizations all over the world. These organizations try to provide a better life for everyone. One example is UNICEF, an organization that provides food, medical care, and many other services for poor children wherever they live. Another example is the World Health Organization, which develops medical programs all over the world.There are thousands of UN workers in developing countries. They work as planners to increase production in farming and industry. They provide medical services,improve education programs, and spread scientific information. They develop programs that provide jobs and better living conditions. They help countries control their population growth.The United Nations also holds large international conferences, where people meet to discuss important world issues. One conference was about the uses and ownership of oceans. Another was about women. There are also International Years. In these special years, people work together to improve situations and solve problems. One year was the International Year of the Child.For centuries countries have fought each other, and powerful countries have taken control of weaker ones. It is very difficult to persuade nations to live together in peace. Nevertheless, the United Nations is attempting to do this. It is the only organization that unites the world in the search for peace.Section C (10 marks) In this section, there is one passage followed by 5 questions. Read the passage carefully, and then answer the questions in as few words as possible (not more than10 words). Remember to write the answers on the Answer Sheet. Questions 60-64 are based on the following passage. A language is a system of sounds, gestures, or characters used by humans to communicate their ideas and feelings. There are about 4,000 spoken languages in the world. Some are spoken by millions of people. Other languages have only a few speakers.All languages have rules for forming words and for ordering those words in sentences. In written languages, meaning is expressed through a system of characters and rules for combining those characters. In spoken languages, meaning is expressed through a system of sounds and rules for combining those sounds. Many50. The United Nations was organized at a meeting in California in 1945. 51. The United Nations works for international peace. 52. Kuwait is a member of the UNICEF. 53. The United Nations has its main organization in San Francisco. 54. The United Nations helped Algeria become independent. 55. UNICEF is an organization that helps save wildlife.56. Each country in the UN has signed an agreement that says no member ______ against another member.57. Despite its effort, the United Nations hasn’t been ______ in its goals.deaf people use sign languages, in which gestures do the work of the sound system of spoken languages.Word order is more important in English than it is in some other languages, such as Russian. The sound system is very important in Chinese and in many languages spoken in West Africa.Languages are always changing, but they change very slowly. People invent new words for their language, borrow words from other languages, and change the meanings of words as needed. For example, the English word byte was invented by computer specialists in 1959. the English word tomato was borrowed from Nahuatl, and American Indian language spoken in Mexico. The English word meat once referred to food in general.There are several major language families in the world. The languages in each family are related, and scientists think they came from the same parent family. Language families come in different sizes. The Austronesian family contains at least 500 languages, including Pilipino, Malay, and Maori. The Basque language, spoken in northern Spain, is the only member of its language family.The Indo-European language family contains 55 languages, including English, German, Spanish, Russian, and Hindi.Another language family is Sino-Tibetan, which includes Chinese, Burmese, and Tibetan. The Afro-Asiatic family includes Arabic, Hebrew, and Amharic. There are about 150 American Indian languages spoken today. These languages have many differences and have been divided into more than 50 language families.People learn languages by listening, copying what they hear, and using the language. Most children learn their first languages easily, and sometimes other languages aswell. Adults often must work harder at learning asecond language.Questions: Section D (12 marks) In this section, there is one passage followed by a summary. Read the passage carefully and complete the summary below by choosing a maximum of three words from the passage to fill in each of the spaces, 65-70.Remember to write the answers on the Answer Sheet.Questions 65-70 are based on the following passage.Welcome to “Software World” --- bringing you thevery latest information on what is currently available on CD-ROM. Are you a director or producer looking for an unusual actor to play a part in a new movie project, or with that special look for a new commercial on TV? OK. The usual procedure would be to contact atheatrical agency, who would try and sell you the idea of using one of the actors listed on their books. Books? Too old-fashioned for you? Then get yourself a copy of this latest electronic database called “The E lectronicCurtain”.The brainchild of casting agent Fred Harkney of the Better Talent Agency, he says he got the idea of anactor’s directory from his son playing computer games. Noting that junior had to type in the details of thecharacters in his favorite game, he realized he could do the same for the actors he represents. Eventually, hecame to include information on nearly three quarters of the approximately 34,000 actors registered and looking for work in Britain. With some theatrical agenciesboasting that they represent over 500 performers, theneed for this product is not hard to fathom. It can be a nightmare trying to remember just which actor has60. How many languages are spoken all over the world? 61. What are the language rules for?62. How is meaning expressed in sign language? 63. What is more important in English compared with other languages?done what, or just what an actor can do. The database lists details of over 5,500 actors: TV shows they haveappeared in, special skills they possess --- everythingdown to the color of their eyes and other distinguishing physical features. By entering the details of the type of person you are looking for, the database quickly locates only those persons with the particular qualitiesrequested.One problem though, is that many actors feel it is too impersonal, and they could be missing out on muchneeded auditions for parts in theatrical shows. On the other hand, it might just get them that elusive job. The days of nervous nail-biting while waiting around to give an audition could well and truly be over. And allbecause of a small plastic disk. For product details ring this number now: 0171-379-60000.Summary:Part IV Cloze (15 minutes, 15 marks) Section A (5 marks) There are 5 blanks in the passage. Use the word given on the right-hand side to form a word that fits in each blank. Remember to write the answers on the Answer Sheet. Section B (10 marks) There are 10 blanks in the passage. For each blank, one or more letters of the word have been given (not exceeding 3 letters). Read the passage below and decide which word best fits each blank, using only one word in each word in each blank. Remember to write the answers on the Answer Sheet. True relaxation is most certainly not a matter of flopping down in front of the television with a welcome An electronic database giving information on nearly (65) ______ the 34,000 actors registered and looking for work in Britain, is now available on CD-ROM. Some (66) ______ have over 500 actors on their books and it is difficult to remember all their details. The database lists information on over 5,500 actors and can be searched for details such as past (67) ______ they have appeared in, special skills they might have, and even the color of their eyes. The database can quickly locate persons with (68) _____ and, although some actors feel it is (69) ______ to be of much use, it is certain to change the way actors are chosen for parts in films, plays and shows. Ring the following telephone number for further (70) _____: 0171-379-6000. Interviews are an (71) ______ method of choosing the best people for jobs, yet human beings like to examine each other in this way. One of the many problems of (72) ______, as it is commonly practiced, is that the forms filled in by applicants often fail to show people as they really are. This means that you can follow all the best advice when completing your form and still find that you are unsuccessful at the next stage ---the interview. (73) _____, in the rare cases where interviews are automatic, a candidate with an inadequate from may do surprisingly well. Of course, your form needs to show that you have (74) _____ in your ability to do the job, but don’t try to turn yourself into someone else --- a person you have to pretend to be at the interview. Realism and (75) _______ are definitely the best perfectselect similardrink. Nor is it about drifting into an exhausted sleep. Useful though these responses to tension and over-tiredness (76) mi_______ be, we should distinguish between them and conscious relaxation in (77) te_____of quality and effect. Regardless of the level of tiredness, real relaxation is a state of alertness, yet, at the same (78) t______, passive awareness, in which our bodies are (79) a________ rest while our minds are awake.Moreover, it is as natural for a healthy person to be relaxed when moving as resting. (80) Be_____ relaxed in action means we bring the appropriate energy to everything we do, (81) W______ needs to be rediscovered is conscious relaxation. With this in (85)m______ we must apply ourselves to understanding stress and the nature of its causes, however deep-seated.Part V Translation (15 minutes, 15 marks) Section A (8 marks)Translate the underlined sentencesof the following passage into Chinese. Remember to write the answers on the Answer Sheet. After my mother passed away, my dad tried even harder to stay healthy and active. Every morning, until the weather turned too cold, he swam in the turquoise pool in the complex where he lived. (86) Each day, no matter how he felt, he swam one more lap than the previous day,just to prove there was always room for improvement. Every few days he reported the new number of laps to me, pride edging his voice.By his late seventies, in spite of swimming and working six days a week, my dad had noticeably dwindled in strength and energy. By age eighty-one he was in poor health and had to retire. (87) He pretended he didn’t need to lean heavily on me for support as we walked slowly, and I pretended not to notice. His mind was clear, but congestive heart problems and disabling arthritis had worn him down. One day he said, “In case of an emergency, I do not wish to be kept alive by anyextraordinary means. I’ve signed an official paper to this effect.” He smiled his wonderful, broad grin and said, “I’ve been blessed to have had your mother as my wife and you as my only child, and I’m ready to go.”Less than a month later he had a heart attack. In the emergency room, he again reminded his doctor and me of his wi shes, but I couldn’t imagine, in spite of this latest crisis, that he wouldn’t always be saying, “Have I told you yet today that I adore you?”(88) He was miserable in intensive care; tubes seemed to come from every opening. But my dad still had his sen se of humor, asking me, “Does this mean we can’t keep our lunch date tomorrow?” His voice faltered.“I’ll be here to pick you up and we’ll go someplace special,” I answered, a lump in my throat.(89) Dad refused to look at me for the first time in his life and turned toward the blank green wall next to his hospital bed. There was a painful silence between us. He said, “I don’t want you to remember me like this. Promise me you won’t, darling! And please go now --- I’m so miserable.Section B (7 marks)Translate the following sentences into English, using the words given in the brackets. Remember to write the answers on the Answer Sheet.90. 她在阳光下只晒了一会儿,脸就开始变红了。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

一、选择填空题(共20小题,每小题2分,共40分)。

1. 关于C++与C语言关系的描述中,()是错误的。

a.C语言是C++语言的一个子集b.C语言与C++语言是兼容的c.C++语言对C语言进行了一些改进d.C++语言和C语言都是面向对象的2.按照标识符的要求,()符号不能组成标识符。

a.连接符b.下划线c.大小写字母d.数字字符3. 为了避免嵌套的if-else语句的二义性,C语言规定else总是与()组成配对关系。

a.缩排位置相同的ifb.在其之前未配对的ifc.在其之前未配对的最近的ifd.同一行上的if4. 在"int a[ ][3]={{1},{3,2},{4,5,6},{0}};"中,a[2][2]的值是()。

a.1b.0c.6d.25. 设"char **s;",以下正确的表达式是()。

a.s="computer";b.*s="computer";c.**s="computer";d.*s='c';6. 对于"int *pa[5];"的描述中,()是正确的。

a.pa是一个指向数组的指针,所指向的数组是5个int型元素b.pa是一个指向某数组中第5个元素的指针,该元素是int型变量c.pa [5]表示某个元素的第5个元素的值d.pa是一个具有5个元素的指针数组,每个元素是一个int型指针7. 在下列表示引用的方法中,()是正确的。

已知:int m=10;a.int &x=m;b.int &y=10;c.int &z;d.float &t=&m;8. 下列for循环的次数为()。

for(i=0, x=0; !x&&i<=5; i++)a.5b.6c.1d.无限9. 对于C/C++语言的函数,下列叙述中正确的是(。

a.函数的定义不能嵌套,但函数调用可以嵌套b.函数的定义可以嵌套,但函数调用不能嵌套c.函数的定义和调用都不能嵌套d.函数的定义和调用都可以嵌套10. 在一个被调用函数中,关于return语句使用的描述,()是错误的。

a.被调用函数中可以不用return语句b.被调用函数中可以使用多个return语句c.被调用函数中,如果有返回值,就一定要有return语句d.被调用函数中,一个return语句可以返回多个值给调用函数11. 在一个函数中,要求通过函数来实现一种不太复杂的功能,并且要求加快执行速度,选用()。

a.内联函数b.重载函数c.递归调用d.嵌套调用12. 使用fseek函数可以实现的操作是(。

a.改变文件指针的当前位置b.文件的顺序读写c.文件的随机读写d.以上都不对13. 下列存储标识符中,()的可见性与存在性不一致。

a.外部类b.自动类c.内部静态类d.寄存器类14. 在如下结构定义中,不正确的是()。

a.struct student{int no;char name[10];float score;};b.struct stud[20]{int no;char name[10];float score;};c.struct student{int no;char name[10];float score;} stud[20];d.struct{int no;char name[10];float score;}stud[100] ;15. 将两个字符串连接起来组成一个字符串时,选用()函数。

a.strlen( )b.strcpy( )c.strcat( )d.strcmp( )16. ( )不是构造函数的特征a.构造函数的函数名与类名相同b.构造函数可以重载c.构造函数可以设置缺省参数d.构造函数必须指定类型说明17. 已知:类A中一个成员函数说明如下:void Set(A&a);其中,A&的含义是( )。

a.指向类A的指针为ab.将a的地址值赋给变量Setc.a是类A对象的引用,用来作函数Set()的参数d.变量A与a按位与作为函数Set( )的参数18. 已知:print( )函数是一个类的常成员函数,它无返回值,下列表示中,()是正确的。

a.void print( ) const;b.const void print( );c.void const print( );d.void print(const);19. 关于虚函数的描述中,()是正确的。

a.虚函数是一个static类型的成员函数b.虚函数是一个非成员函数c.基类中说明了虚函数后,派生类中将其对应的函数可不必说明为虚函数d.派生类的虚函数与基类的虚函数具有不同的参数个数和类型20. 关于new运算符的下列描述中,()是错的。

a.它可以用来动态创建对象和对象数组b.使用它创建的对象和对象数组可以使用运算符delete删除c.使用它创建对象时要调用构造函数d.使用它创建对象数组时必须指定初始值三、(6分)分析下面程序的运行结果#include <iostream.h>class B{public:B(){}B(int i){b=i;}virtual void virfun(){cout<<"B::virfun() called.\n";}private:int b;};class D:public B{public:D(){}D(int i,int j):B(i){d=j;}private:int d;void virfun(){cout<<"D::virfun() called.\n";}};void fun(B *obj){obj->virfun();}void main(){D *pd=new D;fun(pd);}四、(9分)下面的程序可以统计命令行第一个参数中出现的字母个数,请填充下面空白,完成程序。

#include <stdio.h>#include <ctype.h>void main(int argc, argv[];){char *str;int count=0;if(argc<2)exit(1);str= _____;while(*str)if(isalpha(____ )) count++;printf("\n字母个数:%d\n",count);}提示:int isalpha(int ch)函数功能是检查ch是否是字母五、(8分)定义一个字符栈类Stack(包括类的实现)。

数据成员包括一个存放字符的数组stck[ ]和一个栈指针tos。

栈数组的尺寸由常量SIZE确定。

栈的基本操作为Push()和Pop()。

六、(10分)完成下面的函数,对有n个元素的数组a,使数组元素按逆序排列。

void inverse(int *a, int n){}七、(12分)下面的函数统计子字符串substr在字符串str中出现的次数,如果substr 在str中不出现,则返回值0。

请完成该函数。

int str_count(char *substr, char *str){}二、问答题1、虚析构函数有什么作用?解答要点:对象销毁时,需要调用析构函数。

在多态调用时,是用基类的指针访问派生类的对象。

如果析构函数是非虚函数,则基类指针只能访问基类的析构函数,而不能访问派生类的析构函数,导致派生类对象销毁时,没有调用派生类的析构函数,只是调用了基类的析构函数。

如果把析构函数定义成虚函数,则可克服这个问题。

2、拷贝构造函数在哪几种情况下调用?解答要点:用一个对象初始化另一个对象时当用对象作为函数参数传递时当函数返回对象时3、函数重载与函数覆盖有什么不同,它们与多态有什么关系?解答要点:函数重载是指函数名相同,而函数的参数个数或类型不同;覆盖是指在派生类中成员函数与基类成员函数的函数名、参数个数、类型与返回值均相同;C++中正是通过虚函数的覆盖,实现多态的功能。

4、 C++继承是如何工作的?答:继承使得派生类能够使用基类的公有和保护成员,从而实现代码的复用,派生类可以增加成员,也可以隐藏和覆盖基类的成员。

对于公有继承,基类成员的访问权限在派生类保持不变。

5、类与对象有什么区别?答:类是类型,是对象的抽象,对象是类的具体实例。

一个类可以有多个对象,每个对象都有自己的存储单元,而类不占存储单元。

三、运行结果为: D::virfun() called.四、填空① char * ② argv[1] ③ *str++五、(8分)定义一个字符栈类Stack(包括类的实现)。

数据成员包括一个存放字符的数组stck[ ]和一个栈指针tos。

栈数组的尺寸由常量SIZE确定。

栈的基本操作为Push()和Pop()。

const int SIZE=27;class Stack{public:Stack():tos(0){};void Push(char ch);char Pop();private:char stck[SIZE];int tos;};void Stack::Push(char ch){if(tos==SIZE)cout<<"\nStack is full\n";else{stck[tos]=ch;tos++;}}char Stack::Pop(){if(tos==0){cout<<"\nStack is empty\n";return 0;}tos--;return stck[tos];}六、(10分)完成下面的函数,对有n个元素的数组a,使数组元素按逆序排列。

void inverse(int *a, int n){}int i,*p;p=new int[n];for(i=0;i<=n-1;i++)p[i]=a[i];for(i=0;i<=n-1;i++)a[i]=p[n-i-1];delete []p;七、(12分)下面的函数统计子字符串substr在字符串str中出现的次数,如果substr 在str中不出现,则返回值0。

请完成该函数。

int str_count(char *substr, char *str){}int count=0;char *pChar;if(substr==NULL||str==NULL) return count;while(*str!='\0'){pChar=substr;while(*pChar==*str){pChar++;if(*pChar=='\0'){count++;break;}else str++;}//Match while(*pCh...) statementstr++;}//Match while(*str...) statementreturn count;1D 2A 3C 4C 5B 6D 7A 8B 9A 10D 11A 12 C 13 A 14 B 15C 16D 17C 18C 19D 20 A。

相关文档
最新文档