若vehicle=[['train','car'],['bus','subway'],['ship','bicycle'],['car']],则len(vehicle)结果是什么?A.1B.7C.6D.4

题目
若vehicle=[['train','car'],['bus','subway'],['ship','bicycle'],['car']],则len(vehicle)结果是什么?

A.1

B.7

C.6

D.4


相似考题

2.请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2,其中定义了vehiele类,并派生出motorcar类和bicycle类。然后以motorcar和bicycle作为基类,再派生出motorcycle类。要求将Vehicle作为虚基类,避免二义性问题。请在程序中的横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为:801501001注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。include<iostream.h>class vehicle{private:int MaxSpeed;int Weight;public://*************found************vehicle(int maxspeed,int weight):——~vehicle{};int getMaxSpeed{return MaxSpeed;}int getWeight{retum Weight;}};//****************found************class bicycle:——public vehicle{private:int Height;public:bicycle(int maxspeed,int weight,int height):vehicle(maxspeed,weight),Height(height){}int getHeight{retum Height;};};//*******************found**************class motorcar:——public vehicle{private:int SeatNum;public:motorcar(int maxspeed。int weight,int seatnum):vehicle(maxspeed,weight),SeatNum(seatnum){}int getSeatNum{return SeatNum;};};//*****************found***************class motorcycle:——{public:motorcycle(int maxspeed,int weight,int height):vehicle(maxspeed,weight),bicycle(maxspeed,weight,height),motorcar(maxspeed,weight,1){}};void main{motorcycle a(80,150,100);cout<<a.getMaxSpeed<<endl;cout<<a.getWeight<<endl;cout<<a.getHeight<<endl;cout<<a.getSeatNum<<endl;}

更多“若vehicle=[['train','car'],['bus','subway'],['ship','bicycle'],['car']],则len(vehicle)结果是什么? ”相关问题
  • 第1题:

    根据短文内容判断给出的语句是否正确,正确的写“T”,错误的写“F”。

    Pedestrian Critically Injured in Westwood HitandRun Crash

    A pedestrian was critically injured in a Westwood area car accident near the comer of Wilshire Boulevard and Veteran Avenue early morning on January 5, 2016.

    The police said it involved a hitandrun driver. The car was dark and was last seen traveling east on Ashton Avenue from Veteran Avenue. The investigation is ongoing.

    It appears that the driver struck and seriously injured the pedestrian, and left the victim lying in the roadway without even stopping to help or call emergency personnel. Outrageous! Leaving the scene of an injury or fatal crash is a serious crime under California law. California Vehicle Code 20001(a)states:“The driver of a vehicle involved in an accident resulting in injury to a person, other than himself or herself, or in the death of a person shall immediately stop the vehicle at the scene of the accident.”

    We hope the driver in this case is arrested and brought to justice. If you have any information about the suspect or the vehicle, please visit the HitandRun Reward website at hitandrunreward.com to offer a useful tip and become qualified for a $1,000 reward.

    ( )21. A pedestrian was dead in the hitandrun case.

    ( )22. Leaving the scene of an injury or fatal crash is not a serious crime under California law.

    ( )23. The investigation is going on.

    ( )24. The driver was against the California Vehicle Code 20001.

    ( )25. Any information about hitand run cases provided via hitandrunreward.com can get $1,000 reward.


    参考答案:21、F 22、F 23、T 24、T 25、T


  • 第2题:

    若已定义了类Vehicle,则下列派生类定义中,错误的是

    A.class Car:Vehicle{/*类体略*/);

    B.class Car:public Car{/*类体略*/);

    C.class Car:public Vehicle{/*类体略*/);

    D.class Car:virtual public Vehicle{/*类体略*/);


    正确答案:B
    解析:派生类从基类的继承方式有3种:公有继承(public)、私有继承(private)和保护继承(protected)。如果不显式地给出继承方式,默认的类继承方式是私有继承,ACD项正确。类的继承是新的类从已有类那时得到已有的特性,故B项错误。

  • 第3题:

    若vehicle=['train','car','bus','subway','ship','bicycle','car'],则vehicle.count('car')结果是什么?

    A.car

    B.7

    C.1

    D.2


    正确答案:D

  • 第4题:

    若vehicle=['train','bus','car','ship'],则vehicle.index('car')的结果是什么?

    A.1

    B.2

    C.3

    D.4


    正确答案:B

  • 第5题:

    阅读以下说明和C++代码,填充代码中的空缺,将解答填入答题纸的对应栏内。

    【说明】

    某应急交通控制系统(TraficControISy ,tem)在红灯时控制各类车辆(Vehicle)的通

    行,其类图如图5-1所示,在紧急状态下应急车辆红灯时也可通行,其余车辆按正常规

    则通行。

    下面的C++代码实现以上设计,请完善其中的空缺。

    include <typeinfo>

    include <iostream>

    using namespace std;

    class Vehicle {/*抽象基类,车辆*/

    public :

    virtual void run () = 0;

    };

    class Emergency( /*抽象基类,可在红灯时通行的接口,函数均为纯虚函数*/

    public:

    (1)=0 //isEmergent()函数接口

    (2)=0 //runRedLight()函数接口

    };

    class Car: public Vehicle {

    public :

    -car(){ }

    void run () { /*代码略*/ }

    };

    Ciass Truck:public vehicie {

    Public;

    -Truck(){ }

    Void run() { /*代码略*/}

    };

    Class policecar: (3) {

    Private:

    bool isEmergency;

    public :

    PoliceCar () : Car () , Emergency () { this=>isEmergency = false;

    }

    PoliceCar (bool b) : Car () , Emergency () { this=>isEmergency = b; }

    ~PoliceCar () { }

    bool isEmergent () { ret irn (4) ; }

    void runRedLight () { /*代码略*/ }

    };

    /*类Ambulance. FireEngine/*实现代码略*/

    class TraficControISystem {/*交通控制类*/

    private :

    Vehicle*v[24]; int numVeh: cles./*在构造函数中设置初始值为0*/

    public:

    void control(){ //控制在紧急情况下应急车辆红灯通行,其他情况按常规通行

    for (int i = 0; i<[numVehicles;++] {

    Emergency*ev=dynamic_cast<Emergency*(v[i]);

    if (ev !=0(5)-: runRedLight ( )

    Else (6)-:run()

    }

    }

    Void add(vehicle){v[numvehicles++]=vehicle;}

    /*添加车辆*/

    Void shutdown(){for (int i =0;i<numvehicles;i++){ deletev[i];} }

    }

    int main () {

    TraficControlSystem* tcs =new TraficControlSystem;

    tcs->add (new Car () );, t cs->add (new PoliceCar ()) ;

    tcs->add (new Ambulance ()) ; tcs- >add (new Ambulance (true)) ;

    tcs->add (new FireEngine (true)) ; -.cs->add (new FireEngine ()) ;

    tcs->add (new Truck ()) ;

    tcs->control () ; tcs->shul Down ( ) ;

    delete tcs;

    }


    参考答案:(1)virtualboolisEmergent0
    (2)ivirtualvoidrunRedLight0

    (3)publicCar,publicEmergency

    (4)ithis->isEmergency

    (5)ev

    (6)iv[i]

    解析:
    本题考查C++语言程序设计的能力,涉及类、对象、函数的定义和相关操作。要求
    考生根据给出的案例和执行过程说明,认真阅读理清程序思路,然后完成题目。
    根据题目描述,以交通控制系统(TraicControISystem)为背景,本题目中涉及的各
    类车辆和是否应急状态下在红灯时的通行情况。根据说明进行设计,题目给出了类图(图
    5-1类图所示)。
    图中父类Vehicle代表交通工具,设计为抽象类,包含一个方法:run(),表示行驶
    某一个具体的交通工具对象,行驶的方法由具体子类型完成,所以Vehicle的run()为一
    个纯虚函数:
    Virtualvoidrun()=0;
    Car和Truck都继承自Vehicle的两个子类型,所以它们都继承了Vehicle的run()方
    法,各自行驶方式有所不同,所以都覆盖了Vehicle的run()方法,并加以实现:
    voidrun(){/*代码略*/)
    Car的两个子类型PoliceCar和Ambulance都继承自Car,从而PoliceCar和Ambulance
    也都继承了Car中的run()方法。Truck的子类:eireEngine也继承了Truck中的run()方法。
    图中接口Emergency在C++中采用抽象基类的方法实现,其中约定红灯时通行的相
    关接口函数为:isEmergent()和runRedLight(),均为纯虚函数,原型中=0表示纯虚函数,
    实现由子类完成:
    virtualboolisEmergent()=0;
    virtualvoidrunRedLight()=0;
    isEmergent0函数接口约定应急车辆返回自身紧急情况状态,用bool类型的
    isEmergency表示:this->isEmergency,其值在紧急情况下为bool值true,非紧急情况下
    为bool值false。runRedLight0函数接口约定应急车辆在红灯时如何通行(isEmergency
    为true,则通行,isEmergency为false,和普通车辆一样通行)。Emergency的子类有
    PoliceCar、Ambulance和FireEngine,所以在这三个类中都要实现Emergency中定义的
    纯虚函数接口。
    交通控制类TraficControISystem对运行的交通工具进行控制,所有交通工具用
    Vehicle数组v表示;numVehicles表示交通工具数量;control函数进行控制在紧急情况
    下应急车辆红灯通行,其他情况按常规通行;add()表示有车辆加入系统,shutDown()在系统关闭时清除每个对象数组元素:deletev[];。Vehicle的子类具体类型有Car、Truck、
    PoliceCar、Ambulance和FireEngine,所以、[]数组中对象有这些类型的对象,加入V[]
    时会自动向上转型成为Vehicle类型,而实现了Emergency接口的应急车辆有
    runRedLight0函数,其他Car和Truck只有“n0函数。因此,用for循环对每个v[i],判
    定是否是Emergency类型,即是否继承了Eriergency,调用时动态绑定每个数组元素的
    实际类型,需要通过动态类型转换:
    Emergency*ev=dynamic_cast<Emeraency*>(v[i]);
    如果转换成功,说明是Emergency的子类,实现了runRedLight0,可以调用runRedLight0,
    否则调用run():
    If(ev!=0)ev_->runRedLigh'.();
    Elsev[i]->run();
    主控逻辑代码在maln函数中实现。初始化TraficControISystem,用tcs表示,调用
    tcs的add()函数添加具体的交通工具,这里会自动向上转型成为Vehicle类型,调用control()
    对各车辆进行控制,调用shutDown()系统关闭,使用完数组对象之后,需要用delete操
    作进行释放对象,即deletetcs;
    因此,空(l)和空(2)需要定义纯虚函数isEmergent()和runRedLight0,原型中
    =0题目代码中已经给出,所以空(1)和空(2)分别为“virtualboolisEmergent()”和“virtual
    voidrunRedLight()”;空(3)需要继承CarjFIEmergency,即“publicCar,publicEmergency”;
    空(4)要返回应急车辆对象的状态,即“this->isEmergency”;空(5)处动态类型转换
    成功的对象ev;空(6)处为普通车辆对象v[i]。

  • 第6题:

    29. When people travel on business(出差) ,they usually take _________ .

    A. a train or a plane

    B. a boat or a train

    C.a car or a boat .

    D.a plane or a car


    正确答案:A
    29.A[解析】从文章最后一句可知。

  • 第7题:

    阅读以下说明和Java代码,填充程序中的空缺,将解答填入答题纸的对应栏内。
    [说明]
    某应急交通控制系统(TraficControlSystem)在红灯时控制各类车辆(Vehicle)的通行,其类图如下图所示,在紧急状态下应急车辆在红灯时可通行,其余车辆按正常规则通行。

    下面的Java代码实现以上设计,请完善其中的空缺。

    [Java代码]abstract class Vehicle{public Vehicle(){ }abstract void run();};interface Emergency{ ______; ______;};class Car extends Vehicle{public Car(){ }void run(){ /*代码略*/ }};Class Truck extends Vehicle{public Truck(){ }void run() { /*代码略*/ }};class PoliceCar ______ {boolean isEmergency= false;public PoliceCar(){ }public PoliceCar(boolean b) {this.isEmergency=b; }public boolean isEmergent(){ return ______ }public void runRedLight(){ /*代码略*/ }};/*类Ambulance、FireEngine实现代码略*/public class TraficControlsystem { /*交通控制类*/private Vehicle[]V=new Vehicle[24];int numVehicles;public void control(){for {int i=0; i<numVehicles; i++){if(V[i]instanceof Emergency&&((Emergency)v[i]).isEmergent()){(______).runRedLight();}else______. run();}}void add(Vehicle vehicle){ v[numVehicles++]=vehicle;}/*添加车辆*/void shutDown(){/*代码略*/}public static void main(String[]args){TraficC0ntrolSystem tcs=new TraficControlSystem();tcs.add(new Car());tcs.add(new PoliceCar());tcs.add(new Ambulance());tcs.add(new Ambulance(true));tcs.add(new FireEngine(true));tcs.add(new Truck());tcs.add(new FireEngine());tcs.control();tcs.shutDown();}}


    答案:
    解析:
    boolean isEmergent()
    void runRedLight()
    extends Car implements Emergency
    this.isEmergency
    (Emergency)v[i]
    v[i]

  • 第8题:

    The car crashed into the train,and the driver was killed__the spot.

    A.on
    B.at
    C.to
    D.by

    答案:A
    解析:
    on the spot表示“当场”。

  • 第9题:

    ()is the volume for loading goods of the vehicle.

    • A、Vehicle tonnage  
    • B、Vehicle size  
    • C、Vehicle capacity  
    • D、Available Vehicle capacity

    正确答案:D

  • 第10题:

    单选题
    How did the narrator and his aunt travel to see his father?
    A

    By car.

    B

    By bus.

    C

    By ship.

    D

    By train.


    正确答案: A
    解析:
    最后一段倒数第五句写到“we left into that unbearable train again”,可知来回的是乘坐的火车。

  • 第11题:

    单选题
    How did Mr. Baker get to work?
    A

    By train and by car.

    B

    Just by car.

    C

    On foot.


    正确答案: C
    解析:
    题目问的是:贝克先生怎么上班?第二段第二句“he had to drive home from the railway station.”意思是“他不得不从火车站开车回家”,由此可以推断出他每天开车去火车站,坐火车去上班。所以A符合题意。

  • 第12题:

    单选题
    The vehicle sales were greatly cut down because
    A

    the car manufacturers were concerned about the American economy.

    B

    the market’s performance was found to be the worst in 50 years.

    C

    the prices of fuel rose to a level which was last seen in the 1950s.

    D

    the fuel prices were so high and the economy was facing a depression.


    正确答案: A
    解析:
    事实细节题。新闻中提到,创纪录的燃油价格和经济衰退导致了销售额暴跌。D项中的depression是原文中recession的同义替换。因此,D项正确。
    【听力原文】
    A slump in vehicle sales by the three big US car manufacturers has renewed worries about the American economy. General Motors posted an 18% drop in sales in June, Ford unveiled a 29%slump, Chrysler’s sales were down by 36%. Mark Gregory reports.
      The combination of record fuel prices and an economy close to recession has led to a slump in sales. On current trends, fewer than 14 million cars and light trucks will be sold in the US this year, the market’s worst performance in 15 years. Shares in General Motors, America’s biggest car maker, have fallen to a level last seen in the 1950s.

  • 第13题:

    使用VC6打开考生文件夹下的工程test17_1,此工程包含一个源程序文件test17_1.唧,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:

    Vehicle message

    Car message

    Vehicle message

    源程序文件test17_1.cpp 清单如下:

    include <iostream.h>

    class vehicle

    {

    int wheels;

    float weight;

    public:

    /***************** found *****************/

    void message(void){ cout<<"Vehicle message\n";}

    };

    class car:public vehicle

    {

    int passenger_load;

    public:

    /***************** found *****************/

    void message (void){cout>>"Car message\n";}

    };

    class truck:public vehicle

    {

    int passenger_load;

    float payload;

    public:

    int passengers(void){return passenger_load;}

    };

    void main()

    {

    vehicle * unicycle;

    unicycle=new vehicle;

    /***************** found *****************/

    unicycle.message()

    delete unicycle;

    unicycle=new car;

    unicycle->message();

    delete unicycle;

    unicycle=new truck;

    unicycle->message();

    delete unicycle;

    }


    正确答案:(1)错误:void message(void){cout"Vehicle message\n";} 正确:virtual void message(void){cout"Vehicle message\n";} (2)错误:void message(void){cout>>"Carmessage\n”;} 正确:void message(void){eout"Carmessage\n";} (3)错误:unicycle.message(); 正确:unicycle->message();
    (1)错误:void message(void){cout"Vehicle message\n";} 正确:virtual void message(void){cout"Vehicle message\n";} (2)错误:void message(void){cout>>"Carmessage\n”;} 正确:void message(void){eout"Carmessage\n";} (3)错误:unicycle.message(); 正确:unicycle->message(); 解析:(1)主要考查考生对于虚函数使用规则的掌握,要实现对函数message的动态联编应该使用虚函数,否则产生的是静态联编,调用的函数输出结果就与要求不符;
    (2)主要考查考生对于流输出操作的掌握,该处错误的使用了流输入操作;
    (3)主要考查考生是否能分清对象和对象指针,对象指针使用“->”调用成员函数,而对象使用“.”调用成员函数。

  • 第14题:

    若vehicle=['train','bus','car','ship'],则vehicle[1]是什么?

    A.train

    B.bus

    C.car

    D.ship


    正确答案:B

  • 第15题:

    若vehicle=[['train','car'],['bus','subway'],['ship','bicycle'],['car']],则len(vehicle[1][0])结果是什么?

    A.3

    B.7

    C.6

    D.4


    正确答案:A

  • 第16题:

    若vehicle=[['train','car'],['bus','subway'],['ship','bicycle'],['car']],则len(vehicle[1])结果是什么?

    A.2

    B.7

    C.6

    D.4


    正确答案:A

  • 第17题:

    阅读以下说明和Java代码,填充程序中的空缺,将解答填入答题纸的对应栏内。

    【说明】

    某应急交通控制系统(TraficControIS,stem)在红灯时控制各类车辆(Vehicle)的通

    行,其类图如图6-1所示,在紧急状态下应急车辆在红灯时可通行,其余车辆按正常规

    则通行。

    下面的Java代码实现以上设计,请完善其中的空缺。

    【Java代码】

    abstract class Vehicle

    public Vehicle () { }

    abstract void run

    };

    interface Emergency {

    (1) ;

    (2) ;

    }

    class Car extends Vehicle {

    public Car () { }

    void run () { /*代码略*/ }

    };

    class Truck extends Vehicle {

    public Truck () { }

    void run () { /*代码略*/ }

    class PoliceCar (3)

    boolean isEmergency = false;

    public PoliceCar () { }

    public PoliceCar(boolean b) { this . isEmergency =b; }

    public boolean isEmergent () { return (4); }

    public void runRedLight () { /*代码略*/ }

    }

    /*类Ambulance. FireEngine实现代码略*/

    public class TraficControISystem {/。交通控制类。/

    private Vehicle[ ]V=new Vehiele [24];

    int numVehicles;

    public void control() {

    for (int i=0; i<numVehicles; i++) {

    if (v[i] instanceof Enu rgency&& ((Emergency)V [i])

    isEmergent()) {

    ( 5 ) . runRedLigh&39;: ( ) ;

    }else

    (6).run( )

    }

    }

    void add (Vehicle vehicle) { v[numVehicles++]=vehicle;)/*添加车辆*/

    void shutDown()(/*代码略*/}

    public static void main (Stri.ng [ ] args) {

    TraficControlSystem tcs = new TraficControlSystem() ;

    tcs . add (new Car () ;

    tcs .add (new PoliceCar () ;

    tcs .add (new Ambulance () ;

    tcs . add (new Ambulance (true》 ;

    tcs . add (new FireEngine ( true》 ;

    tcs . add (new Truck () ;

    tcs . add (new FireEngine ( ) ;

    tcs . control () ;

    tcs . shutDown () ;

    }

    }


    正确答案:
    本题考查Java语言程序设计的能力,涉及类、对象、方法的定义和相关操作。要求
    考生根据给出的案例和执行过程说明,认真阅读理清程序思路,然后完成题目。
    根据题目说明,以交通控制系统(Tn.ficControISystem)为背景,本题目中涉及的各
    类车辆和是否应急状态下在红灯时的通行情况。根据说明进行设计,题目给出了类图(图
    6-1类图所示)。
    图中父类Vehicle,代表交通工具,设计为抽象类。在Java用abstract关键字表示,
    表示行驶某一个具体的交通工具。Vehick包含一个抽象方法:run(),方法后没有实现,
    直接用;来表示抽象方法,表示行驶的方法由具体子类型完成,所以Vehicle的run()为一
    个抽象方法:
    Abstractvoidrun()
    Car和Truck都继承自Vehicle的两个子类型,所以他们都继承了Vehicle的run()方
    法,各自行驶方式有所不同,所以都覆盖了Vehicle的run()方法,并加以实现:
    voidrun(){/*代码略*/}
    Car的两个子类型PoliceCar和Ambuance都继承自Car,从而PoliceCar和Ambulance
    也都继承了Car中的run()方法。Truck的子类FireEngine也继承了Truck的run()方法。
    图6-1中Emergency在Java中采用接口实现,其中约定红灯时通行的相关接口为:
    isEmergent()和runRedLight().
    isEmergent()接口约定应急车辆返回自身紧急情况状态,用bool类型的isEmergency
    表示:this.isEmergency,其值在紧急情况下为true,非紧急情况下为false。mnRedLight()
    接口约定应急车辆在红灯时如何通行(isEmer:;ency为true,则通行,isEmergency为false,
    和普通车辆一样通行)。实现Emergency的类有PoliceCar、Ambulance和FireEngine,所
    以在这三个类中都要实现Emergency中定义的接口。在Java中,实现接口用implements
    关键字,后面加上所要实现的接口,即:
    ClassNameimplementsInterfaceName
    交通控制类TraficControISystem对运行的交通工具进行控制,所有交通工具用
    Vehicle数组v表示;numVehicles表示交通工具数量;control函数进行控制在紧急情况
    下应急车辆红灯通行,其他情况按常规通行;add()表示有车辆加入系统,shutDown()表示系统关闭。Vehicle的子类具体类型有Car、71ruck、PoliceCar、Ambulance和FireEngine,
    所以v[]数组中对象有这些类型的对象,加入v[]时会自动向上转型成为Vehicle类型,
    Emergency接口的应急车辆有runRedLight()方法,其他Car和Truck只有run()方法。因
    此,用for循环中对每个v[i],判定是否是Emergency类型的实例,即是否实现了
    Emergency。Java中判断一个对象是否是某个类型的实例用instanceof关键字。即:v[i]
    instanceofEmergency,如果是,说明是应急车辆,接着判定应急车辆的状态,在判定之
    前先要将应急车辆进行向下转型,Java中向]转型直接在对象前加上用括号括起来的转
    换的目标类型即可,即:[Emergency)vli]).isEmergent0,如果判定为真,执行
    runRedLight(),判定不成功,则调用run(),调用时动态绑定每个数组元素的实际类型,
    需要通过动态类型转换并调用runRedLight():
    if(v[i]instanceofEmergency&&《Emergency)v[i]).isEmergent()){
    ((Emergency)v[i]).runRedLight();
    }else
    V[i]->run();

    主控逻辑代码在maln有法中实现。初始化TraficControISystem,用tcs表示,调用
    tcs的add()函数添加具体的交通工具,这里会II动向上转型成为Vehicle类型,调用control()
    对各车辆进行控制,调用shutDown()系统关自闭
    因此,空(1)和空(2)需要定义接口sEmergent0和runRedLight0,题目代码中
    已经给出用分号结尾,所以空(1)和空(2)分别为"boolisEmergent()”和“void
    runRedLight()”;空(3)需要继承父类Car和实现接口Emergency,Java中继承采用extends
    关键字,即应填入“extendsCarimplementsE】aergency”;空(4)要返回应急车辆对象的
    状态,即填入“this.isEmergency”;空(5)剑:为动态类型转换后的对象(Emergency)v[il;
    空(6)处为普通车辆对象v[i]。
    答案
    (1)booleanisEmergent()
    (2)Voidrunredlight()
    (3)extendsCarimplementsEmergency
    (4)this.isEmergency
    (5)(Emergency)v[i]
    (6)v[i]

  • 第18题:

    In order to cut down on the carbon emission,more people choose to travel______.

    A.by electric car,bicycle or plane

    B.by private car,bicycle or bus

    C.by bus,electric car or plane

    D.by bicycle. bus or electric car


    正确答案:D
    解析:见第四段,人们通过骑自行车,坐公共汽车,开电力汽车的方式来减少二氧化碳的排放。故选D。

  • 第19题:

    阅读以下说明和C++代码,填充代码中的空缺,将解答填入答题纸的对应栏内。
    [说明]
    某应急交通控制系统(TraficControlSystem)在红灯时控制各类车辆(Vehicle)的通行,其类图如下图所示,在紧急状态下应急车辆红灯时也可通行,其余车辆按正常规则通行。

    下面的C++代码实现以上设计,请完善其中的空缺。

    [C++代码]#include<typeinfo>#include<iostream>using namespace std;class Vehicle {/*抽象基类,车辆*/public:virtual void run()=0;};class Emergency { /*抽象基类,可在红灯时通行的接口,函数均为纯虚函数*/public:______=0; //isEmergent()函数接口______=0; //runRedLight()函数接口};clasS Car:public Vehicle{public:~Car(){}void run(){/*代码略*/ ));class Truck:public Vehicle{public:~Truck(){}void run(){ /*代码略*/ });class PoliceCar:______ {private:bool isEmergency;public:PoliceCar():Car(),Emergency() { this->isEmergency=false;}PoliceCar(bool b):Car(),Emergency() {this->isEmergency=b;}~P0liceCar(){ }bool isEmergent(){ return ______}void runRedLight() { /*代码略*/ });/*类Ambulance、FireEngine实现代码略*/class TraficControlsystem { /*交通控制类*/private:Vehicle*v[24]; int numVehicles;/*在构造函数中设置初始值为0*/public:void control(){ //控制在紧急情况下应急车辆红灯通行,其他情况按常规通行for(int i=0;i<numVehicles; i++){Emergency *ev=dynamic_cast<Emergency*>(v[i]);if(ev !=0) ______->runRedLight();else ______->run();}}void add(Vehicle*vehicle) { v[numVehicles++] =vehicle; }/*添加车辆*/void shutDown() {for(int i=0; i<numVehicles; i++) { delete v[i];} }};int main(){TraficControlSystem*tcs=new TraficControlSystem;tcs->add(new Car()); tcs->add(new PoliceCar());tcs->add(new Ambulance()); tcs->add(new Ambulance(true));tcs->add(new FireEngine(true));tcs->add(new FireEngine());tcs->add(new Truck());tcs->contr01();tcs->ShutDown();delete tcs;}


    答案:
    解析:
    virtual bool isEmergent()
    virtual void nmRedLight()
    public Car, public Emergency
    this->isEmergency
    ev
    v[i]

  • 第20题:

    The school has made it a rule that no student shall take an illegal vehicle __________a school bus.

    A.other than
    B.rather than
    C.or rather
    D.or else

    答案:A
    解析:
    考查短语辨析。other than“除了,除了……之外”,常用于否定结构中;rather than“而不是”,连接两个同等成分,肯定前者,否定后者;or rather“更确切地说”;or else“否则,要不然”。句意为“学校规定学生不能乘坐除校车以外的其他非法机动车辆”。根据语境可知A项最符合句意。

  • 第21题:

    单选题
    _____
    A

    By car.

    B

    By train.

    C

    By plane.

    D

    By ship.


    正确答案: D
    解析:
    推理题。女士说“你知道我不想乘飞机旅行”,男士说“那我们坐火车吧”。由此可知,他们选择坐火车去旅行。正确答案为B。
    【录音原文】
    W: You know I don’t like to travel by plane.
    M: Yes, I see. Then let’s go there by train.
    Q: How will the two speakers probably travel?

  • 第22题:

    单选题
    What is suggested about Ms. Forsyth?
    A

    She is knowledgeable about cars.

    B

    Her employer will pay for her vehicle.

    C

    She is planning to buy her first vehicle

    D

    Her current car is unreliable.


    正确答案: C
    解析:
    根据邮件第二句“The car I own now --- a 1999 Datsun 350 hatchback --- keeps breaking down, so I am looking to replace it”,可知她现在的车总是出故障。D项正确。

  • 第23题:

    单选题
    11. abstract class Vehicle { public int speed() { return 0; } }  12. class Car extends Vehicle { public int speed() { return 60; } }  13. class RaceCar extends Car { public int speed() { return 150; }}  ......  21. RaceCar racer = new RaceCar();  22. Car car = new RaceCar();  23. Vehicle vehicle = new RaceCar();  24. System.out.println(racer.speed() + “, „ + car.speed()  25. + “, “+ vehicle.speed());  What is the result?()
    A

     0, 0,0

    B

     150, 60, 0

    C

     Compilation fails.

    D

     150, 150, 150

    E

     An exception is thrown at runtime.


    正确答案: E
    解析: 暂无解析