試題一(每小題2分,共10分)
閱讀下列程式說明和程式,在每小題提供的若干可選答案中,挑選乙個正確答案。
【程式說明】
過程jisuan用於計算s=1+1/2!-1/3!+1/4!+…-1/9!+1/10!的值,並用訊息框顯示結果。
【程式】
option explicit
private sub jisuan()
dim k as integer, f as long, fh as integer, (1)
s = 1 : (2) : fh = 1
for k = 2 to 10
s = s + fh / f : (3) : f = (4)
next k
(5)end sub
【供選擇的答案】
(1) a、s as integer b、dim s as integer c、dim s as single d、s as single
(2) a、f = 1 b、f = 2 c、f= -1 d、f = -2
(3) a、fh= 1 b、fh= -1 c、fh = -fh d、fh= (-1)^k
(4) a、f * k b、f * (k+1) c、f * 3 d、f * (k+2)
(5) a、msgbox 「1+1/2!-1/3!+1/4!+…-1/9!+1/10!的和為:」 & f
b、msgbox 「1+1/2!-1/3!+1/4!+…-1/9!+1/10!的和為:」 + f
c、msgbox 「1+1/2!-1/3!+1/4!+…-1/9!+1/10!的和為:」 + s
d、msgbox 「1+1/2!-1/3!+1/4!+…-1/9!+1/10!的和為:」 & s
試題二(每小題2分,共16分)
閱讀下列程式說明和程式,在每小題提供的若干可選答案中,挑選乙個正確答案。
【程式說明】
程式介面如下圖所示,程式執行時要求有以下功能:
單擊按鈕command1,生成十個[100,999]之間的隨機整數,然後對這些數按數字之和進行公升序排列並顯示在窗體上。例如:112的數字之和為4,621的數字之和為9,360的數字之和為9,371的數字之和為11……,因此按下圖所示順序排列。
函式calcnumber用於計算數n各數字之和。
【程式】
private sub command1_click()
dim a(1 to 10) as integer, b(1 to 10) as integer
dim k as integer, j as integer, p as integer, t as integer
for k = 1 to 10
a(k) = (6) : b(k) = (7)
next k
for k = 1 to 9
p = k
for j = (8)
if (9) then p = j
next j
t = a(p): a(p) = a(k): a(k) = t : t = b(p): b(p) = b(k): b(k) = t
(10)
next k
print a(10)
end sub
function calcnumber(byval n as integer) as integer
dim s as string, l as integer, r as integer, k as integer
s = (11) : l = len(s)
for k = 1 to l
r = r + (12)
next k
(13)
end function
【供選擇的答案】
(6) a、int(rnd*899)+100b、int(rnd(900))+100
c、int(rnd(899)+100d、fix(rnd*900)+100
(7) a、call calcnumber(a(k)) b、call calcnumber a(k)
c、calcnumber(a(kd、calcnumber a(k)
(8) a、k to 9 b、k+1 to 10 c、1 to 10-k d、p+1 to 9
(9) a、a(k)>a(j) b、a(p)>a(j) c、b(k)>b(j) d、b(p)>b(j)
(10) a、print a(k); b、print a(j); c、print t d、print a(p);
(11) a、str(n) b、chr(n) c、trim(str(n)) d、string(n)
(12) a、asc(left(s,kb、asc(mid(s,k,1))
c、val(left(s,kd、val(mid(s,k,1))
(13) a、r = calcnumber(nb、calcnumber = r
c、r = calcnumberd、calcnumber(n) = r
試題三(每小題2分,共8分)
閱讀下列程式說明和程式,在每小題提供的若干可選答案中,挑選乙個正確答案。
【程式】
dim x as integer
private sub form_click()
x = x + 2
call proc1(x) '(1)
print x;
end sub
sub proc1(a as integer) '(2)
dim x as integer '(3)
a = x + 2
end sub
【供選擇的答案】
(14) 單擊窗體兩次後,窗體上顯示的內容是什麼?
a、0 0 b、2 2 c、2 4 d、4 8
(15) 其它**不變,僅將程式中的語句(2)改成sub proc1(byval a as integer),單擊窗體兩次後,窗體上顯示的內容是什麼?
a、0 0 b、2 2 c、2 4 d、4 8
(16) 其它**不變,僅將程式中的語句(3)刪除,單擊窗體兩次後,窗體上顯示的內容是什麼?
a、0 0 b、2 2 c、2 4 d、4 8
(17) 其它**不變,僅將程式中的語句(1)改為call proc1(x+2),單擊窗體兩次後,窗體上顯示的內容是什麼?
a、0 0 b、2 2 c、2 4 d、4 8
試題四(每小題2分,共14分)
閱讀下列程式說明和程式,在每小題提供的若干可選答案中,挑選乙個正確答案。
【程式說明】
程式介面如上面兩圖所示,程式執行時要求有以下功能:
1. 當使用者向文字框text1中輸入內容後按回車鍵,若輸入的內容在列表框中已存在,則給出提示,否則將該內容新增到列表框末尾,並自動將文字框中的內容選中。
2. 當使用者單擊「刪除」按鈕,若列表框中沒有表項被選中,則用訊息框提示「先選擇,後刪除」,否則刪除被選中的表項。
【程式】
private sub text1_ (18)
dim c as string, k as integer, s as string
if (19) then exit sub
c = trim(
if c <> "" then
for k = 0 to - 1
s = (20)
if s = c then (21)
next i
if k > - 1 then
22) : =0 : (23)
else
msgbox "字串" + c + "已存在!"
end if
end if
end sub
private sub command1_click()
if = -1 then msgbox "先選擇,後刪除" else (24)
end sub
【供選擇的答案】
(18) a、keypress(keyascii as integer) b、change(keyascii as integer)
c、changed、keypress(keyascii as string)
(19) a、keyascii =13b、keypress =13
c、keypress<>13d、keyascii<>13
(20) a、
c、(21) a、exit sub b、exit for c、exit do d、end
(22) a、 c, b、 c; k
c、 c, 0d、 c, k
(23) a、 = len(
b、 = len(
c、 =
d、 =
VB考前輔導模擬試卷
試題一 每小題2分,共10分 閱讀下列程式說明和程式,在每小題提供的若干可選答案中,挑選乙個正確答案。程式說明 過程jisuan用於計算s 1 1 2 1 3 1 4 1 9 1 10 的值,並用訊息框顯示結果。程式 option explicit private sub jisuan dim k ...
VB模擬試卷一
visual basic程式設計 100分 一 填空題 每空1分,共10分 1.表示x是5的倍數或9的倍數的邏輯表示式是 2.已知a 3.5,b 5.0,c 2.5,d true,則表示式a 0 and a c b 3 or not d的值是 3.表示式ucase mid abcdefgh 3,4 ...
VB千道選擇 考綱以及模擬試卷
3 下面的 b 控制項不具備caption屬性 a 標籤 b 文字框 c 命令按鈕 d 單選按鈕 4 若要使使用者不能修改文字框textbox1中內容,應修改 a 屬性 a locked b multiline c passwardchar d scrollbar 6.若要求從文字框中輸入密碼時在文...