EXY-SC-1340
第 161 题
循环队列常用于实现数据缓冲。假设一个循环队列容量为 $5$(即最多存放 $4$ 个元素,留一个位置区分空与满),依次进行操作:入队数据 $1$、$2$、$3$,出队 $1$ 个数据,再入队数据 $4$ 和 $5$,此时队首到队尾的元素顺序是( )。
语言:
C++
GESP真题
六级
2025.9
单选题号:
5
EXY-SC-1339
第 162 题
栈的操作特点是( )。
语言:
C++
GESP真题
六级
2025.9
单选题号:
4
EXY-SC-1338
第 163 题
下面代码中 v1 和 v2 调用了相同接口 move(),但输出结果不同。这体现了面向对象编程的( )特性。
class Vehicle {
private:
string brand;
public:
Vehicle(string b) : brand(b) {}
void setBrand(const string& b) { brand = b; }
string getBrand() const { return brand; }
virtual void move() const {
cout << brand << " is moving..." << endl;
}
};
class Car : public Vehicle {
private:
int seatCount;
public:
Car(string b, int seats) : Vehicle(b), seatCount(seats) {}
void showInfo() const {
cout << "This car is a " << getBrand()
<< " with " << seatCount << " seats." << endl;
}
void move() const override {
cout << getBrand() << " car is driving on the road!" << endl;
}
};
class Bike : public Vehicle {
public:
Bike(string b) : Vehicle(b) {}
void move() const override {
cout << getBrand() << " bike is cycling on the path!" << endl;
}
};
int main() {
Vehicle* v1 = new Car("Toyota", 5);
Vehicle* v2 = new Bike("Giant");
v1->move();
v2->move();
delete v1;
delete v2;
return 0;
}
语言:
C++
GESP真题
六级
2025.9
单选题号:
3
EXY-SC-1337
第 164 题
假设变量 veh 是类 Car 的一个实例,我们可以调用 veh.move(),是因为面向对象编程有( )性质。
class Vehicle {
private:
string brand;
public:
Vehicle(string b) : brand(b) {}
void setBrand(const string& b) { brand = b; }
string getBrand() const { return brand; }
void move() const {
cout << brand << " is moving..." << endl;
}
};
class Car : public Vehicle {
private:
int seatCount;
public:
Car(string b, int seats) : Vehicle(b), seatCount(seats) {}
void showInfo() const {
cout << "This car is a " << getBrand()
<< " with " << seatCount << " seats." << endl;
}
};
语言:
C++
GESP真题
六级
2025.9
单选题号:
2
EXY-SC-1336
第 165 题
下列关于类的说法,错误的是( )。
语言:
C++
GESP真题
六级
2025.9
单选题号:
1
当前页显示 161 - 165
,共 1260 道单选题