7、【
单选题
】 点A、B的坐标分别为(100,100)、(300,300),当点A、B的颜色值分别为0xFFFFFF、0xFF0000时,就点击(200,200)。代码为:
if ________ then
touchdown(0, 200, 200)
mSleep(100)
touchup(0)
end
横线处应填写的代码为
[5分]
、
getColor(100,100) = 0xFFFFFF and getColor(300,300) = 0xFF0000
、
getColor(100,100) == 0xFFFFFF or getColor(300,300) == 0xFF0000
、
getColor(100,100) = 0xFFFFFF or getColor(300,300) = 0xFF0000
、
getColor(100,100) == 0xFFFFFF and getColor(300,300) == 0xFF0000
答案:
8、【
单选题
】 获取设备ID,若为“ABCD”,则提示“验证成功”。代码为:
if ________ then
notifyMessage('验证成功', 3000)
end
横线处应填写的代码为
[5分]
、
getDeviceID() == 'ABCD'
、
getDeviceID == 'ABCD'
、
getDeviceID() == ABCD
、
getDeviceID == ABCD
答案:
9、【
单选题
】 若要开始播放触摸精灵脚本,只需在选择要播放的脚本及播放方式后按下
[5分]
、
Home键
、
音量键
、
电源键
、
Home键 + 音量键
答案:
10、【
单选题
】 用户在脚本配置界面设置i_max,当i大于或等于i_max时,提示“完成”。代码为:
UI = {
{ 'InputBox{3}','i_max','局数:'},
}
function main()
i = 3
if __________ then
notifyMessage('完成', 3000)
end
end
横线处应填写的代码为
[5分]
、
i >= i_max
、
i > i_max or i = i_max
、
i >= tonumber(i_max)
、
i > tonumber(i_max) and i == tonumber(i_max)
答案:
11、【
填空题
】 function ff(a)
if a % 2 == 0 then
return 3 * a
else
return 2 * a
end
end
a = 1
a = a + 1
for i = 1, 3 do
a = a + i
a = ff(a)
end
a 的结果为
[每空5分]
解析: UI = {
{ 'TextView{方程:ax^2 + bx + c = 0}'},
{ 'InputBox{}','a','a:'},
{ 'InputBox{}','b','b:'},
{ 'InputBox{}','c','c:'},
}
function main()
if a == '' or b == '' or c == '' then
notifyMessage('请输入参数的值!', 3000)
else
a, b, c = tonumber(a), tonumber(b), tonumber(c)
if a == nil or b == nil or c == nil then
notifyMessage('参数输入不合法!', 3000)
else
if a == 0 then
if b ~= 0 then
x1 = -1 * (c/b)
notifyMessage(string.format('x = %.2f', x1), 3000)
else
notifyMessage('方程没有根', 3000)
end
else
del = b*b - 4*a*c
if del >= 0 then
x1 = ( -1*b + math.sqrt(del)) / (2*a)
x2 = ( -1*b - math.sqrt(del)) / (2*a)
notifyMessage(string.format('x1 = %.2f , x2 = %.2f', x1, x2), 3000)
else
notifyMessage('方程没有根', 3000)
end
end
end
end
end