问题 填空题

C++语言的参数传递机制包括传值和传地址两种,如果调用函数时,需要改变实参或者返回多个值,应该采取【 】方式。

答案

参考答案:传地址

解析:本题考查的是传值调用和传址调用的区别--传值调用只是进行值的简单复制,返回之后不会改变原来的值;而传址调用是把参数的地址传入,会改变原来的值。

阅读理解

Carl lost his job. He had so little money that he spent his days at home. He watched his neighbor’s room, where an old professor lived. He found the rooms were full of old furniture and vases. Carl thought, “Why haven’t I got an old and valuable vase? I can sell it for a lot of money.”

Carl had an old gun. It had been his great grandfather’s favorite thing a long time before. Carl didn’t want to use the gun but he thought, “Anything could happen.” He wanted to hide the gun under his coat but it was too long so he cut the end off with a saw(锯子).

Next morning he watched the professor leave home at 10 o’clock. Carl broke the window and entered the house. He didn’t know much about arts. He couldn’t choose. He reached his hands towards a big vase when he heard a noise. The front door opened and someone entered the house. It was the professor. He had forgotten to take an important document. Carl became so afraid that  he pulled out the gun, “I haven’t stolen anything. I just want to go away or I will shoot.” cried Carl. “With that gun? ”asked the professor and he began to laugh. He wasn’t afraid of Carl at all.

He said, “You can’t shoot with that old gun. Its place should be in a museum.”

“Is this really an old gun? ” asked Carl. “How much is it worth?”

“It was worth about 27,000 dollars,” said the professor, “But now you can get 20 dollars for it.”

“Why?” asked Carl.

The professor said, “Because its end is missing.”

36. Carl wanted to steal because he was interested in beautiful vases.

37. He cut the end of the gun off in order to hide it easily.

38. The professor came back because he saw Carl enter his house.

39. The professor was not afraid of Carl because he thought Carl dared not shoot.

40. The gun is worth 20 dollars now because Carl cut off its end.

问答题 简答题