问题 单项选择题

若有定义:int a=4,b=5;float x=3.4,y=2.1;,则下列表达式的值为( )

(float) (a+b)/2+(int)×%(int)y

A.5.5

B.55

C.5.500000

D.55.00000

答案

参考答案:C

解析: 在计算(float)(a+b) /2时,由于通过强制类型转换将(a+b)转换成了float型,所以应先将2转换成float型,再进行计算,得4.500000。
在计算(int)x%(int)y时,先将x和y通过强制类型转换成血型,再进行求余运算,得1。
又因为4.500000是float型,所以将1和它相加时,先将1换成float型,再计算,得到5.500000。
[知识扩展] 类型转换的一般规则是:低级类型服从高级类型,并进行相应的转换。数据类型的级别由低到高的排序表示为:char→int→unsigned→long→float→double。

阅读理解

We produce 500 billion of plastic bags in a year worldwide and they are thrown away polluting oceans,  killing wildlife and getting dumped in landfills where they take up to 1000 years to decompose. Researchers have been unsuccessfully looking for a solution.

The 16-­year ­old Canadian high school student, Daniel Burd, from Waterloo Collegiate Institute,

has discovered a way to make plastic bags degrade(分解) in as few as 3 months, a finding that won him first prize at the Canada-Wide Science Fair, a $10 000 prize, a $20 000 scholarship, and a chance to revolutionize a major environmental issue.

Burd's strategy was simple: Since plastic does eventually degrade, it must be eaten by microorganisms (微生物). If those microorganisms could be identified, we could put them to work eating the plastic much faster than under normal conditions.

With this goal in mind, he ground plastic bags into a powder and concocted(调制) a solution of household chemicals, yeast(酵母) and tap water to encourage microbes growth. Then he added the plastic powder and let the microbes work their magic for 3 months. Finally, he tested the resulting bacterial culture on plastic bags, exposing one plastic sample to dead bacteria as a control. Sure enough, the plastic exposed to the live bacteria was 17% lighter than the control after six weeks.

The inputs are cheap: maintaining the required temperature takes little energy because microbes produce heat as they work, and the only outputs are water and tiny levels of carbon dioxide.

“Almost every week I have to do chores and when I open the closet door, I have piles of plastic bags falling on top of me. One day, I got tired of it and I wanted to know what other people are doing with these plastic bags. The answer: not much. So I decided to do something myself.” said Daniel Burd.

小题1:Daniel Burd won first prize at the Canada-Wide Science Fair because________.

A.he found a new kind of microorganism

B.he contributed much to environmental protection

C.he found a way to degrade plastics in shorter time

D.he could encourage microbes growth in an easier way小题2:Daniel Burd exposed one plastic sample to dead bacteria to ________.

A.make the live bacteria work better

B.test how effective his method was

C.know which bacteria worked faster

D.control the temperature in the process小题3:Maintaining the required temperature takes little energy because ________.

A.plastics can get hot easily

B.microbes can produce heat themselves

C.much carbon dioxide is produced

D.the temperature can be controlled小题4:Daniel Burd got his idea from ________.

A.his school textbook

B.the failure of researchers

C.his everyday work

D.the practice of other people

问答题 简答题