问题 填空题

使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请补充程序中的丢失部分,使得程序运行。可以在修改处增加或者删除一条语句。
本程序完成以下功能:
(1)获得输入的两个数字d1,d2(d1=6,d2=1)。
(2)输出两个中较大的一个(输出6)。
(3)计算d1/d2如果d2等于0,返回-1(输出结果6)。
(4)输出d1+d2的结果(输出结果7)。
(5)输出d1+1的结果(输出结果7)。
(6)输出d2-1的结果(输出结果0)。
注意:错误的语句在/********error********/的下面。修改该语句即可。其他的语句不能修改。
试题程序:
#include<iostream.h>
void main()

int d1;
int d2;
int d3;
cout<<"please input two number:"<<end1;
cin>>d1>>d2;
/********error********/
d3=(d1(d2)d1:d2;
cout<<"Max data is:"<<d3<<end1;
//计算d1/d2如果d2等于0,返回-1
/********error********/
d3=(d2)d1\d2:-1;
cout<<"d1/d2="<<d3<<end1;
/********error********/
d3=(--d1)+(d2++);
cout<<"d1+d2="<<d3<<end1;
cout<<"d1+1="<<d1<<end1;
cout<<"d2-1="<<d2<<end1;
return;

答案

参考答案:“d3=(--d1)+(d2++);”应改为“d3=(d1++)+(d2--);或d3=(++d1)+(--d2);”。

解析: 本题考查了考生对条件表达式和自增自减运算符了解的情况。d3应为d1和d2中较大者的值,所以“(d1(d2)”应改为“(d1>d2)”。若d2不为0,应返回d1/d2的值,而不是d1\d2。第3处应该输d1+1d2-1,所以两者的++、--应反过来。又因为d3应该是两者原值之和,所以++、--应同时为后缀式或前缀形式。

问答题
阅读理解

阅读理解。

     MySpace, the social networking website, is different from other websites which only provide stories about

other people. MySpace is a place that allows you to broadcast your own stories and persona information to as

many people as you like. Started two years ago, it is a big source of information for and about American kids.

     Teenagers and their parents feel very differently about it. Teens are rushing to join the site, not sharing their

parents' worries. It signals yet another generation gap in the digital era.

     For teenagers, it is a reliable network to keep in touch with their friends. They will often list their surnames,

birthdays, after-school jobs, school clubs, hobbies and other personal information.

     "MySpace is an easy way to reach just about everyone. I don't have all the phone numbers of all my

acquaintances. But if I want to get in touch with one of them, I could just leave them a message on MySpace."

said Abby Van Wassen. She is a sixteen-year-old student at Woodland Hills High of Pittsburgh, Pennsylvania.

     Parents on the other hand are seriously concerned about the security problems of MySpace.

     "Every time we hold a parents meeting, the first question is always about MySpace," said Kent Gates, who

travels the country doing Internet safety seminars (研讨会). The National Center for Missing and Exploited

Children has received at least 288 MySpace-related complaints, according to Mary Beth Buchanan, a lawyer in

Pittsburgh.

     "Your profile on MySpace shows all your personal information to anyone on the Web. And MySpace even

lists this information by birthplace and age. It's like a free checklist for troublemakers and it endangers children,"

Buchanan said.

1. From the passage we can learn that MySpace ____.

A. brings about the generation gap

B. is very careful about people's privacy

C. encourages you to list your personal information

D. lists the telephone numbers of your friends

2. Why are some parents against MySpace?

A. Because MySpace has a bad influence on their children.

B. Because they don't want to pay so much money for MySpace.

C. Because it takes up too much of their children's spare time.

D. Because troublemakers can easily approach their children through the site.

3. What can we infer from "Every time we hold a parents meeting, the first question is always about MySpace"?

A. MySpace has become a top issue troubling parents.

B. MySpace often holds parents meetings.

C. MySpace is quite popular-with parents.

D. Parents have lots of questions about the website.

4. The writer's attitude towards MySpace is ____.

A. negative

B. positive

C. optimistic

D. objective