选择题 ______提供了类对外部的接口,私有成员是类的内部实现,而保护成员不允许外界访问,但允许派生类的成员访问,这样既有一定的隐藏能力,又提供了开放的接口。
选择题 下列各种函数中,______ 不是类的成员函数。
选择题 单个用户使用的数据视图的描述称为______
选择题 有如下程序:
#include<iostream>
using namespace std;
class B{
public:
B(int xx):x(xx){++count;x+=10;}
virtual void show()const
{cout<<count<<'_'<<x<<endl;}
protected:
static int count;
private:
int x;
};
class D:public B{
public:
D(int xx,int yy):B(xx),y(yy)(++count;y+=100;}
virtual void show()const
{cout<<count<<'_'<<y<<endl;}
private:
int y;
};
int B::count=0;
int main(){
B*ptr=new D(10,20);
ptr->show();
delete ptr;
return 0;
}
运行时的输出结果是______。
选择题 下列情况中,不会调用拷贝构造函数的是______。
选择题 有如下类定义:
class Foo
{
public:
Foo(intv):value(v){} //①
~Foo(){} //②
private:
Foo(){} //③
int value=0; //④
};
其中存在语法错误的行是 。
选择题 下面程序的输出结果是______。
int main()
{
int x[6]={1,3,5,7,9,11},*k,**s;
k=x;
s=k;
cout<<*(k++)<<','<<**s<<endl
return 0;
}
选择题 下列叙述中错误的是______。
选择题 有下列程序:
#include <stdio.h>
void main()
{ int a=1,b=2,c=3,d=0;
if(a==1&&b++==2)
if(b!=2||c--!=3)
printf('%d,%d,%d\n',a,b,c);
else prinif('%d,%d,%d\n',a,b,c);
else printf('%d,%d,%d\n',a,b,c);
}
程序运行后的输出结果是______。
选择题 有以下程序:
#include <iostream>
using namespace std;
class sample
{
pnvate:
int x;
static int y;
public:
sample(int a);
static void print(sample s);
};
sample::sample(int a)
{
x=a;
y+=x;
}
void sample::print(sample s)
{
cout<<'x='<<s.x<<',y='<<y<<endl;
}
int sample::y=0;
int main()
{
sample s1(10);
sample s2(20);
sample::print(s2);
return 0;
}
程序运行后的输出结果是 。
选择题 为完成下面的程序,在画线处应填入的语句是______。
#included<iostream>
using namespace std;
class Base
{
int x;
public:
Base(int i){x=i;}
~Base(){}
};
class Derived:public Base
{
public:
______//完成类Derived构造函数的定义
};
int main()
{
Derived obj(2);
return 0;
}
选择题 用树形结构来表示实体之间联系的模型称为______
选择题 有如下程序:
#include <iostream>
using namespace std:
class Test
{
public:
Test() {n+=2;
~Test() {n-=3; ;
static int getNum() {return n;}
privaue:
static int n:
};
int Test::n=1;
int main()
{
Test* p=new Test;
delete p;
cout<<'n='<<Test::getNum()<<end1;
return 0;
}
执行后的输出结果是
选择题 下列程序的输出结果是______。
#include<iostream. h>
int min(int a, int b)
{
if(a<b)return a;
else return b;
return 0;
}
void main()
{
cout<<min(1, min(2, 3))<<endl;
}
选择题 设有定义语句int(*f)(int);,则下列叙述正确的是______。
选择题 下面程序的运行结果是 。
#include<iostream.h>
void main()
{
int i=1;
while(i<=8)
if(++i%3!=2)continue;
else cout<<i;
}
选择题 软件按功能可以分为:应用软件、系统软件和支撑软件(或工具软件)。下面属于应用软件的是______。
选择题 对于下列语句,正确的判断是
for=(x=0;y=0;(y!=123)(x<4);x++);
选择题 有以下函数:
char fun(char*p)
{return p;}
则该函数的返回值是 。
选择题 阅读下面的程序:
#include<iostream.h>
void main()
{
int x;
cin>>x;
if(x++>5)
cout<<x<<endl;
else
cout<<x--<<endl;
}
如果两次执行上述程序,且键盘输入分别为4和6,则输出结果分别是______。