VB期末複習2 無答案

2023-01-05 03:00:03 字數 3279 閱讀 4534

《vb程式設計》期末複習2

試題一、判斷題(每小題1分,共10分)

說明:在以下提供的若干陳述中,逐一判斷其正確與否,用a表示正確,用b表示錯誤。

試題二、單選題(每小題1分,共10分)

試題三、程式填空題(每空2分,共20分)

說明:閱讀下列程式說明和相應程式,在每小題提供的若干可選答案中,挑選乙個正確答案。

程式1【程式說明】某檔案中存放了若干個實數,單擊command1可用對話方塊開啟該檔案、並將讀入的所有資料在list1中顯示,單擊command2可將讀入的資料按值從大到小順序重新寫入到該檔案。

【程式】

private sub command1_click()

dim x as single

commondialog121)

open for22as #1

do while23)

input #1, x: x

loop

close #1

end sub

private sub command2_click()

dim n as single, x as single, i as integer, j as integer, k as integer

n = list124)

redim a(n) as single

for i = 1 to n: a(i) = - 1): next i

for i = 1 to n - 1

k = i

for j = i + 1 to n

if25then k = j

next j

x = a(k): a(k) = a(i): a(i) = x

next i

open for output as #1

for i = 1 to n: print #1, a(i): next i

close #1

end sub

【選項】

(21) [a] showopen [b] filename [c] action [d] open

(22) [a] output [b] input [c] append [d] read

(23) [a] eof(1) [b] not eof(1) [c] eof(fn) [d] not eof(fn)

(24) [a] count [b] listcount – 1 [c] list [d] listcount

(25) [a] a(j) > a(k) [b] a(j) <= a(k) [c] a(j) <> a(k) [d] a(j) < a(k)

程式2【程式說明】統計滑鼠單擊**框控制項p1中兩個同心圓所圍成黑色區域的次數:首次單擊command1將統計結果清零、p1可用,再次單擊則以訊息框顯示統計結果、p1不可用。

【程式】

dim n as integer

private sub command1_click()

if = "開始" then

= "顯示"

= true: n = 0

else

= false: msgbox ("單擊該區域27次")

end if

end sub

private sub form_activate()

=(-3, 3)-(3, -3)

(0, 0), 2

= vbwhite: (0, 0), 1

end sub

private sub form_load()

= "開始": = false

end sub

private sub p1_mousedown(button as integer, shift as integer, x as single, y as single)

if x * x + y * y >= 1 and30then n = n + 1

end sub

【選項】

(26) [a] "退出" [b] "開始" [c] "顯示" [d] "開始"

(27) [a] n [b] val(n) [c] str(n) [d] trim(n)

(28) [a] 1 [b] 0 [c] 2 [d] 3

(29) [a] vbblack [b] rgb(255,0,0) [c] vbwhite [d] rgb(255,255,0)

(30) [a] x * x + y * y <= 4 [b] x > 2 and y > 2

[c] x * x + y * y <= 2 [d] x * x + y * y > 4

試題四、程式改錯題(每小題2分,共10分)

以下程式可以在查詢輸入框(text2)中輸入查詢內容,按「確定」按鈕後游標自動選定在文字框text1中第乙個找到的內容。程式執行效果如圖所示。在程式**中還存在5處錯誤,請寫出標示處對應的正確語句。

dim n as integer, i as integer

private sub command1_click()

n = len(

i = 0錯誤1 ***'

do until i <= len(錯誤2 ***'

if left( n) = then錯誤3 ***'

= i - 1

= 錯誤4 ***'

exit do

end if

i = i + 1

loop

if i > len( then

msgbox "沒找到" ; 錯誤5 ***'

= ""

end if

end sub

試題五、程式閱讀題(每小題5分,共40分)

程式1、請寫出當單擊窗體後,窗體上的顯示結果

private sub form_click()

dim a(1 to 2, 1 to 3) as integer, i as integer, j as integer

for i = 1 to 2

for j = 1 to 3

a(i, j) = i + j: print a(i, j),

next j

print

next i

end sub

程式2、閱讀下列程式,寫出程式執行後,依次單擊option1(0)、option1(1)和option1(2)後,窗體上的顯示結果。

vb複習題 題目答案

visual basic 期末複習題庫 單項選擇題判斷題填空題程式設計題 1 下列程式執行後,輸出的結果為 b 1do while b 40 b b b 1 loop print b a 42 b 39 c 6 d 1 答案 a 2 設執行以下程式段時依次輸入1 3 5,執行結果為 dim a 4 ...

期末總複習幾何證明與計算專題 無答案

石門實驗中學2005 2006學年度第二學期初二數學期末複習題 03 幾何的證明與計算專題複習 班級學號 姓名得分 1 同一時刻,某地一根高30m的旗桿的影長為40m,一樓房的影長為50m,則這樓房的高度為多少公尺?2 如果a b c 3 4 5,且a b c 36,求a,b,c的值。3 如圖,已知...

期末複習建議 2

數學複習建議姓名 1 認真複習第二章 有理數 第三章 字母表示數 第四章 一元一次方程 2張 第五章 圖形世界 第六章 平面圖形的認識 2張 以及3份期末模擬試卷。每題必須都會 2 導學 從p56看到結束 鞏固 從p61看到結束。每道題都看一遍,將錯題重新做一遍,加深記憶 3 看第五章和第六章的pp...