问题 单项选择题

下列程序的运行结果是( )。 Publicclasssun { Publicstaticvoidmain(Stringargs[]) { intx=4,y=0; if(Math.pow(x,2)=16) y=X; if(Math.pow(x,2)<15) y=1/x if(Math.pow(x,2)>15) y=(int)Math.pow(x92)+1; system,out.println(y); } }

A.4

B.17

C.18

D.0.25

答案

参考答案:B

解析: 本题是考查对if-else分支结构和几个标准函数的理解。pow(x,y)方法是x的y次幂,程序中pow(x,2)满足第 1个if语句和第3个if语句,条件变量y将被赋值两次,但对于同一个变量来说,只能存储最后一个所赋的值。

单项选择题

Modern industrial society grants little status to old people. In fact, such a society has a system of built-in obsolescence. There is no formal system for continuing our education throughout our life in order to keep up with rapidly changing knowledge. When our education and job skills have grown obsolete, we are treated exactly like those who have never gained an education or job skills and are not encouraged or given the opportunity to begin anew.
As a society becomes more highly developed, the overall status of older people diminishes. Improved health technology creates a large pool of old people, who compete for jobs with the young. However, economic technology lowers the demand for workers and creates new jobs for which the skills of the aged are obsolete, forcing older people into retirement. At the same time, young people are being educated in the new technology and are keeping pace with rapid changes in knowledge. Finally, urbanization creates age-segregated neighborhoods. Because the old live on fixed incomes, they must often live in inferior housing. All these factors—retirement, obsolete knowledge and skills, inferior standards of living—lower the status of the aged in society.
A century ago, when one could expect to live only to 50 or so, the life span more or less coincided with the occupation and family cycle. But today the average life span allows for fifteen to twenty years of life after these cycles. It appears that our life span is outpacing our usefulness in society.

It can be deduced from this passage that one should ______.

A.learn new skills

B.be open-minded

C.have a good personality

D.keep pace with the times

判断题