问题 单项选择题

下面程序段中,for循环的执行次数是()
char * s=“\ta\018bc";
for(;* s! ='\0';s++)cout < < " * ";

A. 9 

B.5 

C. 6 

D. 7

答案

参考答案:C

解析:

数据成员内存的占用。

[解题要点] 本题中,格式符。表示的是八进制无符号形式输出整型数(不带前导 0),字符常量在内存中占一个字节,存放的是ACSII码代码值。C++语言规定,所有字符常量都作为整型量来处理,在计算机内部,其对应的整数值就是ACSII字符集中该字符的序号。

[考点链接] for循环的次数就是字符串\ta\018bc的长度。

选择题
阅读理解

阅读理解。

     I'll be the first to admit that I am a technophobe (对技术有恐惧感的人).Who would have guessed

that a website would help repay a 20-year-old loan?

     I'1l always remember my last day at school. My best friend, Jenny, had organized a party in the Sixth

Form Common Room; Jenny asked me to go to the supermarket with her to buy all the snacks. "I'm

really looking forward to this party, Stingy," she said. Everyone called me Stingy instead of Debbie

because they thought I didn't like to spend money. Actually, it was true.

     "There's lots of money in the kitty (零星凑起的一笔钱). Let's go crazy!" Going crazy meant buying

enough snacks to feed an army. It came to ?19.90, which was a lot of money in 1982.

     Jenny gave me a guilty(内疚的)look. "I've left-the kitty money in the common room. Can you pay

and I'll give you back the money?"

     "Sure," I replied, trying to look relaxed. 'Neither a lender or a borrower be' was my motto but I

didn't want to look stingy(小气). I gave ?20 to the impatient shop assistant.

     Well, the Party was a great success. So great that I completely forgot about my loan until I was flying

to America the next day. I was going to live with my uncle's family until I started university.

     I tried to get in touch with Jenny but her family had moved. My ?20 was lost. Until. I'd heard about

a website called Friends Reunited which helped people contact old school friends. My husband helped

me log on and find my school. There she was, Jenny Frost.

     I'm now married with a beautiful daughter called Debbie. Does anyone know how to get in touch

with Debbie 'Stingy' Jones? I still owe her ?20!

     We met two months later and the ?20 was returned, plus interest(利息)of course. After all, I'm a

bank manager now, so loans are my business.

1. Why did Jenny spend a lot of money on the snacks?

A. Debbie had money.

B. There was money she could use.

C. She wanted Debbie to stop being stingy.

D. She wanted to be crazy.

2. How did Debbie get her money at last?

A. Her husband found Jenny.

B. Jenny had a website on the Internet.

C. Debbie met Jenny.

D. Debbie put a message on the Friends Reunited website.

3. Which sentence best describes Debbie Jones?

A. She didn't like to spend money at school and often uses computers.

B. She sometimes lends money and doesn't like using computers.

C. She sometimes lends money and uses, the computer whenever she can.

D. She only lends money to friends and doesn't like using computers.

4. We know from the passage that Jenny .

A. liked parties at school and felt guilty about borrowing money

B. had fun at school but soon forgot about her school friends

C. forgot her best friend at school until she saw the Friends Reunited website

D. was forgetful about the money