首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设a、b都是自然数,为求a除以b的余数,某人编写了以下函数: Function fun(a As Integer,b As Integer) While a>b a=a-b Wend fun=a End Function 在调试时发现函数是错误的。为使函数
设a、b都是自然数,为求a除以b的余数,某人编写了以下函数: Function fun(a As Integer,b As Integer) While a>b a=a-b Wend fun=a End Function 在调试时发现函数是错误的。为使函数
admin
2019-01-17
24
问题
设a、b都是自然数,为求a除以b的余数,某人编写了以下函数:
Function fun(a As Integer,b As Integer)
While a>b
a=a-b
Wend
fun=a
End Function
在调试时发现函数是错误的。为使函数能产生正确的返回值,应做的修改是
选项
A、把a=a-b改为a=b-a
B、把a=a-b改为a=a\b
C、把While a>b改为While a<b
D、把While a>b改为While a>=b
答案
D
解析
本题函数过程的原代码仅适合a不能被b整除的两数,而当a能被b整除时则不适用,如a=4,b=2,a除以b的余数为0,而原代码返回的函数值为2。因此需将语句While a>b改为While a>=b。
转载请注明原文地址:https://kaotiyun.com/show/nMFp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
在窗体上画一个文本框(名称为Text1)和一个标签(名称为Label1),程序运行后,在文本框中每输入一个字符,都会立即在标签中显示文本框中字符的个数。以下可以实现上述操作的事件过程是( )。
有三个关系R、S和T如下:则关系T是由关系R和S通过某种操作得到,该操作为( )。
耦合性和内聚性是对模块独立性度量的两个标准。下列叙述中正确的是( )。
下列叙述中正确的是
现有如下语句:x=IIf(a>50,Int(a\3),aMod2)当a=52时,x的值是( )。
已知a=6,b=15,c=23,则语句PrintSgn(a+bMod6-c\a)&a+b的输出结果为( )。
设:a=2,b=8,c=6,d=3,表达式a>bAndNot(c>d)Ord>c的值是
设循环队列存储空间为Q(1:50)。初始状态为front=rear=50。经过一系列入队和退队操作后,front=14,rear=19,则该循环队列中的元素个数为
设数据元素集合为{A,B,C,D,E,F},下列关系为线性结构的是
随机试题
根据《公安机关督察条例》,督察机构在现场督察中发现公安机关的人民警察违法违纪,必要时可以带离现场的情形有()。
冲突管理中合作策略的基本观点包括()
图示结构Mc影响线已作出,如图所示,其中竖标yE是()。
肺气肿患者不具有下列哪项体征
纤溶活性增强的筛选试验
下列关于沥青密度与相对密度试验的说法,请回答以下问题。试验所涉及的主要仪器与材料有()。
平面控制网布设的原则不包括( )。
该公司进口环节应缴纳的关税、消费税、增值税合计为( )。该公司加工环节应代扣代缴的消费税、城市维护建设税和教育费附加总和为( )。
Levy-YeyatiSturzenegger的分类(LYS分类)是基于事实上的分类,它有三个分类变量。下列选项不属于其中的是()。
Itwouldbeinterestingtodiscoverhowmanyyoungpeoplegotouniversitywithoutanyclearideaofwhattheyaregoingtodoa
最新回复
(
0
)