久久综合丝袜日本网手机版,日韩欧美中文字幕在线三区,亚洲精品国产品国语在线,极品在线观看视频婷婷

      <small id="aebxz"><menu id="aebxz"></menu></small>
    1. ASP面試試題及答案

      時間:2022-07-13 16:06:54 面試 我要投稿

      ASP面試試題及答案

      第一題:ASp中,VBScript的唯一的數(shù)據(jù)類型是什么?

      第二題:在ASp中,VBScript有多種控制程序流程語句,如If…Then, Select… Case,
      For … Next, Do … Loop, Exit等語句。請為這五個語句分別寫一段使用的代碼。

      第三題:請看如下代碼
      <%
      TestString="Test"
      TestA
      TestB
      Response.write TestString

      Sub TestA()
      TestString="TestA"
      End Sub

      Sub TestB()
      Dim TestString
      TestString="TestB"
      End Sub
      %>
      這段代碼執(zhí)行后,運行結果是什么?并解釋一下為什么?

      第四題:在ASp中,Server中有一個方法是URLEncode(string)
      如: response.write Server.URLEncode("Test.ASp?TestNum=100&TestStr=你好")
      結果輸出: Test%2EASp%3FTestNum%3D100%26TestStr%3D%C4%E3%BA%C3
      在ASp中,有ASC(String),Hex(Number),Mid(String,start,[,length])這三個可能用
      到的函數(shù),如果是三個函數(shù)的用法
      如:
      ASC("A")=65,ASC("你")= -15133
      Hex(65)="41",Hex(-15133)="C4E3"
      Mid("hello",2,1)="e", mid("this is test!",9,2)="te"

      現(xiàn)在要求編寫編碼函數(shù)Function TestEncode(SourceString),及一個解碼函數(shù)
      Function TestDecode(CodeString)。TestEncode(SourceString)是將SourceString
      串中非字母且非漢字且非數(shù)字的字符轉換為對應Ansi編碼的十六進制編碼!
      如:
      TestEncode("Test.ASp?TestNum=100&TestStr=你好")=
      "Test%2EASp%3FTestNum%3D100%26TestStr%3D你好"
      而TestDecode(CodeString)是將編碼的串還原,是TestEncode的逆函數(shù)。

      第五題:
      編寫一個星期的函數(shù)GetWeek(aDate)
      返回"星期一、星期二、星期三..."

      第六題:
      用ASp輸出九九乘法口決表的網(wǎng)頁
      輸出如下:
      1*1=1
      1*2=2 2*2=4
      1*3=3 2*3=6 3*3=9
      ...
      要求編寫一個完整的ASp文件

      第七題到第九題
      已知SQL Server數(shù)據(jù)庫的有一個數(shù)據(jù)庫TestDB,學生表結構如下:
      表名:Student
      字段名 類型 說明
      id int 自增1
      name var16)
      sex 1) F表示女性,M表示男性
      ... ...

      已知已經(jīng)定義了ADODB.Connection對象ConnTestDB已連接了上述的TestDB數(shù)據(jù)庫
      可以在以后的測試題中直接引用該對象.

      第七題:
      編寫ASp代碼,將Student中的人的姓名及性別列出來,并給統(tǒng)計學生人數(shù)如下:
      姓名 性別
      張三 男
      李四 男
      王五 女
      ... ...
      總共有100個學生

      第八題:
      在上述數(shù)據(jù)庫中,有一個表存放學生的得分的,結構如下:
      表名:Score
      字段名 類型 說明
      StuID int 學生的ID值,關系是:Score.StuID=Student.ID
      Chinese int
      math int
      要求輸出內(nèi)容:
      姓名 語文 數(shù)學 總成績
      張三 60 100 160
      ...
      請編寫實現(xiàn)上述功的ASp代碼

      第九題:
      已知:
      某一學生:陳六,男,語文80分,數(shù)學60分,現(xiàn)要求編寫ASp代碼
      將該學的數(shù)據(jù)插入數(shù)據(jù)庫中,分別插入到上述的兩個表Student,Score表中。

      解答:
      第一題:Variant
      第二題:
      dim x,y
      if x="" then
      x=1
      end if

      ASP面試試題及答案

      select case x
      case 1
      x=x+1
      case 2
      x=x+2
      end select

      for y=0 to x
      response.write y
      if y=2 then exit for
      next

      do
      x=x+1
      if x=4 then exit do
      loop while x<5
      第三題:
      運行結果是:testA
      原因是:testA所附值的是一個全局變量TestString
      testB因為有Dim TestString這句定義,所以它所附值的只是一個局部變量。

      第四題:
      dim str
      str="Test.ASp?TestNum=100&amp;TestStr=你好"

      function TestEncode(f_Str)
      0Adim str_len
      dim for_x
      dim char
      dim ansi
      str_len=len(f_Str)
      for for_x=1 to str_len
      char=mid(f_Str,for_x,1)
      ansi=char)
      if (ansi=>48 and ansi<=57) or="">65 and ansi<=90) or="">97 and ansi<=122) or (ansi<0 or="" ansi="">225) then
      TestEncode=TestEncode&char
      else
      TestEncode=TestEncode&""&cstr(Hex(ansi))
      end if
      next
      end function

      function TestDecode(f_Str)
      0Adim str_len
      dim for_x
      dim char
      dim ansi
      str_len=len(f_Str)
      for for_x=1 to str_len
      char=mid(f_Str,for_x,1)
      if char="" then
      ansi=mid(f_Str,for_x+1,2)
      TestDecode=TestDecode&chr(clng("&H"&ansi))
      for_x=for_x+2
      else
      TestDecode=TestDecode&char
      end if
      next
      end function

      response.Write TestEncode(str)&"
      "
      response.Write TestDecode(TestEncode(str))

      第五題:
      function GetWeek(aDate)
      if isdate(aDate) then
      GetWeek=weekdayname(WeekDay(aDate))
      end if
      end function
      response.Write GetWeek("2002/1/3")

      第六題:
      dim x,y
      for x=1 to 9
      for y=1 to x
      response.Write y&"*"&x&"="&x*y&" "
      if x=y then response.Write "
      "
      next
      next
      第七題:
      set rs=ConnTestDB.execute("Select top 100 name,sex from Student order by id,sex")
      response.Write "姓名    性別
      "
      while not rs.eof
      response.Write rs("name")&"    "&rs("sex")&"
      "
      rs.movenext
      wend
      第八題:
      set rs=ConnTestDB.execute("Select name,Chinese,math from Student,Score where StuID=ID")
      response.Write "姓名  語文  數(shù)學  總成績
      "
      while not rs.eof
      response.Write rs("name")&"  "&rs("Chinese")&"  "&rs("math")&"  "&(rs("Chinese")+rs("math"))&"
      "
      rs.movenext
      wend
      第九題:
      dim StrudentID,StrudentName,Strudentsex
      StrudentName="陳六"
      Strudentsex="男"
      S_Chinese=80
      S_math=60
      Function yhsql(data)
      yhsql=""&replace(data,"","\")&""
      End Function
      ConnTestDB.execute " into Student (name,sex) value ("26yhsql(StrudentName)&","&yhsql(Strudentsex)&") "
      StrudentID=ConnTestDB.execute("select max(id) as sid from Strdent where name="&yhsql(StrudentName))("sid")
      ConnTestDB.execute " into Score (StuID,Chinese,math) value ("&S_Chinese&","&S_math&") "

      附:
      第7題
      asp程序優(yōu)化之:對象變量

      當遍歷記錄集時,一個保證能提高性能的方法是使用對象變量指向集合中的成員。例如,考慮下面的遍歷含有Authors表的記錄集的例子。
      While Not rsAuthors.EOF
      Response.Write rsAuthors("au_fname") & " " & _
      rsAuthors("au_lname") & "
      "
      rsAuthors.MoveNext
      Wend
      可以用下面的方法加速代碼執(zhí)行,同時使其更易于理解。
      Set FirstName = rsAuthors("au_fname")
      Set LastName = rsAuthors("au_lname")

      While Not rsAuthors.EOF
      Response.Write FirstName & " " & LastName & "
      "
      rsAuthors.MoveNext
      Wend
      這里使用了兩個變量,并指向記錄集的Fidds集合中的特定字段(記住,F(xiàn)idds集合是缺省的集合)。因為這里建立了一個對象的引用,所以可以使用對象變量而不是實際的變量,這意味著腳本引擎的工作減少了,因為在集合中進行索引的次數(shù)變少了。

      【ASP面試試題及答案】相關文章:

      2011最新asp.net面試題與答案07-11

      企業(yè)面試試題及答案07-10

      軟件測試面試題及答案12-30

      某公司面試題及答案07-11

      已考面試題求答案07-11

      會計面試試題及答案07-09

      企業(yè)行政經(jīng)理面試題及答案07-11

      心理學試題及答案04-26

      職業(yè)道德試題及答案04-25

      消防考試試題與答案11-12