问题 单项选择题

有以下程序 #include <stdio.h> main() {FILE *fp; int i; char ch[]="abcd",t; fp=fopen("abc.dat","wb++"); for(i=O;i<4;i++)fwrite(&ch[i],1,1,fp); fseek (fp,-2L,SEEK_END); fread (&t,1,1,fp); fclose (fp); printf ("%c\n",t); } 程序执行后的输出结果是______。

A.d

B.c

C.b

D.a

答案

参考答案:A

解析:

此题考核的是文件的读写,定义—个FILE类型结构体的指针fp,以“可以由位置函数设置读和写”方式打开一个 abc.dat文件,并向文件输入数组变量ch指向的字符串,则文件内的内容为“abcd”,执行fseek函数,则文件类型指针fp指向文件尾向前移动2个字节的位置处,即指针指向“b”,所以最后的输出结果为b,答案选C。

完形填空
完形填空。
       Here is a story about a clever dog. It was a seeing-eye dog. A seeing-eye dog can help blind (瞎的) people
walk along the streets and do many other things.
       One day a seeing-eye dog and a blind man    1   on bus together. The bus was full of    2    and there were 
   3    seats left. But one man soon stood up and left his seat. The dog    4    the blind man to the seat, but there
was little space (空间) for two people. The dog began to push the people on each side    5   his nose. He pushed
and pushed until the people moved and    6    there was    7   space for two people. The blind man then sat down
and the dog got up on the seat at his side. The dog    8   down and put his head on the leg of the    9   man. He
was very comfortable and soon fell asleep. Everyone on the bus   10   at the dog.
( ) 1. A. got       
(     ) 2. A. foreigners
(     ) 3. A. no        
(     ) 4. A. told       
(     ) 5. A. for       
(     ) 6. A. at first  
(     ) 7. A. less      
(     ) 8. A. went      
(     ) 9. A. old       
(     ) 10. A. smiled    
B. went       
B. policemen  
B. not many      
B. asked      
B. to         
B. still      
B. enough     
B. put        
B. blind      
B. watched  
C. came    
C. people  
C. enough        
C. carried 
C. with    
C. at last        
C. few     
C. lay     
C. young   
C. laughed 
D. put     
D. farmers 
D. some         
D. took    
D. at      
D. last    
D. litter  
D. jumped  
D. first   
D. looked  
多项选择题