The basic unit of 1 C language source program is (b).
A process b function c subroutine d identifier
2. The output of the following program is (c).
Master ()
{ int a=7,b = 5;
printf("%d\n ",b = b/a);
}
A 5 B 1 C 0 D uncertain value
3. Assuming that variables A and B are integers, the expression (A = 5, B = 2, A >;; b? A++:b++, the value of a+b) is (b).
A 7 B 8 C 9 D 2
4. Let A be an int variable, and after the following assignment statements are executed, the values of A are (b) respectively.
a = 125.534; a =(int) 125.52 1% 4; a = 5 & lt& lt2;
A 125,3 1, 1 B 125, 1,20 C 125,3 1,20 D 125,534,2,20
5. There are the following program segments, and the correct one in the following description is (c).
int k = 10; And (k = 0) k = k-1;
A loop is executed once, B loop is infinite loop, C loop body statement is not executed once, and D loop body statement is executed once.
6. The output of the following program is (a).
int I;
void prt()
{ for(I = 5; I<8; i++) printf("%c ",' * ");
printf(" \ t ");
}
Master ()
{ for(I = 5; I < = 8; i++)PRT();
}
A * * * B * * * * * * * * * * * * C * * * * * * D * * *
7. In the C language program, the following statement is correct (B).
Function definitions can be nested, but function calls cannot be nested.
The definition of function b cannot be nested, but the call of function can be nested.
Neither the definition of C function nor the call of function can be nested.
The definition of d function and the call of function can be nested.
8. The following function call statement contains (a) parameters.
func((e 1,e2),(e3,e4,E5));
A syntax error of 2 B 3 C 5 D
9. The output of the following program is (a).
# define ADD(x) x*x
Master ()
{ int a=4,b=6,c=7,d = ADD(a+b)* c;
printf("d=%d ",d);
}
A d=70 B d=80 C d= 140 D d=700
10. The known employee records are described as follows. In Turbo C, the system allocates (c) bytes of space for the variable w. ..
Structural worker
{ int no
char name[20];
Charming sex;
alliance
{int dayint month; Int year; } born;
} w;
A 29 B 20 C 25 D 6
1 1. provides the following definitions, and the enumeration constant with a value of 5 is (a).
Enumeration week {Sunday, Monday =4, Tuesday, Wednesday, Thursday, Friday, Saturday} w;;
A Tuesday b Saturday c Friday d Thursday
12. the correct assignment statement in the following options is (let char a [5], * p = a;; (English translation) 1.
A p = " abcdB a = " abcdC * p = " abcdD * a = " abcd
13. In the following program segment, the expression with a value of 6 is (b).
struct ST { int n; struct st * next};
Static structure st a[3]={5, ampa[ 1], 7, & ampa[2], 9,0}, * p;;
p = & ampa[0];
A p++-> nb++p->: n C p->n++ D (*p)。 n++
File types in 14. C language only has (d).
An index file and a text file, one of two B text files.
A C binary file, a D ASCII code file and a binary file.
To judge right or wrong, mark "√" for the right and "×" for the wrong (5 points, 0.5 point for each small question).
1. In Turbo C, integer data takes up 2 bytes of memory. (× )
2.int I = 20; Switch (I/ 10){ Case 2: printf ("a"); Case1:printf ("b"); The output result of} is a. (×)
3.3. The break statement is used to end the loop at this level in the loop body, and the continue statement is used to end the loop in the loop body. ( √ )
4. Recursive call of a function is nothing more than a function calling itself directly or indirectly. (√)
5. The value of function strlen("ASDFG\n ") is 7. (× )
6. Through the return statement, the function can bring back one or more return values. (×)
7. There is only one structure. ( × )
8.char * p = "girl" means to define the character pointer variable p, and the value of p is the string "girl". (× )
9. If the definition is: char * p (char A [10]); P is the function name. (√ )
10. Use fopen("file ","r+"); The opened file "file" can be modified. ( √ )
answer
Multiple choice questions (7 points, 0.5 points for each small question)
1.B 2。 C 3。 B 4。 B 5。 C
6. A seven. B 8。 A nine. A 10。 C
1 1.A 12。 A 13。 B 14。 D
To judge right or wrong, mark "√" for the right and "×" for the wrong (5 points, 0.5 point for each small question).
1.× 2.× 3.√ 4.√ 5.×
6.× 7.× 8.× 9.√ 10.√
1 multiple choice questions (24 points, 2 points for each small question)
1. It is known that the calling form of the function fread is fread(buffer, size, count, fp), where buffer stands for (b).
The storage area for storing the read-in data item b stores the address of the read-in data or a pointer to the address.
C file pointer to read file d is an integer variable representing the total number of data items to be read.
2. The output of the following program is (c). 10, 10
Master ()
{ int i=0 10,j = 10;
printf("%d,%d\n ",i++,j-); }
A 1 1,9 B 9, 10 C 8, 10 D 9,9
3. Let A be an int variable, and after the following assignment statements are executed, the values of A are (b) respectively. a = 125.534; a = 20.0/3; a =(int) 125.52 1% 4; a = 5 & lt& lt2;
A 125,6,3 1, 1 B 125,6, 1,20 C 125,6.66666,3 1,20 D 125.534,6.666666,2,20
4. If I and k are both int types, the statement of loop (D).
for(i=0,k =- 1; k = 1; i++,k++)printf(" * * * * \ n ");
The condition for the loop to end is illegal. B loop body does not execute C loop body once, and D is an infinite loop.
5. The output of the following program is (` d).
Master ()
{ char c;
int I;
for(I = 65; I & lt68; i++)
{ c = I+32;
Switch (c)
{ case ' a ':case ' b ':case ' c ':printf(" % c,",c); Break; Default value: printf ("end"); }
}
}
A a,B,C,end B a,a,a,end C a,a,a,a,D a,B,C,
6. Function call statement: fseek(fp,-10L, 2); It means (1).
Move the file location pointer from the end of the file to the beginning of the file 10 bytes.
B. Move the file position pointer from the current position to the file header by 10 bytes.
Move the file location pointer from the current location by 10 bytes to the end of the file.
Move the file location pointer to 10 bytes away from the file header.
7. The output of the following program is (D).
Master ()
{char s 1[40]= "country", s2[20]= "side";
int i=0,j = 0;
while(s 1[i]! = ' \ 0 ')i++;
while(s2[j]! = ' \ 0 ')s 1[i++]= S2[j++];
s 1[I]= 0;
printf("%s\n ",s 1);
}
Country a, country b, country c and country d
8. The following statement is incorrect (a).
The variables defined in the main function main are valid in the whole file or program.
Variables with the same name can be used in different functions.
Formal parameters are local variables.
D Within a function, variables can be defined in a compound statement, and these variables are only valid in this compound statement.
9. In the following program segment, the value of the enumeration variable c 1 is (d).
Enumeration colors (red, yellow, blue =4, green, white) c1; C 1 = yellow; C 1 = white;
A 1 B 3 C 5 D 6
10. There is a description int(* ptr)(); (); Where the identifier ptr is (b).
A is a pointer to an integer variable, and b is a pointer to a function whose function value is int.
C is the function name, and the definition of d is illegal.
1 1. Define an array p consisting of n pointers to plastic data. The correct way is (c).
An int p;; b int(* p)[n]; c int * p[n]; d int(* p)();
12. The pointer type variable P is the same as the array A, and the operation that cannot be performed is (b).
A p = ab * p = a[0]; C p = & ampa[0]; D p = & ampa;
Second, to judge whether it is right or wrong, mark "√" for the right and "×" for the wrong (20 points, 2 points for each small question).
1. The data involved in the bit operation can be any type of data. (× )
2. If there are definitions and statements: int a;; ; char c; Floating f; Scanf("%d, %c, %f ",& i, & c, & f); If you enter: 10 and a, 12.5 through the keyboard, then a = 10, c =' a' and f = 12.5. (√) 12.500000
3. The C language regards a file as a series of characters (bytes). (√ )
4. If there is a macro definition: #define S(a, b) t = a; a = b; B=t Because the variable t is undefined, this macro definition is wrong. (× )
5. In Turbo C, the following definitions and statements are legal: file * fpfp=fopen("a.txt ","r "); ( × )
6. If the definition is: char s[]= "China ";; Turbo C system opens a 6-byte storage unit for array S .. (√).
7. If there are definitions and statements: int a [3] [3] = {{3,5}, {8,9}, {12,35}}, i, sum = 0;; for(I = 0; I<3; i++)sum+= a[I][2-I]; Then sum=2 1. (√ )
8. If there are definitions and statements: struct student {int num character name [10]; Floating score; } s[5]={{ 1, "Lili", 98.5}, {9, "Xiaohua", 66}}, * p = s;; printf("%d ",* p++); The output result is 1. (× )
9. After defining a structural type in the program, you can use it many times to define the variables of that type. (√ )
10. In Turbo C, this definition and statement are legal: enumaa {a = 5, b, c} bbbb = (enumaa) 5; ( √ )
answer
Multiple choice questions (24 points, 2 points for each small question)
1.(B ) 2。 (C ) 3。 (B ) 4。 (D ) 5。 (D ) 6。 (1)
7.(D ) 8。 (1) 9. 10。 (B ) 1 1。 (C ) 12。 (4)
Second, to judge whether it is right or wrong, mark "√" for the right and "×" for the wrong (20 points, 2 points for each small question).
1.( × ) 2.( √ ) 3.( √ ) 4.( × ) 5.( × )
6.( √ ) 7.( √ ) 8.( × ) 9.( √ ) 10.( √ )