计算机二级

在以下事件中,Private表示 Private Sub sub1(x As Integer,y As Integer) ...End SubA.此过程可以被其他过程调用B.此过程只可以被本窗体模块中的其他过程调用C.此过程不可以被任何其他过程调用D.此过程只可以被本工程中的其他过程调用

题目

在以下事件中,Private表示 Private Sub sub1(x As Integer,y As Integer) ...End Sub

A.此过程可以被其他过程调用

B.此过程只可以被本窗体模块中的其他过程调用

C.此过程不可以被任何其他过程调用

D.此过程只可以被本工程中的其他过程调用

如果没有搜索结果,请直接 联系老师 获取答案。
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

11、下面哪些定义是类型正确的?

A.f :: (Integer, Integer) -> Float f (x,y) = x / y

B.f :: (Integer, Integer) -> Float f (x,y) = (fromInteger x) / (fromInteger y)

C.f :: (Integer, Integer) -> Float f (x,y) = 3*x + y

D.f :: (Integer, Integer) -> Integer f (x, y) = 3*x + y


AFT 通常由含有一个双氢呋喃环和一个氧杂萘邻酮(香豆素)的基本架构单位构成 AFT 分为 黄曲霉毒素B1(AFB1)、黄曲霉毒素 B2 (AFB2) 黄曲霉毒素G1(AFG1)、黄曲霉毒素 G2(AFG2) 黄曲霉毒素M1(AFM1)、黄曲霉毒素 M2(AFM2) B1、G1的呋喃环氢键异构。M1型氢键变为羟基。 1比2呋喃环上多了一个双键。

第2题:

在事件过程中,Private表示______ 。

A.此过程可以被任何其它过程调用

B.此过程只可以被本窗体模块中的其它过程调用

C.此过程不可以被任何其它过程调用

D.此过程只可以被本工程中的其它过程调用 Private Sub 1blAbc_ Change() …… End Sub


正确答案:B

第3题:

有以下程序:include include using namespace std;class Y;class X{private

有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X { private: int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); } void show(Y &ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); } friend void X: :show(Y &ob) ; }; void X: :show(Y &ob) { cout<<strx<<", "; cout<<ob, stry<<end1; } int main ( ) { X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; } 执行后的输出结果是( )。

A.X,Y

B.a,b

C.X,X

D.Y,Y


正确答案:A
解析:本题考核类的定义和友元函数的应用。①该程序中,类X的成员函数show()在类Y中说明为友元,因此,在该友元成员show()中可以访问类Y的私有成员stry。②成员函数show()的功能就是输出类X的私有成员strx和Y对象ob的私有成员stry,③主函数main()中定义了X类的一个对象a和Y类的一个对象b,并且都进行了初始化。然后调用对象a的成员函数show,输出对象a中私有成员strx中的内容和对象b中私有成员stry中的内容,即字符串stringX和stringY。

第4题:

若有以下程序:include using namespace std;class Base{private: inta,b;public: Bas

若有以下程序: #include <iostream> using namespace std; class Base { private: int a,b; public: Base(int x, int y) { a=x; b=y; } void disp () { cout<<a<<" "<<b<<end1; } }; class Derived : public Base { private: int c; int d; public: Derived(int x,int y, int z,int m) :Base(x,y) { c=z; d=m; } void disp () { cout<<c<<" "<<d<<end1; } }; int main() { Base b(5,5),*pb; Derived obj(1,2,3,4); pb=&obj; pb->disp(); return 0; } 执行程序后的输出结果是( )。

A.1,2

B.3,4

C.2,3

D.5,5


正确答案:A
解析:本题考核基类指针的使用。本题首先定义了一个基类Base和一个由Base派生出来的派生类Derived。在主函数中,定义了一个基类Base指针pb和基类对象b,还定义了派生类Derived的对象obj。然后将派生类对象obj的地址赋值给指向基类Base的指针pb。由于Derived是Base的子类型,因此允许上述赋值,但这时指针pb只能使用从基类Base继承的成员,即当pb指向obj对象时,pb->disp还是调用基类Base的成员函数disp。所以程序最后输出的对象d中对基类成员的初始化值,即1,2。

第5题:

若有以下程序:includeusing namespace std;class A{private:inta;public:voidseta(in

若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: void seta(int x) { a=x; } void showa() { cout<<a<<","; } }; class B { private: int b; public: void setb (int x) { b=x; } void showb() { cout<<b<<","; } }; class C :public A,private B { private: int c; public: void setc(int x, inc y, int z) { c=z; seta (x); setb (y); } void showc() { showa (); showb (); cout<<c<<end1; } }; int main () { C c; c. setc(1,2,3); c.showc(); return 0; } 程序执行后的输出结果是

A.1,2,3

B.1,1,1

C.2,2,2

D.3,3,3


正确答案:A
解析:本题考核派生类的应用。本题中类A和类B都是基类。而类C从类A公有派生,从类B处私有派生.所以类C中的函数成员可以访问类A和类B中的公有成员。在类C的函数成员setc中,调用基类A的函数成员seta对A的数据成员a赋值,还调用了基类B的函数成员setb对类B的数据成员b赋值,然后对类C自己的数据成员c赋值。在类C的函数成员showc中,调用基类A的函数成员showa显示数据成员a的值,还调用基类B的函数成员showb显示数据成员b的值,然后输出类C自己的数据成员c的值.在主函数main中,先定义派生类的对象c,然后调用setc对c中的数据成员赋值,然后输出赋值结果。所以程序最后输出应该为:1,2,3。

第6题:

若有以下程序:includeusing namespace std;class A{private:int a; public:void seta

若有以下程序: #include<iostream> using namespace std; class A { private: int a; public: void seta(int x) { a=x; } void showa() { cout<<a<<","; } }; class B { private: int b; public: void setb(int x) { b=x; } void showb() { cout<<b<<",”; } }; class C:pUblic A,private B { private: int c; public: void setc(int x,int y,int z) { c=z; seta(x); setb(y); } void showc() { showa(); showb(); cout<<c<<end1; } }; int main() { Cc; c.setc(1,2,3); c.showc(); retrun 0; } 程序执行后的输出结果是

A.1,2,3

B.1,1,1

C.2,2,2

D.3,3,3


正确答案:A
解析:本题考核派生类的应用。本题中类A和类B都是基类。而类C从类A公有派生,从类B处私有派生。所以类C中的函数成员可以访问类A和类B中的公有成员。在类C的函数成员setc中,调用基类A的函数成员seta对A的数据成员a赋值,还调用了基类B的函数成员setb对类B的数据成员b赋值,然后对类C自己的数据成员c赋值。在类C的函数成员showc中,调用基类A的函数成员showa显示数据成员a的值,还调用基类B的函数成员showb显示数据成员b的值,然后输出类C自己的数据成员c的值。在主函数main中,先定义派生类的对象c,然后调用setc对c中的数据成员赋值,然后输出赋值结果。所以程序最后输出应该为:1,2,3。

第7题:

若有以下程序:include using namespace std;class Base{private: int a,b;public: Ba

若有以下程序: #include <iostream> using namespace std; class Base { private: int a,b; public: Base(int x, int y) { a=x; b=y; } void show() { cout<<a<<", "<<b<<end1; } }; class Derive : public Base { private: int c, d; public: Derive(int x, int y, int z,int m):Base(x,y) { c=z; d=m; } void show() { cout<<c<<", "<<d<<end1; } }; int main ( ) { Base b(50,50) ,*pb; Derive d(10,20,30,40); pb=&d; pb->show {); return 0; }

A.10,20

B.30,40

C.20,30

D.50,50


正确答案:A
解析:本题考核基类指针的使用。本题首先定义了一个基类Base和一个由Base派生出来的派生类Derive。在主函数中,定义了一个基类Base指针吵和基类对象b,还定义了派生类Derive的对象do然后将派生类对象d的地址赋值给指向基类Base的指针pb。由于Derive是Base的子类型,因此允许上述赋值。但这时指针pb只能使用从基类Base继承的成员,即当pb指向d对象时,pb->show还是调用基类Base的成员函数show()。所以程序最后输出的是对象d中对基类成员的初始化值,即10,20。

第8题:

有以下程序:include using namespace std;class sample{private: int x; static int

有以下程序:#include <iostream>using namespace std;class sample{private: 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<<end1;}int sample:: y=0;int main(){ sample s1(10); sample s2(20); sample:: print(s2); return 0;}程序运行后的输出结果是( )。

A.x=10,y=20

B.x=20,y=30

C.x=30,y=20

D.x=30,y=30


正确答案:B

第9题:

program exam(output); var x,y,x:integer; proedure silly(x:integer;vary:integer); begin x:=5;y:=6;z:=3; writeln(x,y,z) end; begin x:=1;y:=2;z:=3; silly(x,y); writeln(x,y,z) end. 以上程序运行结果为().

A567 563

B567 567

C567 167

D567 163


正确答案:C