问题 单项选择题

下面程序的输出结果是 #include<iostream.h>#include<string.h>void main( ){ char p1[10],p2[10] strcpy(p1,"abc"); strcpy(p2,"ABC"); char str[50]="xyz"; strcpy(str+2,strcat(p1,p2)); cout<<str;}

A.xyzabcABC

B.zabcABC

C.xyabcABC

D.yzabcABC

答案

参考答案:C

解析: 该函数的调用方式是strcpy(字符数组,字符串)其中“字符串”可以是串常量,也可以是字符数组。函数的功能是将“字符串”完整地复制到“字符数组”中,字符数组中原有内容被覆盖。使用该函数时注意:①字符数组必须定义得足够大,以便容纳复制过来的字符串。复制时,连同结束标志’\0’一起复制。②不能用赋值运算符“=”将一个字符串直接赋值给一个字符数组,只能用strcpy()函数来处理。strcat (字符数组,字符串)功能是把“字符串”连接到“字符数组”中的字符串尾端,并存储于“字符数组”中。“字符数组”中原来的结束标志,被“字符串”的第一个字符覆盖,而“字符串”在操作中未被修改。使用该函数时注意:①由于没有边界检查,编程者要注意保证“字符数组”定义得足够大,以便容纳连接后的目标字符串;否则,会因长度不够而产生问题。②连接前两个字符串都有结束标志’\0’,连接后“字符数组”中存储的字符串的结束标志’\0’被舍弃,只在目标串的最后保留一个’\0’。

阅读理解

阅读理解。

     Happiness, Sadness,  Knowledge, Love and all of the other feelings used to live on an island. One

day it was announced that the island would sink, so all built boats and left except Love. Love wanted to

hold out (坚持) until the last possible moment.

     When the island had almost sunk, Love decided to ask for help.

Richness was passing by Love in a grand boat. Love said," Richness, can you take me with you?"

Richness answered, "No, I can't. There is a lot of gold in my boat. There is no place for you here. "

Sadness was close by so Love asked, "Sadness, let me go with you. "  "Oh. . . Love,  I am so sad that I

need to be by myself! "

     Happiness passed by Love too, but she was so happy that she did not even hear when Love called

her.

     Suddenly, there was a voice, "Come, Love, I will take you. " It was an elder.  So overjoyed

(非常高兴), Love even forgot to ask the elder where they were going. When they arrived at a dry land,

the elder went her own way.

     Love asked Knowledge, another elder, "Who helped me?"

     "It was Time," Knowledge answered.

     "Time?" asked Love. "But why did Time help me?"

     Knowledge smiled with deep wisdom and answered, "Because only Time is able to understand how

valuable Love is. "

1. Who was the last one to leave the island?

A. Happiness.          

B. Sadness.

C. Knowledge.          

D. Love.

2. How many times did Love ask for help all together?

A. Three times.                

B. Four times.

C. Five times.                

D. Six times.

3. Why didn't Richness take Love with him?

A. Because Richness was too rich.

B.  Because his boat was full of gold and there was no place for Love.

C. Because he needed to be by himself.

D. Because Richness didn't hear Love's words.

4. Love arrived at ________ with an elder at last.

A.  another island           

B.  a boat

C. a dry land                  

D. another country

5. What was the best title for this passage?

A. Everyone needs Richness.

B. Five feelings.

C. Who was the most useful?

D. Love and Time.

单项选择题