问题 单项选择题

如下程序的输出结果是( )。 public class Test { void printValue(int m) {do { System.out.println("The value is"+m); }while( --m>10) } public static void main(String args[]) {int i=10;Test t=new Test();t.printValue(i); } }

A.The value is 8

B.The value is 9

C.The value is 10

D.The value is 11

答案

参考答案:C

解析: 此题考查的是do-while循环和“--”操作符的知识。do-while最少执行一次,在执行完do中的内容后,判断while中的条件是否为true。如果为true,就再执行do中的内容,然后再进行判断。以此类推,直到while的判断为false时退出循环,执行循环后面的内容。而“--”操作符的规则是,变量右边的“--”将先进行运算,然后才使变量的值减一。而在变量左边的“--”,则先将变量的值减一再运算。本程序中I的值为10,当程序运行到do-while循环时,程序先执行一次循环后然后再做判断,因此选C。

多项选择题
完形填空
My husband and I insisted that our children were old enough to clean their rooms and make their beds. But they thought   11 . My complaints, even self-justified(自有道理)  12 , were always landing on   13  ears. Very often a whole hour’s scolding would end up with their   14  into tears. I felt very frustrated. I realized I needed to   15  my method of “mothering”.
One day when they were at school, I spent some time tidying their rooms. On their desks, in plain  16 , I left the cards: “Dear Bill(the other card was   17  to Sarah), your room was messy this morning and I’m sure you like it clean. Love, the Room Fairy.”  18  arriving back, the children were   19  excited to receive the little note from the Room Fairy. The next day, their rooms were fairly tidy. Sure enough, there was another note from the Room Fairy   20  
for them, thanking them for their nice “gift” of a clean room and   21  asking them to play a certain violin  22 . Each day, thank-you notes would be written differently to keep the ideas   23 
Sometimes the Room Fairy would propose a little   24 : “If you can finish your homework and go over your lessons before dinner, I’d like to watch a particular television program with you tonight.” Sometimes some colored markers or other little items would be left in   25  of well-done jobs the day   26 .
  27  I can’t remember how long “the Room Fairy” continued leaving her love notes. When they were age appropriate, we used various versions of Post-Its (贴条). The bathroom mirror became the   28  centre of our home. Appointments, notices about visiting relatives, lesson schedules, and changes in plans could be   29 .
We all benefited from and  30  the idea of sharing reminders and daily details of life through notes. I believe the true advantage of the Room Fairy notes survives in our frequent and enjoyable communication.
小题1:
A.differentlyB.positiveC.negativeD.same
小题2:
A.shoutingB.cryingC.persuadingD.beating
小题3:
A.sideB.neitherC.deafD.either
小题4:
A.crying B.bringingC.dropingD.bursting
小题5:
A.addictB.adoptC.access D.adjust
小题6:
A.sentenceB.wordsC.speechD.sight
小题7:
A.sentB.addressedC.delivered D.read
小题8:
A.AsB.OnC.In D.At
小题9:
A.more thanB.rather thanC.less thanD.other than
小题10:
A.askingB.prayingC.waitingD.expecting
小题11:
A.gentlyB.friendlyC.politelyD.toughly
小题12:
A.musicB.pieceC.songD.tone
小题13:
A.respectableB.uninteresting C.incredibleD.fresh
小题14:
A.suggestionB.question C.challenge D.advice
小题15:
A.response B.answerC.praise D.honor
小题16:
A.aheadB.beforeC.over D.ago
小题17:
A.thoughB.Even soC.Even if D.Actually
小题18:
A.memoryB.main C.lifeD.reminder
小题19:
A.sent B.postedC.struck D.hanged
小题20:
A.appreciatedB.learnedC.sharedD.thanked