选择题 有如下类定义:
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,则输出结果分别是______。
选择题 在一个函数体中,定义一个变量的默认存储类型是______。
选择题 下列关于多继承二义性的描述中,错误的是 。
选择题 关于动态存储分配,下列说法正确的是 。
选择题 下面程序错误的语句是
①# include <iostream.h>
②void main( )
③{
④int * p=new int[1];
⑤p=9;
⑥cout << * p << endl;
⑦delete [ ]p;
⑧}
选择题 有以下类定义:
class Point {
public:
Point(int x=0,int y=0){_x=x; _y=y;}
void Move(int x Off, int y Off)
{_x+=x Off; _y+=y Off; }
void Print() const
{
cout <<'(' << _x << ',' << _y << ')'<< end 1;}
private:
int _x,_y;
}
下列语句中会发生编译错误的是______。
