问答题If x is an integer, is (18+54)/x an integer?  (1) 18<x<54  (2) x is a multiple of 18

题目
问答题
If x is an integer, is (18+54)/x an integer?  (1) 18<x<54  (2) x is a multiple of 18
参考答案和解析
正确答案: C
解析:
若18<x<54,当x=36时,该式为整数,当x=37时,该式不为整数;条件2也不能确定该式的值;将两条件相结合,可知x=36,原式为整数,故本题选C项。
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

在窗体上画1个命令按钮,其名称为Command1,然后编写如下程序: Private Sub Command1 Click() Dim a(10) As Integer Dim x As Integer For i=1 To 10 a(i)=8+i Next x=2 Print a(f(x)+x) End Sub Function f(x As Integer) x=x+3 f=x End Function 程序运行后,单击命令按钮,输出结果为______。

A.12

B.15

C.17

D.18


正确答案:D
解析:函数f的作用是将x的值加3(由于Vb中默认的参数传递方式为ByRef,故对形参的改变将影响到实参),同时将该值作为函数的结果返回。由于开始时x的值为2,执行f(x)后,x的值为5,f(x)的结果亦为5。故最后输出的结果应为a(10),而在for循环中a(10)=8+10=18。

第2题:

执行以下程序段

Dim i As Integer, x As Integer

x = 0

For i = 20 To 1 Step -2

x = x + i \ 5

Next

Print x

后,x的值为( )。

A.16

B.17

C.18

D.19


正确答案:C

第3题:

单击命令按钮执行下列程序,其输出结果是。 Private Sub Commana1_Click() Dim a As Integer,b As Integer,c As Integer a = 3 b = 4 c = 5 Print SecProc(c,b,a) End Sub Function FirProc(x As Integer,y As Integer,z As Integer) FirProc = 2 * x + y + 3 * z End Function Function SecProc(x As Integer,y As Integer,z As Integer) SecProc = FirProc(z,x,y) + x End FunctionA. 20 B. 22 C. 28 D. 30


正确答案:C
【解析】本题是在Commana1过程中调用SecProc函数,而在SecProc函数中又调用了FirProc函数。函数调用时,实参和形参要一一对应传递。程序运行过程是:①Print SecProc(c,b,a)→Print SecProc(3,5,4);②SecProc = FirProc(z,x,y) + x→SecProc = FirProc(3,5,4) + 5;③FirProc = 2 * x + y + 3 * z→FirProc = 2 * 3 + 5 + 3 * 4=23;④SecProc = 28→Print SecProc(c,b,a)→Print28.形参是在被调用的Sub、Function过程中定义的参数名;实参则是在调用的Sub或Function过程中定义的参数名。

第4题:

单击命令按钮时,下列程序的执行结果是

Private Sub Command1_Click()

Dima As Integer,b As Integer,c As Integer

a=3:b=4:c=5

Print SecProc(c,b,A)End Sub

Function FirProc(x As Integer,y As Integer,z As Integer)

FirProc=2*x+y+3*z+2

End Function

Function SecProc(x As Integer,y As Integer,z As Integer)

SecProc=FirProc(z,x,y) +x+7

End Function

A.20

B.25

C.37

D.32


正确答案:C
解析:此题程序代码中用了嵌套调用,我们对这样的问题要多加小心,千万不要把实参和相对应的形参弄混。主调过程Commandl_Click输出的是SecProc(c,b,A)的返回值,调用过程SecProc时,主调过程分别把实参c、b、a地址传给形参x、y、z,此时在过程SecProc中,SecProc=FirProc(a,c,B)+7。由此看出,程序段执行此语句时,将调用过程FirProc。把实参a,c,b的地址分别传给形参x、y、2,此时在过程FirProc中,FirProc=2*x+y+3*z+2,所以FirProc(a,c,B)=6+4+15 +2=27,SecProc(a,c,B)=27+3+7=37。

第5题:

单击命令按钮时,下列程序代码的执行结果为( )。 Private Function FirProc(x As Integer,y As Integer,z As Integer) FirProc=2*x+y+3*z End Funcfion Private Function SecProc(x As Integer,y As Integer,z As Integer) SecProc=FirProc(z,x,y)+x End Funcfion Private Sub Command1_Click() Dim a As Integer Dim b As Integer Dim c As Integer a=2 b=3 c=4 Printf SecProc(c,b,a) End Sub

A.21

B.19

C.17

D.34


正确答案:A

第6题:

执行以下程序段 Dim i As Integer,X As Integer x=0 For i=20 To 1 Step -2 x=x+i\5 Next Print x 后,x的值为______。

A. 16

B.17

C.18

D.19


正确答案:C
解析:For循环语句中;Step是表示步长,即循环计数器变化的幅度。本题中i每次减2,故要执行10次循环。而“\”是整除运算符,故当i=20时,x加4,当i等于18、16时,x都加3,当i等于14、12、10时,x都力D 2,当i等于8、6时,x加1,当i等于4、2时,x都加0。所以x=4+3+3+2+2+2+1+1=18。

第7题:

下列程序运行后,单击命令按钮,窗体显示的结果为( )。 Private Function pl(x As Integer,y As Integer,z As Integer) pl=2*x+y+3*z End Function Private Function p2(X As Integer,y As Integer,z As Integer) p2=p1(z,y,x)+x End Function Private Sub Commandl_Click()

A.23

B.19

C.21

D.22


正确答案:A

第8题:

单击命令按钮时,下列程序的执行结果为

Private Sub Command1_Click()

Dim a As Integer, b As Integer, c As Integer

a=2: b=3: c=4

Print P2(c, b, A.

End Sub

Private Function P1(x As Integer, y As Integer, z As Integer)

P1=2 * x + y + 3 * z

End Function

Private Function P2(x As Integer, y As Integer, z As Integer)

P2=P1(z, x, y) + x

End Function ( )。

A.21

B.19

C.17

D.34


正确答案:A

第9题:

执行以下程序段后,x的值为( )。 Dim x As Integer,i As Integer x=0 For i=20 To 0 Step -2 x=x+i\5 Next i

A.16

B.17

C.18

D.19


正确答案:C

第10题:

单击命令按钮时,下列程序的执行结果为 Private Sub Command1_Click() Dim a As Integer,b As Integer,c As Integer a=2:b=3:C=4 Print P2(c,b,A)End Sub Private Function P1(x As Integer,y As Integer,z As Integer) P1=2 * X + y + 3 * z End Function Private Function P2(x As Integer,y As Integer,z As Integer) P2=P1(z,x,y) + X End Function

A.21

B.19

C.17

D.34


正确答案:A
解析:对于多个过程或函数依次调用和处理与简单过程调用处理一样,本题先调用函数P2,而函数P2又调用函数P1,结果返回的顺序是从P1到P2,P2计算后输出到调用的地方。

更多相关问题