亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      考試首頁 | 考試用書 | 培訓(xùn)課程 | 模擬考場 | 考試論壇  
      全國  |             |          |          |          |          |         
        當前位置:計算機等級 > 二級考試 > Visual Basic > VB模擬試題 > 文章內(nèi)容
        

      全國計算機等級考試VB語言考試試題答案(21)

      中華IT學(xué)院   【 】  [ 2016年3月18日 ]

      填空題

      閱讀下面程序,子過程Swap的功能是實現(xiàn)兩個數(shù)的交換,請將程序填寫完整。

      Public Sub Swap(x As Integer, y As Integer)

      Dim t As Integer

      t = x : x = y : y = t

      End Sub

      Private Sub Command_Click()

      Dim a As Integer, b As Integer

      a = 0 : b = 0

      【】

      Print "a = "; a , "b ="; b

      End Sub

      下列程序中,fac是求n!的遞歸函數(shù),請將程序填寫完整。

      Public Function fac(n As Integer)

      If n =  Then fac =

      Else fac = 【】

      End If

      End Sub

      如下程序,運行的結(jié)果是 【】 ,函數(shù)過程的功能是 【】 。

      Public Function f(ByVal n% , ByVal r%)

      If n <> 0 Then

      f = f(n\r,r)

      Print n Mod r;

      End If

      End Function

      Private Sub Command_Click()

      Print f(00,)

      End Sub

      如下程序,運行的結(jié)果是 【】 ,函數(shù)過程的功能是 【】 。

      Public Function f(m% , m%)

      Do While m <> n

      Do While m > n :m = m – n :Loop

      Do While m < n :n = n – m :Loop

      Loop

      f = m

      End Function

      Private Sub Command_Click()

      Print f(,)

      End Sub

      兩質(zhì)數(shù)的差為,稱此對質(zhì)數(shù)為質(zhì)數(shù)對,下列程序,是找出00以內(nèi)的質(zhì)數(shù)對,并成對顯示結(jié)果。其中IsP是判斷m是否為質(zhì)數(shù)的函數(shù)過程。

      Public Function IsP(m%) As Boolean

      Dim i%
      【】

      For i =  to Int(Sqr(m))

      If 【】 Then IsP = False

      Next i

      End Function

      Private Sub Command_Click()

      Dim i%

      p = IsP()

      For i =  to 00 step

      p = IsP(i)

      If 【】 Then Print i-;i

      p 【0】

      Next i

      End Sub

      統(tǒng)計輸入的文章中單詞數(shù),并將出現(xiàn)的定冠詞The全部去除,同時統(tǒng)計刪除定冠詞的個數(shù)。假定單詞以一個空格間隔。

      Public Sub PWord(s% ,CountWord% ,CountThe%)

      Dim len%,i%,st$
      CountWord = 0 :CountThe = 0

      st = Trim(s)

      【】
      Do While i > 0

      CountWord = CountWord +

      st = 【】

      i = InStr(st," ")

      Loop

      CountWord = CountWord +

      st = Trim(s)

      【】

      Do While i > 0

      CountThe = CountThe +

      st = 【】

      i = InStr(st,"The")

      Loop

      【】

      End Sub

      全局變量必須在__【】__模塊中定義,所用的語句為__【】__。

      設(shè)有以下函數(shù)過程:
      Function Fun (m as Integer) As Integer
      Dim k As Integer, Sum As Integer
      Sum =0
      For k = m To  Step -
      Sum =Sum +k
      Next k
      Fun =Sum
      End Function
      若在程序中用語句 s =fun(0)調(diào)用此函數(shù),則s的值為 【】 。

      首頁 1 2 尾頁
      分享到:
      本文糾錯】【告訴好友】【打印此文】【返回頂部
      將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動訪問考試網(wǎng) | 復(fù)制本頁地址,傳給QQ/MSN上的好友 | 申請鏈接 | 意見留言 TOP
      關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
      Copyright © 2006-2017 中華考試網(wǎng)(Examw.com) All Rights Reserved  營業(yè)執(zhí)照