单选题对于类定义: class A public: virtual void funcl() void func2() ); class B:public A public: voidfuncl()cout<<“class Bfunc 1”<<endl; virtual void func2()cout<<“class B func 2”<<endl; ; 下面正确的叙述是( )。
单选题下面不属于软件工程的3个要素的是
____
。
单选题下列程序的运行结果是( )。 #include<iostream.h> classA int a; public: A()a=0; A()int aa a=aa; cout<<a++; ; void main() A x,y(2),z(3); cout<<endl; A.00 B.23 C.34 D.25
单选题下列程序的运行结果为( )。
#include<iostream.h>
void main( )
{
int a=2;
int b=a+1;
cout << a/b << endl;
}
单选题有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*'); cout.width(6); cout.fill('#'); cout<<888<<endl; return 0: } 的执行结果是( )。
单选题有如下程序:
#include
using namespace std;
int main()
{
char str[100],*P;
cout>str;
P=str;
for(int i=0;*p!=’\0’;p++,i++);
cout<
单选题有如下程序:
#include<iostream>
using namespace std;
class AA {
int k;
protected:
int n;
void setK(int k) {this->k=k;}
public:
void setN(int n) {this->n=n;}
};
class BB: public AA {/*类体略*/};
int main()
{
BB x;
x. n=1://1
x. setN(2);//2
x. k=3://3
x. setK(4);//4
return 0;
}
在标注号码的四条语句中正确的是______。
单选题在软件开发过程中,需求分析阶段产生的主要文档是
单选题有如下程序:
#include<iostream>
using namespace std;
class Pair{
int m,n;
public:
Pair(int j,int k):m(j),n(k){}
int get(){return m;}
int get()const{return m+n;}
};
int main(){
Pair a(3,5);
const Pair b(3,5);
cout<<a.get()<<b.get();
return 0;
}
执行这个程序的输出结果是______。
单选题继承具有( ),即当基类本身也是某一个类的派生类时,底层的派生类也会自动继承间接基类的成员。 A.规律性 B.传递性 C.重复性 D.多样性
单选题对软件的特点,下面描述正确的是______。
单选题虚函数支持多态调用,一个基类的指针可以指向派生类的对象,而且通过这样的指针调用虚函数时,被调用的是指针所指的实际对象的虚函数,而非虚函数不支持多态调用。有如下程序: #include <iostream> using namespaee std; class Base public: virtual void f( )cout<<"f0+"; void g( )cout<<"gO+"; ; class Derived:public Base public: void f( )cout<<"f+"; void g( )cout<<"g+"; ; int main( ) Derived d; Base*P=&d: p->f( );p->g( ); return 0; 程序的输出结果是
单选题有下列程序: #include<iosteram.h>
using namespace std; class Stack
{ public:
Stack(unsignedn=10):size(n){rep_=new int [size];top=O;}
Stack(Stack
for(int i=0;i<size;i++)
rep_[i]=s.rep_[i];
top=s.top; }
~Stack()<delete[]rep_;} void push(int A)
{rep_[top]=a;top++;} intpop(){--top;return
rep_[top];} bool isEmpty()const {return
top==0;} private:
int*rep_; unsigned size,top;
}; int main() {
Stack s1; for(int
i=1;i<5;i++) s1.push(i);
Stack s2(s1); for(int
i=1;i<3;i++)
cout<<s2.pop()<<','; s2.push(6);
s1.push(7);
while(!s2.isEmpty())
cout<<s2.pop()<<','; return 0;
} 执行上面程序的输出结果是{{U}} {{/U}}。
A. 4,3,2,1,
B. 4,3,6,7,2,1,
C. 4,3,6,2,1,
D. 1,2,3,4,
单选题如果派生类以protected方式继承基类,则原基类的protected成员和public成员在派生类中的访问属性分别是( )。
单选题下面程序的结果是 #include<iostream.h> class A int a; public: A():a(1) void showa()cout<<a; ; class B int a; public: B():a(2) void showa()cout<<a; ; class C:public A,public B int a; public: C():a(3) ㈠ voidshowa()cout<<a; ; voidmain() C c; c.showa();
单选题若有以下程序: #include <iostream> using namespace std; class A private: int a; public: A(int i) a=i; void disp() cout<<a<<","; ; class B private: int b; public: B(int j) b=j; void disp() cout<<b<<","; ; class C:public B,public A private: int c; public: C(int k):A(k-2),B(k+2) c=k; void disp() cout<<c<<endl; ; int main() C obj(10); obj.disp(); return 0; 程序执行后的输出结果是( )。 A.10,10,10 B.10,12,14 C.8,10,12 D.8,12,10
单选题软件生命周期是指______。
单选题运行以下程序后,如果从键盘上输入shose后回车,则输出结果为 _______。 # include<iostream.h> void main() int v1=0,v2=0,k=0; char ch[80]; cin>>ch; while(ch[k]) switch(ch[k]) case 's'; case 'h'; default: v1++1; case 'o': v2++; k++; cout<<v1<< ","<<v2<<end1; A) 2, 0 B) 5, 0 C) 4, 5 D) 2, 5
单选题下列关于类模板的叙述中,错误的是______。
单选题要建立文件流并打开当前目录下的文件file. dat用于输入,下列语句中错误的是( )。 A) ifstream fin = ifstream, open( "file. dat" ) ; B) ifstream * fin = new ifstream( "file. dat" ) ; C) ifstream fin; fin. open ( "file. dat" ) ; D) ifstream * fin = new ifstream() ; fin -> open( "file. dat" ) ;