C语言程序设计习题汇编答案

 

一、判断题

1.     

2.        ×

3.       

4.        ×

5.        ×

6.        ×

7.        ×

8.       

9.       

10.    ×

11.    ×

12.   

13.    ×

14.    ×

15.  ×

16.    ×

17.    ×

18.   

19.   

20.   

21.    ×

22.   

23.   

24.    ×

25.    ×

26.    ×

27.   

28.    ×

29.    ×

30.   

31.    ×

32.    ×

33. 

34.  ×

35. 

36. 

37.  ×

38.  ×

39. 

40.  ×

 

二、填空题

1. 根据所给条件,写出写列各题的输出结果。

(1)     234567

(2)     i=  234  x=-513.6240

(3)     sin(  60 *3.141593/180)

(4)     $153.45

(5)     27   ,33   ,1B

(6)     x(1)=13.24   x(2)=-78.32

(7)     2.500000

(8)     16

(9)     2

(10) 0

(11) 0

(12) (a!=b)&&(a+b==0)    (fabs(a)==fabs(b)) && (a*b<0)

(13) (a*b==0)&&(a+b!=0)      a==0 && b!=0 || a!=0 && b==0

(14) 16,16,11

(15) 4,4,10,6

(16) 18,3,3

(17) –17

(18) ‘D’

2.根据下列数学式,写出C的算术表达式。

(1)     -(a*a+pow(b,3) ) * pow(y,4)

(2)     (sqrt(2)+10*10)/(atan(x)+3.1415926)

(3)     (5+b)/((a+6)/(b+5)-c*d)

 

3.按照要求写出下列C的表达式

(1)     (x+1)*exp(2*x)

(2)     int(x)+modf(y,ipy)   (int)x+(y-(int)y)

(3)     (int)(y*1000+0.5)/1000.0  

(4)     s = x > 0 ? abs(y) : -abs(y)   s=(x/abs(x))*abs(y)

(5)     (x >= 5) && (x <= 3)

(6)     (a + 32) == b

(7)     ((a % 10 ) == ( b / 10)) &&  (( a / 10) == (b % 10 ))

(8)     a < b ? a : b

(9)     (a < b ? a : b) < c ? (a < b ? a : b): c

(10) ch + 32

 

4.根据所给题意填空题

(1)     i <= 100

(2)     2

(3)     ch = ‘A’; ch <= ‘Z’; ch ++

(4)     ch=getchar()

(5)     5

(6)     int

(7)     值传递,引用

(8)     变量

(9)     按照不同类型数值规定进行转换

(10) 引用

(11) #define UTOL(ch) if ((ch<='Z’) && (ch>=’A’)) ch = tolower(ch)

(12) t=b;b=a;a=t;

(13) ‘D’

(14) 10

(15) 不确定

(16) 1  2

(17) 数组地址是常量,不能赋值.

(18) a[i-1][j-1] *(*(a+i-1)+(j-1))

(19) &a[0][i]&a[i][0]a[0][0]

(20) 25

(21) str1[7] = ‘\0’

(22) for (i =0;i<7;i++) gets(a[i]);

(23) 16  11

(24) 12

(25) 整型(int

(26) 4

(27) *(*(p+2)+4)

(28) 6

(29) *(p+6)

(30) 1

(31) 文件指针(文件信息区的起始地址)

(32) 文件头

(33) 文件尾

(34) 字符或EOF

(35) a的首地址或NULL

(36) 读入的数据个数或0

(37) 0

(38) 非零

(39) 5

(40) 0

 

三、选择题

单项选择题,在下列各题中选择ABCD之一填到括号内。

1.        D

2.        B

3.        C

4.        C

5.        A

6.        C

7.        B

8.        A

9.        A

10.    C

11.    B

12.    B

13.    D

14.    A

15.    D

16.    D

17.    A

18.    D

19.    D

20.    C

 

四、程序填空

1.         

(1)     #include <stdio.h>

(2)     s = 0.0

(3)     s + 1.0 / i

2.         

(1)     #include <math.h>

(2)     float ax,ay,bx,by,cx,cy;

(3)     length(ax,ay,cx,cy);

(4)     len1,len2,len3

3.         

(1)     #include <stdio.h>

(2)     n,m,jc=1

(3)     “%d”,&m

(4)     n-2

4.         

(1)     a % i == 0

(2)     c=1;

(3)     c == a

5.         

(1)     int fun1 (int);