问题 问答题

[函数2.1说明]
Fibonacci数列中头两个数均为1,从第三个数开始,每个数等于前两个数之和。下述程序计算Fibonacci数列中前15个数,并以每行5个数的格式输出。
[函数2.1]
#include <stdio.h>
main()
int i,f,f1=1,f2=1;
printf("%5d%5d",f1,f2);
for(i=3;i<=15;i++)
f= (1) ;
printf("%5d",f);
if( (2) = =0) printf("\n");
f1=12;
(3) ;
[试题一流程图]


[函数2.2说明]
函数fun(char *str1,char *str2)的功能是将字符串str2拼接到str1之后。
[函数2.2]
fun(char *str1,char *str2)
int i,j;
for(i=0;str1[i]!=’\0’;i++);
for(j=0;str2[j]!=’\0’;j++) (4) ;
(5) ;

答案

参考答案:(1) f1+f2 (2) i%5 (3) f2=f
(4) str1[i++]=str2[j] (5) str1[i]=’\0’

解析: (1)根据Fibonacci数列的性质,f等于前两数f1与f2之和;
(2)每输出5个数以后应当换行,此条件即:i除以5余 0;
(3)计算一个数值前,f1与f2都应更新,其中f2应为刚计算出的f;
(4)此循环的功能是将str2的字符添加到str1末尾;
(5)函数结束前应在str1末尾添加结束符。

阅读理解

阅读理解。

     One of my best days at school was a field trip to the seaside. Field trips are very common in the UK. Most schools take their students on geography field trips. Teachers usually take the students somewhere

they can do a scientific experiment (试验). Popular trips are to woodland areas and the seaside.

     My school trip to the seaside was with my biology class. We were allowed to wear home clothes

instead of our school uniforms. When we got to the seaside, we were put into groups. Each group was

asked to find a different sea creature (生物) in the water in the rocks, which we call rock pools.

     My group had to find little crabs (螃蟹). We had to catch them and then find the names of the crabs

in our science books. When my friend Ella picked up a larger crab, it hurt her with its claw (钳子) and

she started crying. After that, she didn’t want to catch the crabs, so she was moved into another group.

     For lunch, we sat in the sun on the rocks and ate sandwiches. After lunch, we went back to school

where we wrote down everything we had found out that day. I remembered feeling sad that we could

not take back the crabs we had found. We had to put them back in their rock pool.

1. In the UK, field trips are            .

A. enough    

B. common    

C. different    

D. unusual

2. My school trip to the seaside was with my          class.

A. biology    

B. geography    

C. physics    

D. chemistry

3. Why was Ella moved to another group?  

A. Because she often cried loudly.

B. Because she was interested in fish.

C. Because the crab hurt her with its claw.

D. Because the group members were not friendly.

4. At the end of the trip we felt sad because          .    

A. we went back to school late

B. we could not take back the crabs we had found

C. we sat on the rocks eating sandwiches

D. we didn’t want to write down everything we saw

单项选择题