ASP即Active Server Pages,是MicroSoft公司开发的服务器端脚本环境,可用来创建动态交互式网页并打造强大的web应用程序。下面是学习啦记者为你收拾的ASP面考试试题,期望对你有所帮助!
第一题:ASP中,VBscript的唯一的数据种类是什么?
第二题:在ASP中,VBscript有多种控制程序步骤语句,如IfThen, Select Case,
For Next, Do Loop, Exit等语句。请为这五个语句分别写一段用的代码。
第三题:请看如下代码
这段代码实行后,运行结果是什么?并讲解一下为何?
第四题:在ASP中,Server中有一个办法是URLEncode
如: response.write Server.URLEncode
结果输出: Test%2EASP%3FTestNum%3D100%26TestStr%3D%C4%E3%BA%C3
在ASP中,有ASC,Hex,Mid这三个可可以用
到的函数,若是三个函数的使用方法
如:
ASC=65,ASC= |15133
Hex=41,Hex=C4E3
Mid=e, mid=te
目前需要撰写编码函数Function TestEncode,及一个解码函数
Function TestDecode。TestEncode是将SourceString
串中非字母且非汉字且非数字的字符转换为对应Ansi编码的十六进制编码!
如:
TestEncode=
Test%2EASP%3FTestNum%3D100%26TestStr%3D你好
而TestDecode是将编码的串还原,是TestEncode的逆函数。
第五题:
撰写一个星期的函数GetWeek
返回星期1、星期2、星期三
第六题:
用ASP输出九九乘法口决表的网页
输出如下:
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
需要撰写一个完整的ASP文件
第七题到第九题
已知SQL Server数据库的有一个数据库TestDB,学生表结构如下:
表名:Student
字段名 种类 说明
id int 自增1
name varchar
sex char F表示女人,M表示男士
已知已经概念了ADODB.Connection对象ConnTestDB已连接了上述的TestDB数据库
可以在未来的测试中直接引用该对象.
第七题:
撰写ASP代码,将Student中的人的名字及性别列出来,并给统计学生人数如下:
名字 性别
张三 男
李四 男
王五 女
总共有100个学生
第八题:
在上述数据库中,有一个表存放学生的得分的,结构如下:
表名:Score
字段名 种类 说明
StuID int 学生的ID值,关系是:Score.StuID=Student.ID
Chinese int
math int
需要输出内容:
名字 语文 数学 总成绩
张三 60 100 160
请撰写达成上述功的ASP代码
第九题:
已知:
某一学生:陈六,男,语文80分,数学60分,现需要撰写ASP代码
将该学的数据插入数据库中,分别插入到上述的两个表Student,Score表中。
网友提供的答案:
?
第一题:Variant
第二题:
dim x,y
if x= then
x=1
end if
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 x5
第三题:
运行结果是:testA
缘由是:testA所附值的是一个全局变量TestString
testB由于有Dim TestString这句概念,所以它所附值的只不过一个局部变量。
第四题:
dim str
str=Test.ASP?TestNum=100TestStr=你好
function TestEncode
0Adim str|len
dim for|x
dim char
dim ansi
str|len=len
for for|x=1 to str|len
char=mid
ansi=asc
if then
TestEncode=TestEncodechar
else
TestEncode=TestEncodecstr)
end if
next
end function
function TestDecode
0Adim str|len
dim for|x
dim char
dim ansi
str|len=len
for for|x=1 to str|len
char=mid
if char= then
ansi=mid
TestDecode=TestDecodechr)
for|x=for|x+2
else
TestDecode=TestDecodechar
end if
next
end function
response.Write TestEncode
response.Write TestDecode)
第五题:
function GetWeek
if isdate then
GetWeek=weekdayname)
end if
end function
response.Write GetWeek
第六题:
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 0D
next
next
第七题:
set rs=ConnTestDB.execute
response.Write 名字 性别
while not rs.eof
response.Write rs rs
rs.movenext
wend
第八题:
set rs=ConnTestDB.execute
response.Write 名字 语文 数学 总成绩
while not rs.eof
response.Write rs rs rs +rs)
rs.movenext
wend
第九题:
dim StrudentID,StrudentName,StrudentSex
StrudentName=陈六
StrudentSex=男
S|Chinese=80
S|math=60
Function yhsql
yhsql=replace
End Function
ConnTestDB.execute insert into Student value ,yhsql)
StrudentID=ConnTestDB.execute as sid from Strdent where name=yhsql)
ConnTestDB.execute insert into Score value
|
第7到9题没经过测试,或许会有语法上的错误。
还有,第9题的处置办法我觉得不是非常妥当,请各位指点一下还有哪些别的办法吗?:)