c语言题库(判断)河南工业大学 河工大 c语言期末考试题库(C language question

合集下载

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语言期末复习试题附答案

c语言期末复习试题附答案

c语言期末复习试题附答案一、选择题(每题2分,共20分)1. C语言中,下面哪个选项不是合法的数据类型?A. intB. floatC. doubleD. character答案:D2. 在C语言中,下面哪个选项是合法的变量名?A. 2abcB. abc12C. abc_12D. abc&12答案:B3. 下面哪个选项不是C语言的运算符?A. +C.D. %答案:D4. 在C语言中,下面哪个选项表示取模运算?A. %B. /C.D. ^答案:A5. 下面哪个选项是C语言中的关系运算符?A. ==B. !=C. >D. <答案:A、B、C、D6. 下面哪个选项是C语言中的逻辑运算符?B. ||C. !D. &答案:A、B、C7. 下面哪个选项是C语言中的赋值运算符?A. =B. +=C. -=D. =答案:A、B、C、D8. 下面哪个选项不是C语言中的控制语句?A. ifB. whileC. do-whileD. for答案:D9. 在C语言中,下面哪个选项表示循环不变量?A. 初始化表达式B. 循环条件C. 循环体D. 步进表达式答案:D10. 下面哪个选项是C语言中的递归调用?A. function(function());B. function();function();C. function(function());function();D. function();function(function());答案:A二、填空题(每题2分,共20分)1. C语言中,一个整型数据占____个字节。

答案:42. C语言中,一个浮点型数据占____个字节。

答案:43. 在C语言中,一元运算符“++”和“--”的优先级高于二元运算符“+”、“-”、“”、“/”、“%”。

答案:正确4. 在C语言中,关系运算符“==”和“!=”的优先级高于“<”、“>”、“<=”、“>=”。

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

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

大学期末c语言考试题库及答案一、单项选择题(每题2分,共20分)1. C语言中,以下哪个是合法的标识符?A. 2variableB. variable2C. variable-2D. variable$2答案:B2. 下列哪个选项是C语言中的关键字?A. includeB. intC. mainD. sum答案:B3. 在C语言中,用于定义一个整型变量的关键字是?A. intB. floatC. doubleD. char答案:A4. C语言中,以下哪个函数用于计算两个数的和?A. max()B. min()C. sum()D. average()答案:C5. 下列哪个选项是C语言中正确的字符串定义方式?A. char str[10] = "Hello";B. char str[10] = 'Hello';C. char str = "Hello";D. char str[10] = "Hello", "World";答案:A6. C语言中,以下哪个是正确的二维数组定义?A. int array[3, 4];B. int array[3][4];C. int array[][] = {1, 2, 3, 4};D. int array[3][4] = {1, 2, 3};答案:B7. C语言中,以下哪个是正确的函数定义?A. void myFunction();B. int myFunction() {}C. void myFunction() {}D. int myFunction() {}答案:C8. 在C语言中,以下哪个选项用于输入一个整数?A. scanf("%d", &number);B. printf("%d", &number);C. gets(&number);D. puts(&number);答案:A9. C语言中,以下哪个选项用于输出一个浮点数?A. printf("%f", number);B. scanf("%f", number);C. gets(number);D. puts(number);答案:A10. 在C语言中,以下哪个选项是正确的循环结构?A. for (int i = 0; i < 10; i--)B. for (int i = 0; i <= 10; i++)C. for (int i = 0; i < 10; i++)D. for (int i = 10; i--; i < 0)答案:C二、填空题(每题2分,共20分)1. 在C语言中,表示逻辑“与”的运算符是 ________ 。

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

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

大学c语言期末考试题库试题及答案在即将到来的大学C语言期末考试中,同学们可能会遇到各种类型的题目。

以下是一些典型的试题及其答案,供同学们复习参考。

1. 以下哪个选项是C语言中的关键字?A. intB. IntegerC. INTD. integer答案:A. int2. 若有定义:int a = 10; 则表达式 a++ 的值是多少?A. 9B. 10C. 11D. 无法确定答案:B. 103. 在C语言中,以下哪个函数用于计算字符串的长度?A. strlen()B. length()C. str_length()D. string_length()答案:A. strlen()4. 若有以下代码片段:```cint x = 5;printf("%d", x++);```执行后输出的结果是?A. 4B. 5C. 6D. 无法确定答案:B. 55. 在C语言中,以下哪个选项表示“逻辑与”操作?A. &&B. ||C. !D. &答案:A. &&6. 若有以下代码:```cint a = 3, b = 4, c;c = a + b;```则变量 c 的值是多少?A. 7B. 3C. 4D. 无法确定答案:A. 77. 在C语言中,以下哪个选项是正确的二维数组声明?A. int array[2,3];B. int array[2][3];C. int array[2][3][4];D. int array[][];答案:B. int array[2][3];8. 若有以下函数定义:```cint add(int x, int y) {return x + y;}```则调用 add(5, 3) 时,返回的值是多少?A. 2B. 5C. 8D. 无法确定答案:C. 89. 在C语言中,以下哪个选项表示“不等于”的比较运算符?A. ==B. !=C. =D. <=答案:B. !=10. 若有以下代码:```cchar str[] = "Hello";str[0] = 'h';```执行后,str 数组的内容是什么?A. "hello"B. "Hello"C. "helloworld"D. "hEllo"答案:A. "hello"这些题目覆盖了C语言的基础知识点,包括关键字、变量、函数、数组以及基本的控制结构。

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

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

(C) scanf("%s",a);
37。 函数调用“strcat(strcpy(str1,str2),str3)” 的功能是( )。
c 语言期末考试试题及答案(word 版可编辑修改)
(A)将字符串 str1 复制到字符串 str2 后再连接到字符串 str3 之后 (B)将字符串 str1 连接到字符串 str2 后再复制到字符串 str3 之后 (C)将字符串 str2 复制到字符串 str1 后再将字符串 str3 连接到 str1 之后 (D)将字符串 str2 连接到字符串 str1 后再将 str1 复制到字符串 str3 中
39. C 语言中,以下叙述中错误的是( )。 A) 主函数中定义的变量是全局变量 B) 同一程序中,全局变量和局部变量可以同名 C) 全局变量的作用域从定义处开始到本源程序文件结束 D) 局部变量的作用域被限定在其所定义的局部范围中
40。 C 语言中,函数调用时若实参是数组名,则被调函数对应形参( ). A) 可以是相应类型简单变量 B) 必须是相应类型数组名 C) 可以是相应类型数组名 D) 必须是相应类型的指针变量
32。 有如下程序 main( ) { int x=1,a=0,b=0; switch(x){ case 0: b++; case 1: a++; case 2: a++;b++; }
c 语言期末考试试题及答案(word 版可编辑修改)
printf(“a=%d,b=%d\n”,a,b); } 该程序的输出结果是 ( ) A) a=2,b=1 B) a=1,b=1 C) a=1,b=0 D) a=2,b=2
7。 在下列选项中,不的赋值语句是( )。

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

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

大学c语言期末考试题及答案一、选择题(每题2分,共20分)1. 下列关于C语言的描述中,错误的是:A. C语言是一种高级语言B. C语言的执行方式是编译执行C. C语言支持面向对象编程D. C语言具有丰富的库函数答案:C2. 在C语言中,用于定义一个结构体的关键字是:A. structB. unionC. enumD. typedef答案:A3. 下列关于数组的描述中,正确的是:A. 数组必须在定义时初始化B. 数组的下标从1开始C. 数组可以存储不同类型的数据D. 数组的大小在定义后不能改变答案:D4. 在C语言中,用于文件操作的库函数是:A. printfC. fopenD. getchar答案:C5. 下列关于指针的描述中,错误的是:A. 指针可以存储变量的地址B. 指针可以作为函数的参数C. 指针可以被赋值为NULLD. 指针可以存储函数的地址答案:D6. 在C语言中,用于定义一个函数的关键字是:A. functionB. defC. voidD. int答案:B7. 下列关于循环的描述中,错误的是:A. for循环可以嵌套使用B. while循环可以和break语句一起使用C. do-while循环至少执行一次D. 循环体内不能使用continue语句答案:D8. 在C语言中,用于定义一个宏的预处理命令是:B. #includeC. #pragmaD. #import答案:A9. 下列关于函数的描述中,错误的是:A. 函数可以有返回值B. 函数可以没有参数C. 函数可以没有返回值D. 函数可以没有定义答案:D10. 在C语言中,用于定义一个枚举类型的关键字是:A. enumB. structC. unionD. typedef答案:A二、填空题(每题2分,共10分)1. C语言中,用于定义一个整型变量的关键字是____。

答案:int2. 在C语言中,表示逻辑与运算的运算符是____。

答案:&&3. 当需要在C语言中表示一个常量时,可以使用关键字____。

河南工业大学C语言考试题

河南工业大学C语言考试题
【HNCE网上考试系统 v9.6】本套软件使用权属于:河南工业大学
考试课程:程序设计基础考试时间:120分钟考场:未定义考试日期:2015.06.16
考号:姓名:
剩余时间:
27:00
保存交卷退出帮助
窗体顶端
本卷共有1道大题:
窗体底端
一、编程题(7道小题,共100分)
1、该程序完成功能:用户输入性别和年龄,用来判读是否退休,若退休则输出“yes”,没有退休则输出“No”,要求:男用'M'字符,女用'F'字符,男的大于60岁退休,女性大于55岁退休。
(15分)
必须将本题程序最后的运行结果填入下面的框中。否则,该题以零分计!
请将你解答本题所写的源程序粘贴到下面或者上载源程序
5、程序功能:用户输入一个字符串,求出该字符串中"Z"字符的个数。
(15分)
必须将本题程序最后的运行结果填入下面的框中。否则,该题以零分计!
请将你解答本题所写的源程序粘贴到下面或者上载源程序
(10分)
必须将本题程序最后的运行结果填入下面的框中。否则,该题以零分计!
请将你解答本题所写的源程序粘贴到下面或者上载源程序
窗体底端
考号:201416030111姓名:尚佳杰
剩余时间:
27:00
保存交卷退出帮助
强烈建议您使用IE5.0以上,屏幕分辨率800X600以上,真彩,小字体浏览
请将你解答本题所写的源程序粘贴到下面或者上载源程序
3、从键盘输入6个整数存到数组中,输出其最小值和它所对应的的下标。
(15分)
必须将本题程序最后的运行结果填入下面的框中。否则,该题以零分计!
请将你解答本题所写的源程序粘贴到下面或者上载源程序

(完整版)C语言题库(编程)河南工业大学河工大c语言期末考考试库

(完整版)C语言题库(编程)河南工业大学河工大c语言期末考考试库

(完整版)C语言题库(编程)河南工业大学河工大c语言期末考考试库C语言题库(编程)河南工业大学河工大c语言期末考试题库二、编程题1.有一函数:当x0时,y=-1;当x=0时,y=0;当x0时,y=1。

编一程序,输入x的值,输出y的值。

#include<stdio.h></stdio.h>void main(){int x,y;printf(“请输入x:");scanf("%d",if(x0)y=-1;else if(x=0)y=0;elsey=1;printf("y=%d",y);}2.输入三个实数,将这三个数按由大到小的顺序排列,并输出这三个数。

#include<stdio.h></stdio.h>void main(){int a,b,c,temp=0;printf("please input a,b,c: ");scanf("%d %d %d",a,b,if(a<b) {temp="a;a=b;b=temp;}</p"></b)>if(a<c){temp=a;a=c;c=temp;}></c){temp=a;a=c;c=temp;}>if(b<c){temp=b;b=c;c=temp;}></c){temp=b;b=c;c=temp;}>printf("从大到小为:%d,%d,%d\n",a,b,c);}3.有三个整数a,b,c,由键盘输入,输出其中最大者。

void main(){int a,b,c,max;printf("输入三个数字:\n");scanf("%d%d%d",a,b,if(abac)max=a;if(babc)max=b;if(cacb)max=c;printf("最大值是: %d\n",max);}4.编程求圆面积、圆周长。

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

c语言题库(判断)河南工业大学河工大 c语言期末考试题库(C language question bank (judgment), Henan University of Technology C language final examination questions bank)~~~1All the operations of a computer are controlled by the program. Without the program, the computer will accomplish nothing.~y~~~1A program is a set of instructions that a computer can recognize and execute.~y~~~1Since computers can recognize and accept machine instructions directly, machine language is the most suitable language for people to program.~n~~~1A compiler can convert programs written in high-level language into machine instructions.~~~1In general, we refer to programs written in high-level languages as object programs.~n~~~1Before you can generate executable programs, you should compile and connect again.~y~~~1The reason for high-level language is that it can be written in a program that does not follow any form.~n~~~1C programming language freedom is large, so it belongs to unstructured language.~n~~~1The C language is a high-level language that does not allow direct access to physical addresses.~n~~~1Functions are a major part of a C program.~y~~~3If you use the TC2.0 compiler, the compilation system is assigned 2, 1, and 4 bytes to int, char, and float~y~~~3The following are valid variable names: day, sum, and _pint~y~~~3If char c is defined, then c= "C"";~n~~~3The C language can use a symbolic name to represent a constant~y~~~3The following procedures segment float x=3.6; int i; i= (int) x; then x=3, i=3~n~~~3In the C language, character data can be arithmetic operations with integer data~y~~~3The accuracy can be specified when using scanf to enter data~n~~~3In C (+, -) operator can only be used for variable~y~~~3The float a=b=c=1.0 is correct in the C language~n~~~3In putchar (c), C can be an escape character~y~~~4The if statement, whether written on a few lines, is a whole and belongs to the same statement.~y~~~4The entire if statement can be written on multiple lines or written on a single line.~y~~~4In the if statement, if must have else.~~~4In the if statement, else must have if.~y~~~4The else clause cannot be used alone as a statement, and must be paired with if.~y~~~4In the C language compiling system, when the result of logical operations is expressed, the value "1" stands for "truth", and "0" means "false"".~y~~~4Arithmetic operators have precedence over relational operators.~y~~~4Logic is not the highest priority in logical operators.~y~~~4The switch statement is a multi branch selection statement.~y~~~4In judging whether a quantity is true, 0 represents "false", and "0" stands for "true"".~y~~~5In the C language, 3 statements that implement the loop structure are the for statement, the while statement, and the DO-WHILE statement.~y~~~5For ((.)) and while (1) are infinite loops.~y~~~5In C, the while statements that implement loop structures are exactly equivalent to the DO-WHILE statements.~n~~~5The execution statement for (i=1; i++<4;); the value of the latter variable I is 4~n~~~5The for statement can only be used in cases where the number of cycles has been determined.~n~~~5The existing definition of int k=1; executes the statement while (++k<4); then, the value of K is 4~y.~~~5#include <stdio.h> int (main) program j=10, i=0 {int, k=2, s=0; for (;;) {i+=k; if (i>j) {printf (%d, s); break;}s+=i;}}, judge i>j carried out 6.~y~~~5Int s=36; while (s) --s; constitutes a dead loop.~n~~~5Program segment int =0; while (t=1) {printf ("%d\n", "t");} at run time, the printf statement executes 0 times.~n~~~5Program #include, <stdio.h>, int, main (), {int, x=23;. Do {printf ("%d", "x--"); "while" ("X");} the output of the runtime is 23~y~~~6When defining an array, an array subscript can be represented by a variable~n~~~6When referencing elements in an array, the array subscript can be represented by a variable~y~~~6Int a[8]; defines an integer array; the last element in the array is a[8]~n~~~6Int a[6]; defines an integer array; the first element in the array is a[1]~n~~~6Int a[2][3]; defines an array in which there are 6 elements in the array~y~~~6Suppose that s[10] is an array of characters, by scanf ("%d", "s"); you can enter a string to the array~y~~~6Int a[6]={0}; defines an array a, and the initial value of each element in the array is 0~y~~~6Int, a[2][3]={{1}, {2}, {3}}; the correct method of initial values for an array~y~~~6Compare the size of two strings, and you can use the strcpy function~n~~~6To connect two strings, you can use the strcat function~y~~~6To test the length of a string, you can use the strlen function~y~~~7If the definition of the call function appears before the main function, you do not have to declare it.~y~~~7The C language cannot define functions nested, nor can nested functions be called. That is to say, no function can be called in the process of invoking a function~n~~~7The variables defined in the primary function are also valid only in the primary function, not in the entire file or program because they are defined in the main function. The main function cannot use variables defined in other functions.~~~7Variables in different functions can use the same name. They represent different objects and do not interfere with each other.~y~~~7Within a function, variables can be defined in compound statements, which are valid only in the compound statement, which is also called a sub program or a block of programs".~y~~~7The variables defined in a function are external variables, and variables defined outside the function are called local variables, and the external variables are global variables (also known as whole variables).~n~~~7Local variables can be shared by other functions in this document. Its range of validity starts from the location of thedefined variable to the end of the source file.~n~~~7It can be divided into static storage mode and dynamic storage mode from the point of view of the existence of variable value.~y~~~7The so-called dynamic storage means when the program is running, the system allocates a fixed storage space.~n~~~7Static storage is the way to dynamically allocate storage space as needed during program execution.~n~~~7In C, if a pointer variable is used to call an argument, the pointer variable is determined, pointing to a defined cell.~y~~~7In the C language, the call of a function can only get a return value, and the pointer can be used as a function parameter to obtain multiple values.~y~~~7In C language, input and output statements are used to input and output data.~n~~~7When using the putchar function, you must include the header file stdio.h before.~y~~~7Using the putchar function, you can output a string to the terminal.~n~~~7Using the printf function, you can output by a certain number of digits.~y~~~7In the printf function, both%c and%s can output strings.~n~~~7When you enter data into a defined variable with the scanf function, you must add &.~y~~~7When data is entered into a defined variable using the scanf function, the data input ends when an illegal input is entered.~y~~~7The use of input and output functions, putchar (getchar ()), statements are wrong (correct).~~~8The pointer to the array element is the address of the index group element.~y~~~8The program for exchanging two pointer variables P1 and P2 is temp=*p1; *p1=*p2; *p2=temp;~n~~~8Printf ("%d", "a[i]") plays the same role as printf ("%d", "*" (a+i)), and the former is efficient.~n~~~8The array name of the parameter is not a national address, but is handled by pointer variables.~y~~~8The pointer to the function that defines the format is int *p (int, int);.~n~~~8The program segments int, *p, a=2; p=&a; printf ("%d", * (p++)); the output is 2~y.~~~8In C99, you can define pointer variables of the base type of void, which can point to any type of variable.~n~~~8The program segment that points P to the string "China" is char *p; p= "China"";~y~~~8Program segments are int, a, m=4, n=6, *p1=&m, *p2=&n, a= (*p1) / (*p2) +5; after execution, the value of a is 5~y~~~8Void f (int *n) {while ((*n) - (printf); "%d" + + (*n));} (main) {int a=1; f (&a);} no output~n~~~9The C language allows users to build their own composite data structures composed of different types of data, called structures.~y~~~9The name of the struct type is the name of the struct.~n~~~9When defining a struct, the type of a member must be specified, either as a simple data type or as a constructed data type.~y~~~9If the program contains the struct type, the name of the struct member cannot be the same as the variable name in the program.~n~~~9Members of structural variables can perform various operations just like normal variables.~y~~~9Each element of an array in an array of structures is of the same type, and can perform input and output operations on each array element as a whole.~n~~~10The file identifier contains three parts,File path, file name, trunk, and file suffix. The naming rule of a file name follows the naming rule of an identifier. The suffix is used to represent the nature of a file, consisting of 3 letters.~~~10According to the organization of data, data files are divided into ASC|| files (text files) and binary files (image files), and ASC|| files save storage space than binary files.~n~~~10In the buffer file system, each using the file has a corresponding file information in memory, and the file associated with the file pointer to the file information and it also points to an external data on the media file.~n~~~10The pointer variable of a file type data is a pointer to a structure named FILE.~y~~~10Open a file in'w'. If the file already exists, the system empties the contents of the file while opening the file and waits for the new data to be written.~y。

相关文档
最新文档