问题 单项选择题

程序中已构成如下图所示的不带头结点的单向链表结构,指针变量s、p、q均已正确定义,并用于指向链表结点,指针变量s总是作为头指针指向链表的第一个结点。


若有以下程序段:
q=s; s=s->next; p=s;
while (p->next) p=p->next;
p->next=q; q->next=NULL;
该程序段实现的功能是( )。

答案

参考答案:A

解析: 因为刚开始时s指向a结点(链表头),所以语句q=s;使q也指向a结点。s=s->next;语句使s指向a的下一个结点b。p=s;语句使p也指向b结点。接下来是一个while循环,循环条件为 p->next,即当p没有指向链表尾时执行循环体p=p->next;让p指向下一个结点,所以当循环结束时,p指向链表尾(c结点)。执行到此时,s、p、q分别指向的结点是b、c、a。然后执行p->next=q;,使c结点的后续指针指向了a结点。最后执行q->next=NULL;,使a结点的后续指针为NULL。由此可见,该程序段实现了将a结点移动到c结点之后,即首结点成为尾结点。故应该选择A。

听力题
完形填空
As a kid, I spent my summers with my grandparents in Texas. And every few summers, we’d __16__ the caravan (旅游团队), a group of Airstream trailer owners who __17__ together around the U.S. and Canada.
I loved and worshipped my grandparents and I really looked __18__ to these travels. On one particular __ 19__ ,I was about 10 years old. I was rolling around in the backseat. My grandfather was __20__ . And my grandmother had the passenger seat. She smoked throughout these trips, and I hated the __21__.
At that age, I’d take any excuse to make estimates(估计) and do minor __22__.At any rate, I decided to do the math for my __23__. I estimated the number of  cigarettes per days, estimated the number of __24__ per cigarette and so on. When I was satisfied that I’d come up with a reasonable number, I poked my head  into the __25__ of the car, tapped my grandmother __26__ the shoulder, and proudly proclaimed, “At two minutes per puff, you've taken nine years off your __27__!” Because the ad said, every puff of a cigarette takes some  number of minutes __28__ smoker’s life.
I expected to be applauded for my __29__ and arithmetic skills. That’s not what happened.__30__, my grandmother burst into __31__. I sat in the backseat and did not know what to do. My grandfather was a highly intelligent, __32__ man. He had never said a harsh word to me. He pulled __33__ onto the shoulder of the highway. He stopped and got out of the car, __34__ me, and after a bit of silence,he gently and __35__ said, “Jeff, one day you’ll understand that it’s harder to be kind than clever.”  
小题1:
A.takeB.join C.attend D.visit
小题2:
A.workB.studyC.travelD.explore
小题3:
A.forwardB.backwardC.towardD.upward
小题4:
A.holidayB.researchC.trip D.return
小题5:
A.talkingB.readingC.trainingD.driving
小题6:
A.sceneB.smellC.band D.type
小题7:
A.arithmetic(算数)B.questionC.gameD.problem
小题8:
A.grandfatherB.grandmotherC.visitorD.car
小题9:
A.casesB.smokesC.kindsD.puffs(烟头)
小题10:
A.windowB.seatC.backD.front
小题11:
A.atB.inC.onD.under
小题12:
A.tourB.lifeC.distanceD.date
小题13:
A.awayB.fromC.withD.off
小题14:
A.clevernessB.coolnessC.happinessD.ability
小题15:
A.EventuallyB.InsteadC.UnfortunatelyD.Though
小题16:
A.wordsB.laughtersC.tearsD.screams
小题17:
A.stubbornB.determinedC.lonelyD.quiet
小题18:
A.over B.in C.awayD.up
小题19:
A.noticedB.lookedC.glaredD.glanced
小题20:
A.angrilyB.excitedlyC.calmlyD.coldly