单选题有两个关系R、S如下所示:由关系R通过运算得到关系S,则所使用的运算为()。
单选题集簇属于( )。
单选题下面程序段的正确输出是
int w=4,x=3,y=2,z=1;
cout<<(w<x? w:z<y? z:x)<<end1;
单选题若有以下程序:
#include
using namespace std;
class TestClass
{
public:
void whoO{coutwho();
return 0:
}
则该程序运行后的输出结果是( )。
单选题有以下程序 #include<iostream> #include<string> using namespace std; class base { private: charbaseName[10]; public: base() { strcpy(baseName,"Base"); } virtual char*myName() return baseName; } char *className() { return baseName; } }; class Derived: public base { private: char derivedName[10]; public: Derived() { strcpy(derivedName,"Derived"); } char *myName() { return derivedName; } char *className() { return derivedName; } }; void showPtr(base } int main() { base bb; Derived dd; showPtr(dD) ; retum 0; } 动行后的输出结果为
单选题在函数中,可以用auto、extem、register和static四个关键字中的一个来说明变量的存储类型,如果不说明存储类型,则默认的存储类型是( )。
单选题下列叙述中正确的是( )。
单选题一个函数为void f(int,char ch="a"),另一个函数为void f(iht),则它们
____
。
单选题以下不正确的定义语句是( )。
单选题有以下程序段: #include<iostream.h> #define MAX(x,y) (x)>(y)?(x):(y) void main() int i,j,k; i=10; j= 15; k=MAX(i,j)* 10; cout<<k<<end1; A) 15 B) 100 C) 150 D) 10
单选题设有定义:
classperson
{inthum;
charname[10];
public:
voidinit(intn,char*m);
};
personstd[30]
则以下叙述不正确的是( )。
单选题编译时的多态性可以通过使用( )获得。A) 虚函数和指针 B) 重载函数 C) 虚函数和对象 D) 虚函数和引用
单选题有如下程序: #include <iostream> using namespace std; class point { int x, y; public: point( int vx, int vy ) { x = vx; y = vy; } point ( ) { x = 0; y = 0; } point operator+( point pl ) { point p; int px = x + p1.x; int py = y + p1.y; return point( px, py ); } point operator-( point p1 ) { point p; int px = x - p1.x; int py = y - p1.y; return point( px, py ); } void print() { cout<<x<<", "<<y<<end1; } }; int main () { point pl ( 10, 10 ), p2 ( 20, 20 ); p1 = p1 + p2; p1.print (); return 0; } 执行后的输出结果是( )。
单选题已知在一个类体中包含如下函数原型:VOLUME operator-(VOLUME)const;,下列关于这个函数的叙述中,错误的是______ 。
单选题有如下程序:
#include
using namespace std;
class Cup{
public:
Cup(double val=5.8):price(val) { }
void SetPrice(double val) { price=val; }
double GetPrice() const { return price;}
private:
double price;
};
int main(){
const Cup c1(4.5);
Cup c2(29.8);
c1.SetPrice(5.8); //①
c2.SetPrice(12.8); //②
c1.GetPrice(); //③
c2.GetPrice(); //④
return 0;
}
在标注号码的语句行中存在语法错误的是
单选题C++系统预定义了4个用于标准数据流的对象,下列选项中不属于此类对象的是______。
单选题有如下程序:
#include<iostream>
using namespace std;
int main()
{
void function(double val);
double val;
function(val);
cout<<val;
return 0;
}
void function(double val)
{val=3;}
编译运行这个程序将出现的情况是______。
单选题已知类A有公用数据成员a,并重载了“=”运算符,且有A obj2;const A*ptr new A;则下列语句错误的是{{U}}
{{/U}}。
A.ptr->a=100;
B.ptr=
C.ptr++;
D.obj2=*ptr;
单选题下列选项可以做C++标识符的是( )。
单选题已知函数模板定义如下:template<typename T>T max(T x,T y){return x>y?x:y;}下列叙述中,错误的是( )。
