有如下的程序。Private Sub Command1_Click()Dim k As Integer, m As IntegerDim P As Integerk=4: m=1P=Fun(k, m) : Print P;P=Fun(k, m) : Print PEnd SubPrivate Function Fun(a As Integer, b As Integer)Static m As Integer, i As Integerm=5: i=2i=i + m + 1m=i + a + bFun=m \ 2End Function单击命令按钮后,输出结果为A.2 2B.4 4C.5 5D.6 6

有如下的程序。

Private Sub Command1_Click()

Dim k As Integer, m As Integer

Dim P As Integer

k=4: m=1

P=Fun(k, m) : Print P;

P=Fun(k, m) : Print P

End Sub

Private Function Fun(a As Integer, b As Integer)

Static m As Integer, i As Integer

m=5: i=2

i=i + m + 1

m=i + a + b

Fun=m \ 2

End Function

单击命令按钮后,输出结果为

A.2 2

B.4 4

C.5 5

D.6 6


相关考题:

下列程序中,实现将封装数据类型Integer和基本数据类型int之间的转换,以及Integer,int类型和String类型之间的转换。请将程序补充完整。程序运行结果如下:123456456public class ex7_1{public static void main(String[]args) {Integer intObj;int n;String s;intObj = new Integer(123);n=intObj.__________;System.out.printin(Integer.toString(n));s=new String("456");intObj=Integer._________;System.out.println(intObj.__________);n=Integer.parseInt(s);System.out.println(Integer.toString(n));}}

如果Add函数的调用代码为:func main() {var a Integer = 1var b Integer = 2var i interface{} = asum := i.(Integer).Add(b)fmt.Println(sum)}则Add函数定义正确的是() A.type Integer intfunc (a Integer) Add(b Integer) Integer { return a + b}B.type Integer intfunc (a Integer) Add(b *Integer) Integer { return a + *b}C.type Integer intfunc (a *Integer) Add(b Integer) Integer { return *a + b}D.type Integer intfunc (a *Integer) Add(b *Integer) Integer { return *a + *b}

下列程序的运行结果为______。 #define MS DOS #ifdef MS DOS #define INTEGER SIZE 32 #else #define INTEGER SIZE 16 #endif main () { printf ("integer_size=%d\n", INTEGER_SIZE); }A.integersize=32B.integer_size=16C.integersize=32,integer_size=16D.错误

最小生成树A.Prim算法:procedure prim(v0:integer);varlowcost,closest:array[1..maxn] of integer;i,j,k,min:integer;

E.堆排序:procedure sift(i,m:integer);{调整以i为根的子树成为堆,m为结点总数}var k:integer;

组合的生成(1..n中选取k个数的所有方案)procedure solve(dep,pre:integer);vari:integer;

折半查找function binsearch(k:keytype):integer;var low,hig,mid:integer;

设有如下定义:typedefint*INTEGER;INTEGERp,*q;则()是正确的叙述。 A.p是int型变量B.q是基类型为int的指针变量C.p是基类型为int的指针变量D.程序中可用INTEGER代替int类型名

8、下面哪些是将分数化为浮点数的正确定义?A.type Fraction = (Integer, Integer) rateq :: Fraction - Float rateq (a,b) = a/b###SXB###B.type Fraction = (Integer, Integer) rateq :: Fraction - Float rateq (a,b) = (fromInteger a)/ (fromInteger b)###SXB###C.type Fraction = (Integer, Integer) rateq :: Fraction - Float rateq (a,b) = fromInteger (a/b)###SXB###D.type Fraction = (Integer, Integer) rateq :: Fraction - Float rateq (a,b) = (fromIntegral a)/ (fromIntegral b)###SXB###E.ty

11、下面哪些定义是类型正确的?A.f :: (Integer, Integer) - Float f (x,y) = x / yB.f :: (Integer, Integer) - Float f (x,y) = (fromInteger x) / (fromInteger y)C.f :: (Integer, Integer) - Float f (x,y) = 3*x + yD.f :: (Integer, Integer) - Integer f (x, y) = 3*x + y