已知如下定义:Strings="story";下面哪个语句不是合法的()。
A.s+="books";
B.s=s+100;
C.intlen=s.length;///jia()
D.Stringt=s+“abc”;
A.s+="books";
B.s=s+100;
C.intlen=s.length;///jia()
D.Stringt=s+“abc”;
第1题
A.classVechicle:publicBicycle
B.classBicycle:classVechicle
C.classBicycle:publicVechicle
D.classBicycle:publicclassVechicle
第2题
A.正确运行,输出:B
B.正确运行,输出:A
C.运行时引发异常
D.编译时发生错误
第3题
A.正确运行,输出:A
B.编译时发生错误
C.正确运行,输出:B
D.运行时引发异常
第4题
已知Ackermann函数定义如下:
①写出计算Ack(m,n)的递归算法,并根据此算法给出出Ack(2,1)的计算过程。
②写出计算Ack(m,n)的非递归算法。
第5题
已知集合A,B,其中是偏序集,定义BA上的二元关系R如下:
(1)证明R为BA上的偏序.
(2)给出<BA,R>存在最大元的充分必要条件和最大元的一般形式.
第6题
A.编译错误:没有找到构造方法Child()
B.编译错误:没有找到构造方法Parent1()
C.正确运行,没有输出值
D.正确运行,输出结果为:parent2
第7题
/****************** 文件shape.h*************************/
const float PI=3.14159f; // 定义圆周率常量
class Shape // 几何图形抽象类
{
public:
virtual float GetPerimeter()=0; // 纯虚函数,计算周长
virtual float GetAre()=0; // 纯虚函数,计算面积
};
class Rectangle: public Shape // 矩形类
{
public:
Rectangle (float len,float wid):length(len),width(wid){}
~Rectangle (){}
float GetPerimeter() {return 2*(length width);} // 计算矩形周长
float GetAre() {return length*width;} // 计算矩形面积
private:
float length, width; // 矩形的长和宽
};
class Circle: public Shape // 圆类
{
public: // 在下面编写每个成员函数
private:
float rad; // 圆的半径
};
class Square: public Rectangle // 正方形类
{
public:
Square(float len): Rectangle(len,len){}
~Square(){}
};
第9题
A.jumbled
B.cluttered
第11题
A coastguard does NOT require the life preserver to be made ______.
A.with as few strings as possible
B.capable of being worn on both sides
C.according to each wearer's size
D.comfortable and light to wear