当发生Form_Click事件时,下列程序的输出结果是()。Private m As Integer,n As IntegerPrivate Sub

题目

当发生Form_Click事件时,下列程序的输出结果是( )。 Private m As Integer,n As Integer Private Sub Form_Click() Dim k As Integer,p As Integer k=6:p=60 Call sub1(k,p) Print m,n,m,k,p Call sub1(k,p) Print m,n,k,p End Sub Private Sub Form_Load() m=7 n=70 End Sub Public Sub sub1(x As Integer,ByVal y As Integer) Dim m As Integer n=n+5 m=n+x+y x=x+y y=x+y End Sub

A.7 75 66 60 7 80 126 60

B.7 75 66 60 7 75 126 60

C.7 75 66 60 7 80 66 60

D.7 75 66 60 7 75 66 60

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

第1题:

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

有以下程序: #include <iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp () { cout<<"n="<<n<<endl; } }; int main() { sample s (10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是

A.n=10

B.n=5

C.n=15

D.n=20


正确答案:C
解析:本题考核this指针的应用。上述程序中sample类定义了一个addvalue非静态成员函数。addvalue函数的原型是:void addvalue(sample *this,int m);,该函数的第一个参数是执行该类对象的一个指针即this指针。由于这个参数是系统隐含的,所以我们在定义该成员函数时并没有看到这样一个参数。在成员函数的定义体中,可以通过this访问这一参数。上述程序的最后输出结果是15。

第2题:

有以下程序:include using namespace std;class sample {private: iht n;public: sam

有以下程序: #include <iostream> using namespace std; class sample { private: iht n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp() { cout<<"n="<<n<<end1; } }; int main() { sample s(10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是

A.n=10

B.n=5

C.n=15

D.n=20


正确答案:C
解析:本题考核this指针的应用。上述程序中sample类定义了一个addvalue非静态成员函数。addvalue函数的原型是:voidaddvalue(sample*this,intm);,该函数的第一个参数是执行该类对象的一个指针即this指针。由于这个参数是系统隐含的,所以我们在定义该成员函数时并没有看到这样一个参数。在成员函数的定义体中,可以通过this访问这一参数。上述程序的最后输出结果是15。

第3题:

若有以下程序: include usingnamespace std; class Sample { private: const int n;

若有以下程序:

include <iostream>

using namespace std;

class Sample

{

private:

const int n;

public:

Sample(int i) :n(i) {)

void print()

{

cout<<"n="<<n<<end1;

}

};

int main()

{

sample a(10);

a.print();

return 0;

}

上述程序运行后的输出结果是【 】。


正确答案:n=10
n=10 解析:本题考核常成员数据的应用。类Sample中,定义了一个常数据成员n,所以构造函数只能通过初始化列表来初始化它。

第4题:

若有以下程序:includeusing namespace std;class sample{private:int n;public:sampl

若有以下程序: #include<iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp() { cout<<"n"=<<n<<end1; } }; int main() { sample s(10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是

A.n=10

B.n=5

C.n=15

D.n=20


正确答案:C
解析:本题考核this指针的应用。上述程序中sample类定义了一个addvalue非静态成员函数。addvalue函数的原型是:voidaddvalue(sample*this,intm);,该函数的第一个参数是执行该类对象的一个指针即this指针。由于这个参数是系统隐含的,所以我们在定义该成员函数时并没有看到这样一个参数。在成员函数的定义体中,可以通过this访问这—参数。上述程序的最后输出结果是15。

第5题:

当Form_Click事件发生时,程序输出的结果是 ______。 Private Sub Form. Click() Dim a As Integer,b As Integer,c As Integer a=1: b=1 Print a; b Do c=a+b Print c a=b:b=c Loop Until c>=5 End Sub

A.1 1 1

B.2 3 5

C.2 5 7

D.2 3 4


正确答案:B
解析:当发生窗体单击事件时,首先给变量a和b赋值1,然后输出为11,并换行,执行循环,c值为2,输出2后不换行,进行赋值后a为1,b为2,判断“c>=5”为False,继续执行下一循环。第二次循环输出c值为3,循环终止条件仍为False。第三次执行后,c值为5,循环终止条件为True,循环退出。因此输出的第二行为“235”。

第6题:

有以下程序

inculde <stdio.h>

main()

{ int m,n;

scanF(“%d%d”,&m&n);

While(m!=n)

{ While(m>n)m=m-n;

While(m<n)n=n-m;

}

PrintF(“%d\n”,m);

}

程序运行后,当输入14 63<回车>时,输出结果是【 】。


正确答案:7
7 解析:执行while(m<n)的循环,得到m=14,n=7,然后执行while(m>n)的循环,得到m=7,n=7。此时所有循环结束,m=7。

第7题:

当发生Form_ Click 事件后,下面这段程序代码的执行结果为在窗体中输出______。 Option Explicit Private Sub Form. Click () Dim num As String * 1, n As Integer Open "C:\ Check. txt" For Random As #10 For n = 1 To 6 num = Chr(n + 64) Put %10, n, num Next n Seek #10, 3: Get #10, , num Print Loc(10); Seek(10) End Sub

A.3 4

B.4 5

C.5 3

D.3 3


正确答案:A

第8题:

程序的输出结果是【 】。 include using namespace std; class A{ public: A(){a=b=2;}

程序的输出结果是【 】。

include <iostream>

using namespace std;

class A{

public:

A(){a=b=2;}

A(int i,int j){a=i;b=j;}

void display(){cout<<a<<b;}

private:

int a,b;

};

void main(){

A m,n(4,8);

m.display();

n.display();

}


正确答案:2248
2248 解析:m对象使用和默认的构造函数,其a与b变量的值均为2;而n变量使用4和8来初始化程序的变量,a,b的值为4和8,依次输出的结果为2248。

第9题:

( 8 )有以下程序

#include <stdio.h>

main ()

{ int m,n;

scanf ( " %d%d " ,&m,&n ) ;

while ( m!=n )

{ while ( m>n ) m=m-n;

while ( m<n ) n=n-m;

}

printf ( " %d\n " ,m ) ;

}

程序运行后,当输入 14 63 < 回车 > 时,输出结果是 【 8 】 。


正确答案: