1樓:卡布裡de月光
(28)下面程式在除錯時出現了死迴圈
private sub command1_click()
n=inputbox(「請輸入一個整數」)
do if n mod 2=0 then
n=n+1
else
n=n+2
else if
loop until n=1000
end sub
下面關於死迴圈的敘述中正確的是
a) 只有輸入的n是偶數時才會出現死迴圈,否則不會
b) 只有輸入的n是奇數時才會出現死迴圈,否則不會
c) 只有輸入的n是大於1000的整數時才會出現死迴圈,否則不會
d) 輸入任何整數都會出現死迴圈
(29)在窗體上有1個名稱為commondialog1的通用對話方塊和1個名稱為command1的命令按鈕,以及其他一些控制元件。要求在程式執行時,單擊command1按鈕,則顯示開啟檔案對話方塊,並在選擇或輸入了1個檔名後,就可以開啟該檔案。以下是command1_click事件過程的兩種演算法
演算法1:
private sub command1_click()
commondialog1.showopen
open commondialog1.filename for input as#1
end sub
演算法2:
private sub command1_click()
commondialog1.showopen
ifcommondialog1.filename<>」」then
open commondialog1.filename for input as#1
end if
end sub
下面關於這兩種演算法的敘述中正確的是
a) 顯示開啟檔案對話方塊後若未選擇或輸入任何檔名,則演算法2會出錯,演算法1不會
b) 顯示開啟檔案對話方塊後若未選擇或輸入任何檔名,則演算法1會出錯,演算法2不會
c) 兩種演算法的執行結果完全一樣
d) 演算法1允許輸入的檔名中含有空格,而演算法2不允許
(30)窗體上有1個名稱為list的列表框,其中已經輸入了若干個專案(如圖所示):還有2個文字框,名稱分別為text1、text2, 1個名稱為command1的命令按鈕,並有以下程式
private sub command1_click()
dim str as string, s as string, k as integer
s=text1
str=」」
for k=list1.listcount-1 to 0 step-1
if instr(list.list(k),s)>0 then
str=str&list.list(k)&」 」
end if
next k
if str=」」then
text2=」沒有匹配的專案」
else
text2=str
end if
end sub
程式執行時,在text1中輸入「京」,單擊命令按鈕,則在text2中顯示的內容是
a) 京 b) 北京 南京
c) 南京 d) 沒有匹配的專案
(31)在窗體上畫1一個名稱為command1的命令按鈕,並編寫以下程式
private sub command1_click()
print fun(「abcdefg」)
end sub
function fun(st as string) as string
stlen=len(st)
temp=」」
for k=1 to stlen/2
temp=temp+mid(st,k,1)+mid(st,stlen-k+1,1)
next k
fun=temp
end function
程式執行時,單擊命令按鈕,則窗體上顯示的是
a)abcdefg b)agbfce c)gfedcba d)agbfced
(32)在窗體上先後畫2個**框,名稱分別為picture1和banana,banana中新增了香蕉**(見圖1),且將banana.dragmode屬性設定為1。要求程式執行時,可以用滑鼠把banana拖拽到picture1中(見圖2)。
能實現此功能的事件過程是
圖1 圖2
a) priate sub form_dragdrop(source as control,x as single,y as single)
banana.move picture1.left+x,picture1.top+y)
end sub
b)private sub banana _dragdrop(source as control,x as single,y as single )
source.move picture1.left+x.picture1.top+y
end sub
c) b)private sub picture1_dragdrop(source as control,x as single,y as single )
source.move picture1.left+x.picture1.top+y
end sub
d) b)private sub picture1_dragdrop(source as control,x as single,y as single )
banana.move banana.left+x, banana.top+y
end sub
(33)在窗體上畫1個名稱為command1的命令按鈕,然後編寫如下事件過程
option base 1
pribate sub command1_click()
dim a(5,5) as integer
for i=1 to 5
for j=1 to 5
a(i,j)=(i+j)*5\10
next j
next i
s=0for i=1 to 5
s=s+a(i,i)
next i
print s
end sub
程式執行後,單擊命令按鈕,輸出結果是
a) 15 b)13 c)11 d)9
(34)在窗體上從左到右有text1、text2兩個文字框(見圖),要求程式執行時,在text1中輸入1個分數後按回車鍵,則判斷分數的合法性,若分數為0~100中的1個數,周圍游標移到text2中;否則游標不動,並彈出對話方塊顯示「分數錯」,下面程式中正確的是
a)private sub text1__keypress(keyascii as integer)
if keyascii=13 then 『回車符的acsii碼是13
a=val(text1)
if a>=0 or a<=100 then
text2.setfocus
else
text1.setfocus: msgbox(「分數錯」)
end if
end if
end sub
b) private sub text1__keypress(keyascii as integer)
if keyascii=13 then 『回車符的acsii碼是13
a=val(text1)
if a>=0 and a<=100 then
text1.setfocus
else
text2.setfocus: msgbox(「分數錯」)
end if
end if
end sub
c) private sub text1__keypress(keyascii as integer)
if keyascii=13 then 『回車符的acsii碼是13
a=val(text1)
if a<0 and a>100 then
text2.setfocus
else
text1.setfocus: msgbox(「分數錯」)
end if
end if
end sub
d) private sub text1__keypress(keyascii as integer)
if keyascii=13 then 『回車符的acsii碼是13
a=val(text1)
if a>=0 and a<=100 then
text2.setfocus
else
text1.setfocus: msgbox(「分數錯」)
end if
end if
end sub
(35)在窗體上畫2個命令按鈕,名稱分別為command1、command2,並編寫如下程式
const n=5,m=4
dim a(m,n)
private sub command1_click()
k=1for i=1 to m
for j=1 to n
a(i,j)=k
k=k+1
next j
next i
end sub
private sub command2_click()
summ=0
for i=1 to m
for j=1 to n
if i=1 or i=m then
summ=summ+a(i,j)
else
if j=1 or j=n then
summ=summ+a(i,j)
end if
end if
next j
next i
print summ
end sub
過程command1_click()的作用是二維陣列a 中存放1個 m行n列的矩陣;過程command2_click()的作用是
a) 計算矩陣外圍一圈元素的累加和
b) 計算矩陣除外一圈以外的所有元素的累加和
c) 計算矩陣第1列和最後一列元素的累加和
d) 計算矩陣第1行和最後一行元素的累加和
二、填空題(每空2分,共30分)
請將每一個空的正確答案寫在答題紙上~序號的橫線上,答在試卷上,答在試卷上不得分。
(1)在深度為7的滿二叉樹中,度為2的結點個數為______。
(2)軟體測試分為白箱(盒)測試和黑箱(盒)測試,等價類劃分法屬於_______ 測試。
(3)在資料庫系統中,實現各種資料管理功能的核心軟體稱為 資料庫管理系統_________
(4)軟體生命週期可分為多個階段,一般分為定義階段、開發階段和維護階段。編碼和測試屬於 ____階段。
(5)在結構化分析使用的資料流圖(dfd)中,利用 _____ 對其中的圖形元素進行確切解釋。
(6)下面程式的功能是從鍵盤輸入1個大於100的整數m,計算並輸出滿足不等式的最大的n。請填空
private sub command1__click()
dim s ,m,n as integer
m=val(inputbox(「請輸入一個大於100的整數」))
n= ___________
s=0do while s n=n+1 s=s+n*n loop print 「滿足不等式的最大n是」: __________ end sub (7)下面程式的功能是把檔案file1.txt中重複字元去掉後(即若有多個字元相同,則只保留1個)寫入檔案file2.txt。請填空。 private sub command1__click() dim inchar as string,temp as string,outchar as string outchar=」 」 open=」file1.txt」 for input as #1 open=」file2.txt」 for output as _______ n=lof( ______ ) inchar=input$(n,1) for k=1 to n temp=mid(inchar,k,1) if instr(outchar,temp)= _______ then outchar=outchar & temp end if next k print #2, _________ close #2 close #1 end sub (8)在窗體上先畫1個名為text1的文字框和平個名為label1的標籤,再畫1個名為op1的有4個單選按鈕陣列,其index屬性按季度順序為0∽3(見圖1)。在檔案sales.txt中按月份順序存有某企業某年12個月的銷售額。 要求在程式執行時,滑鼠單擊1個單選按鈕,則text1中顯示相應季度的銷售總額,並把相應的文字顯示在標籤上。圖2是單擊「第3季度」單選按鈕產生的結果。請填空。 dim sales(12) as long private sub form__load() open 「sales.txt」 for input as #1 for k=1 to 12 input #1,sales(k) next k close #1 end sub private sub _________ (index, as integer) dim sum as long ,k as ingeger,month as ingeger sum=0 month=index* _________ for k=1 to 3 month=month+1 sum=sum+sales(month) next k label1.caption=opl(index). ____________ & 「銷售總額:」 text1=sum end sub (9)某人編寫如下函式來判斷a是否為素數,若是,則函式返回true;否則返回false function prime(a as integer)as boolean dim k as interger,isprime as boolean if a<2 then isprime=false else isprime=true k=2do while k
if a mod k=0 then isprime=false else k=k+1 end if loop end if prime=isprime end function 在測試時發現有1個非素數也被判斷為素數,這個錯判的數是 _______。 全國計算機考試為ncre時間為3月9月而上海為cct時間為10月底到11月初上海的難度會更高一些 上海市高等學校計算機等級考試是上海市教育委員會組織的全市高校統一的教學考試,是檢測和評價高校計算機應用基礎知識教學水平和教學質量重要依據之一 考試的目標是測試考生掌握基本的計算機基礎知識的程度和應用計算... 老師建議你考vfp,你這個專業應該考這個,而且它的難度也比較適中,有一些實用價值。全國計算機等級考試一級證書有用嗎?全國計算機等級考試一級證書有用。有了一級證書相當於你的大學生計算機基礎這門課通過了,會一些基本的操作技能,辦公軟體操作知識,肯定對你的學習和生活有用。希賽解答 一級的話可能用處並不是很... 全國計算機等級考試 national computer rank examination,簡稱ncre 經原國家教育委員會 現教育部 批准,由教育部考試中心主辦,面向社會,用於考查應試人員計算機應用知識與能力的全國性計算機水平考試體系。它是一種重視應試人員對計算機和軟體的實際掌握能力的考試。成績合格...上海市計算機等級考試跟全國計算機等級考試有什麼區別
計算機等級考試,全國計算機等級考試一級證書有用嗎?
全國計算機等級考試證書怎樣查詢系統