设有如下程序: Option Base 1 Private Sub Form. Click( ) Dim a(5)As String,i As Integer For i=1 To 5 a(i)=Chr(Asc("A")+i) Call f(a,i) Next i End Sub Sub f(ta( )As String,n As.Integer) Dim i As Integer For i=1 To n Print ta(i); Next i Print End Sub 对上述程序.以下叙述中正确的是( )。
A.程序有错,因为在过程f的定义中数组参数格式不正确
B.程序可正常运行,输出内容的第一行是一个字母“A”
C.程序可正常运行,输出内容的第一行是一个字母“B”
D.程序可正常运行,输出内容的第一行是数字65
第1题:
设有如下程序:
Private Sub Form. Click( )
Dim ary(1 To 5)As Integer
Dim i As Integer
Dim sum As Integer
For i=1 To 5
ary(i)=i+l
sum=sum+ary(i)
Next i
Print sum
End Sub
程序运行后,单击窗体,则在窗体上显示的是( )。
A.15
B.16
C.20
D.25
第2题:
下面程序的打印结果是【 】。
include <iostream>
using namespace std;
class Base
{
public:
Base(int x)
{
a=x;
}
void show()
{
cout<<a;
}
private:
int a;
};
class Derived : public Base
{
public:
Derived(int i) :Base(i+1) ,b(i) { }
void show()
{
cout<<b;
}
private:
int b;
};
int main ( )
{
Base b(5) , *pb;
Derived d(1);
pb=&d;
pb->show();
return 0;
}
第3题:
设有如下程序:
Private Sub Form_Click()
Dim ary(1 To 5)As Integer
Dim i As Integer
Dim sum As Integer
For i=1 To 5
ary(j)=i+1
sum=sum+ary(i)
Next 1
Print sum
Eud Sub
程序运行后,单击窗体,则在窗体上显示的是
A.15
B.16
C.20
D.25
第4题:
有如下程序:#include <iostream>using namespace std;class Base{private: char c;public: Base(char n):c(n){} ~Base() { cout<<c; }};class Derived: public Base{private: char c;public: Derived(char n):Base(n+1),c(n){} ~Derived() { cout<<c; }};int main(){ Derived obj('x'); return 0; }执行上面的程序将输出( )。
A.xy
B.yx
C.x
D.y
第5题:
有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, "Base"); } virtual char *myName() {
A.DerivedBase
B.BaseBase
C.DerivedDerived
D.BaseDerived
第6题:
有如下程序; #include <iostream> using namespace std; class Base { public; Base(inti){x=i;} void dispa0{cout<<x<<',';} private; int x; }; class Derived;public Base { public; Derived(int i);Base(i+10) {x=i;) void dispb(){dispa();cout<<x<<end1;} private; int x; }; int main() { Derived b(2) ; b.dispb(); return 0; } 运行的结果是( )。
A.2,2
B.12,2
C.12,10
D.10,2
第7题:
在窗体上面一个名称为Commandl的命令按钮,然后编写如下程序: Option.Base 1 Private Sub Command1_Click() Dim a As Variant a=Array(1,2,3,4,5) Sum = 0 For i = 1 To 5 Sum=Sum+a(i) Next i x=Sum/5 For i=1 To 5 If a(i) >x Then Print a(i); Next i End Sub 程序运行后,单击命令按钮,在窗体上显示的内容是
A.1 2
B.1 2 3
C.3 4 5
D.4 5
第8题:
有如下程序: #include<iostream> using namespace std; class Base { private: char c; piblic: Base(char n):c(n){} ~Base() { cout<<C; } }; class DeriVed:public Base { private: char c; public: Derived(char n):Base(n+1),c(n){} ~Derived() { cout<<c; } }; int main() { Derived obj('x'); return 0; } 执行上面的程序将输出
A.xy
B.yx
C.x
D.y
第9题:
有如下程序:#include <iostream>using namespace std;class Base{private: char c;public: Base(char n) :c(n){} ~Base() { cout<<c; } };class Derived: public Base{private: char c; public: Derived(char n):Base(n+1),c(n) {} ~Derived() { cout<<c; }};int main (){ Derived obj ('x'); return 0;}执行上面的程序净输出
A.xy
B.yx
C.x
D.y
第10题:
有以下程序: #inClUde <iostream> using namespace std; Class Base { public: Base(int x) { a=x; } void show() { cout<<a; } private: int a; }; class Derived : public Base { public: Derived(int i) :Base(i+1),b(i){} void Show() { cout<<b; } private: int b; }; int main() { Base b(5),*pb; Derived d(1); pb=&d; pb->show(); return 0; } 运行后的输出结果是( )。
A.1
B.5
C.2
D.0