D.④
B.②
friend void show(AA aa) const {cout< //④
};
其中的四个函数定义中正确的是
A.①
(23)有如下程序:
#include
using namespace std;
class Base
{
public:
C.③
void fun() { cout<<"Base::fun"<fun()
(24)下面是重载为非成员函数的运算符函数原型,其中错误的是
A.Fraction operator + (Fraction, Fraction);
B.Fraction operator - (Fraction);
C.Fraction& operator = (Fraction&, Fraction);
D.Fraction& operator += (Fraction&, Fraction);
(25)有如下函数模板:
template
T cast(U u) {
其功能是将 U 类型数据转换为 T 类型数据。已知 i 为 int 型变量,下列对模板函数 cast 的
调用中正确的是
A . cast(i);
C.cast(i);
(26)若磁盘上已存在某个文本文件,其全路径文件名为 d:\ncre\test.txt,下列语句中不
B . cast<>(i);
B.Base::fun()
D.fun();
return u; }
D.cast (i);
一次,他在核实数据时,认为部分数据需要重新测量,但项目部的车都被派出去了。belimitedtonomorethan2daysofwork,materialdepositedinspecialinsulatedcontainers,materialhandlingtogentlyandmakeuseofthermalinsulationmaterialinwindproof,waterproof,moisture-proofmeasure.6.2thermaldesignoptimizationforhigh-temperaturespecialthermalinsulationforpipingsupportandhangerdesign,reducedheatdissipationofthehangers,ensurethatthewalldoesnotoverheat.Small-diameterpiping,thermalinstrumentlayoutandpositioningofsupportandhangerdesigntakefullyintoaccounttheexpansionspaceandinsulationthickness.Large-diameterpipesafterheatpreservationplasteringconstructionofvalves,turbine,checkingsmoothsurface,hightemperaturepowderpaintfullydryafter.Protectivecoveringsforelectricequipmentinsulationboardsdesignedwithpressureplate,whenorderingaccordingtotheinstallationdiagram,modelspecificationspublishingorder,ensurewheninstallingcornersneat,uniformappearance,reducetheamountofon-sitemachining.Beforevalves,flangeinsulationshellconstruction,besuretomakeaunifiedmodel,allvalves,flanges,insulationcoverunified,tidyandbeautiful.Whenfourpartssuchaspipes,boilerinsulation,mustdofirstarticleinspection,proofofdesignandconstructionmethods,technologycanmeetthetechnologicalrequirements,beforeextensiveconstruction.Boilersteelbeams,dooropeningboxesdesignedwithinsulationgaskets,flangecannotbeoblique,evenfastened.Backintotheslopeofthetubingduringinstallationpayattentiontothepiping,oilstationisalowpoint.Refuelingmustbecontrolledwhencastingmaterialparts,selectlowthermalconductivitymaterialsasfaraspossible,ensurethatthesepartsdonotoverheat.6.3qualitydefectsofinsulationtechnologymanagementoptimizationofconstructionprocessanddevelopareasonableduration,regionaltransferofstrictly
C.③
D.④
能打开该文件的是
A.ifstream file("d:\ncre\test.txt");
B.ifstream file("d:\ncre\test.txt");
C.ifstream file; file.open("d:\ncre\test.txt");
D.ifstream* pFile=new ifstream("d:\ncre\test.txt");
(27)有如下类定义:
class Foo
{
public:
Foo(int v):value(v){} //①
~Foo(){} //②
private:
Foo(){} //③
int value = 0; //④
};
其中存在语法错误的行是
B.②
A.①
(28)有如下类定义:
class Point
{
int x_, y_;
public:
Point():x_(0), y_(0){}
Point(int x, int y = 0):x_(x),y_(y){}
};
若执行语句
Point a(2), b[3], *c[4];
则 Point 类的构造函数被调用的次数是
A.2 次
(29)有如下类定义:
class Test
{
public:
Test(){ a = 0; c = 0;} //①
int f(int a)const{this->a = a;} //②
static int g(){return a;} //③
void h(int
B.{Test::b = b;}; //④
private:
int a;
static int b;
const int c;
};
int Test::b = 0;
B.3 次
C.4 次
一次,他在核实数据时,认为部分数据需要重新测量,但项目部的车都被派出去了。belimitedtonomorethan2daysofwork,materialdepositedinspecialinsulatedcontainers,materialhandlingtogentlyandmakeuseofthermalinsulationmaterialinwindproof,waterproof,moisture-proofmeasure.6.2thermaldesignoptimizationforhigh-temperaturespecialthermalinsulationforpipingsupportandhangerdesign,reducedheatdissipationofthehangers,ensurethatthewalldoesnotoverheat.Small-diameterpiping,thermalinstrumentlayoutandpositioningofsupportandhangerdesigntakefullyintoaccounttheexpansionspaceandinsulationthickness.Large-diameterpipesafterheatpreservationplasteringconstructionofvalves,turbine,checkingsmoothsurface,hightemperaturepowderpaintfullydryafter.Protectivecoveringsforelectricequipmentinsulationboardsdesignedwithpressureplate,whenorderingaccordingtotheinstallationdiagram,modelspecificationspublishingorder,ensurewheninstallingcornersneat,uniformappearance,reducetheamountofon-sitemachining.Beforevalves,flangeinsulationshellconstruction,besuretomakeaunifiedmodel,allvalves,flanges,insulationcoverunified,tidyandbeautiful.Whenfourpartssuchaspipes,boilerinsulation,mustdofirstarticleinspection,proofofdesignandconstructionmethods,technologycanmeetthetechnologicalrequirements,beforeextensiveconstruction.Boilersteelbeams,dooropeningboxesdesignedwithinsulationgaskets,flangecannotbeoblique,evenfastened.Backintotheslopeofthetubingduringinstallationpayattentiontothepiping,oilstationisalowpoint.Refuelingmustbecontrolledwhencastingmaterialparts,selectlowthermalconductivitymaterialsasfaraspossible,ensurethatthesepartsdonotoverheat.6.3qualitydefectsofinsulationtechnologymanagementoptimizationofconstructionprocessanddevelopareasonableduration,regionaltransferofstrictly5
D.5 次
C.③
D.④
B.ABA~B~A~A
D.ABA~A~B~A
B.②
在标注号码的行中,能被正确编译的是
A.①
(30)有如下程序:
#include
using namespace std;
class A
{
public:
A(){cout<<"A";}
~A(){cout<<"~A";}
};
class B:public A
{
A* p;
public:
B(){cout<<"B"; p = new A();}
~B(){cout<<"~B"; delete p;}
};
int main()
{
B obj;
return 0;
}
执行这个程序的输出结果是
A.BAA~A~B~A
C.BAA~B~A~A
(31)有如下程序:
#include
using namespace std;
class Base
{
private:
void funl() const{cout<<"funl";}
protected:
void fun2() const{cout<<"fun2";}
public:
void fun3() const{cout<<"fun3";}
};
class Derived:protected Base
{
public:
void fun4() const{cout<<"fun4";}
};
int main()
一次,他在核实数据时,认为部分数据需要重新测量,但项目部的车都被派出去了。belimitedtonomorethan2daysofwork,materialdepositedinspecialinsulatedcontainers,materialhandlingtogentlyandmakeuseofthermalinsulationmaterialinwindproof,waterproof,moisture-proofmeasure.6.2thermaldesignoptimizationforhigh-temperaturespecialthermalinsulationforpipingsupportandhangerdesign,reducedheatdissipationofthehangers,ensurethatthewalldoesnotoverheat.Small-diameterpiping,thermalinstrumentlayoutandpositioningofsupportandhangerdesigntakefullyintoaccounttheexpansionspaceandinsulationthickness.Large-diameterpipesafterheatpreservationplasteringconstructionofvalves,turbine,checkingsmoothsurface,hightemperaturepowderpaintfullydryafter.Protectivecoveringsforelectricequipmentinsulationboardsdesignedwithpressureplate,whenorderingaccordingtotheinstallationdiagram,modelspecificationspublishingorder,ensurewheninstallingcornersneat,uniformappearance,reducetheamountofon-sitemachining.Beforevalves,flangeinsulationshellconstruction,besuretomakeaunifiedmodel,allvalves,flanges,insulationcoverunified,tidyandbeautiful.Whenfourpartssuchaspipes,boilerinsulation,mustdofirstarticleinspection,proofofdesignandconstructionmethods,technologycanmeetthetechnologicalrequirements,beforeextensiveconstruction.Boilersteelbeams,dooropeningboxesdesignedwithinsulationgaskets,flangecannotbeoblique,evenfastened.Backintotheslopeofthetubingduringinstallationpayattentiontothepiping,oilstationisalowpoint.Refuelingmustbecontrolledwhencastingmaterialparts,selectlowthermalconductivitymaterialsasfaraspossible,ensurethatthesepartsdonotoverheat.6.3qualitydefectsofinsulationtechnologymanagementoptimizationofconstructionprocessanddevelopareasonableduration,regionaltransferofstrictly
C.②③④
D.①④
B.①②③
{
Derived obj;
obj.funl(); //①
obj.fun2(); //②
obj.fun3(); //③
obj.fun4(); //④
return 0;
}
其中有语法错误的语句是
A.①②③④
(32)有如下程序:
#include
using namespace std;
class Base
{
public:
void funl(){cout<<"Base\n";}
virtual void fun2(){cout<<"Base\n";}
};
class Derived:public Base
{
public:
void funl(){cout<<"Derived\n";}
void fun2(){cout<<"Derived\n";}
};
void f(Base& b) { b.fun1(); b.fun2(); }
int main() {
Derived obj;
f(obj);
return 0;
}
执行这个程序的输出结果是
A. Base
Base
B.Base
Derived
C.Derived
Base
D.Derived
Derived
(33)有如下程序:
#include
using namespace std;
class Complex
{
double re, im;
public:
Complex(double r, double i):re(r), im(i){}
double real() const{return re;}
double image() const{return im;}
一次,他在核实数据时,认为部分数据需要重新测量,但项目部的车都被派出去了。belimitedtonomorethan2daysofwork,materialdepositedinspecialinsulatedcontainers,materialhandlingtogentlyandmakeuseofthermalinsulationmaterialinwindproof,waterproof,moisture-proofmeasure.6.2thermaldesignoptimizationforhigh-temperaturespecialthermalinsulationforpipingsupportandhangerdesign,reducedheatdissipationofthehangers,ensurethatthewalldoesnotoverheat.Small-diameterpiping,thermalinstrumentlayoutandpositioningofsupportandhangerdesigntakefullyintoaccounttheexpansionspaceandinsulationthickness.Large-diameterpipesafterheatpreservationplasteringconstructionofvalves,turbine,checkingsmoothsurface,hightemperaturepowderpaintfullydryafter.Protectivecoveringsforelectricequipmentinsulationboardsdesignedwithpressureplate,whenorderingaccordingtotheinstallationdiagram,modelspecificationspublishingorder,ensurewheninstallingcornersneat,uniformappearance,reducetheamountofon-sitemachining.Beforevalves,flangeinsulationshellconstruction,besuretomakeaunifiedmodel,allvalves,flanges,insulationcoverunified,tidyandbeautiful.Whenfourpartssuchaspipes,boilerinsulation,mustdofirstarticleinspection,proofofdesignandconstructionmethods,technologycanmeetthetechnologicalrequirements,beforeextensiveconstruction.Boilersteelbeams,dooropeningboxesdesignedwithinsulationgaskets,flangecannotbeoblique,evenfastened.Backintotheslopeofthetubingduringinstallationpayattentiontothepiping,oilstationisalowpoint.Refuelingmustbecontrolledwhencastingmaterialparts,selectlowthermalconductivitymaterialsasfaraspossible,ensurethatthesepartsdonotoverheat.6.3qualitydefectsofinsulationtechnologymanagementoptimizationofconstructionprocessanddevelopareasonableduration,regionaltransferofstrictly7
D.(3, 1)
Complex& operator +=(Complex a)
{
re += a.re;
im += a.im;
return *this;
}
};
ostream &operator<<(ostream& s,const Complex& z)
{
return s<<'('<