ASP面试试题及答案.docx

上传人:太** 文档编号:96807830 上传时间:2024-03-22 格式:DOCX 页数:8 大小:14.63KB
返回 下载 相关 举报
ASP面试试题及答案.docx_第1页
第1页 / 共8页
ASP面试试题及答案.docx_第2页
第2页 / 共8页
点击查看更多>>
资源描述

《ASP面试试题及答案.docx》由会员分享,可在线阅读,更多相关《ASP面试试题及答案.docx(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、ASP面试试题及答案ASP面试试题及答案第一题:ASp中,VBScript的唯一的数据类型是什么?其次题:在ASp中,VBScript有多种掌握程序流程语句,如If-Then, Select- Case,For - Next, Do Loop, Exit等语句。请为这五个语句分别写一 段使用的代码。第三题:请看如下代码这段代码执行后,运行结果是什么?并解释一下为什么?第四题:在ASp中,Server中有一个方法是URLEncode (string)如:response, writeServer. URLEncode (Test. ASp?TestNum二lOOTestStr=你好)结果输出:T

2、est%2EASp%3FTestNum%3D100%26TestStr%3D%C4%E3%BA%C3在ASp中,有ASC (String), Hex (Number), Mid (String, start, , length)这三个可 能用到的函数,假如是三个函数的用法如:ASC(A)=65, ASC (你)=-15133Hex(65)=41, Hex(-15133)=C4E3Mid (hello, 2, 1) =e, mid (this is test!, 9, 2) =te现在要求编写编码函数 Function TestEncode (SourceString),及一个解码函数Funct

3、ion TestDecode(CodeString)o TestEncode(SourceString)将 SourceString串中非字母且非汉字且非数字的字符转换为对应Ansi编码的十六进 制编码!如:TestEncode (Test. ASp?TestNum=100TestStr=你好)=Test%2EASp%3FTestNum%3D100%26TestStr%3D 你好而TestDecode(CodeString)是将编码的串还原,是TestEncode的逆 函数。第五题:编写一个星期的函数GetWeek (aDate)返回星期一、星期二、星期三.第六题:用ASp输出九九乘法口决表的

4、网页输出如下:1*1=11*2=2 2*2=41*3=3 2*3=6 3*3=9 要求编写一个完整的ASp文件第七题到第九题已知SQL Server数据库的有一个数据库TestDB,同学表结构如下: 表名:Student字段名类型说明id int自增1name varl6)sex 1) F表示女性,M表示男性已知已经定义了 ADODB. Connection对象ConnTestDB已连接了上述的TestDB数据库可以在以后的测试题中直接引用该对象.第七题:编写ASp代码,将Student中的人的姓名及性别列出来,并给统计同学人数如下:姓名性别张三男李四男王五女 总共有100个同学第八题:在上述

5、数据库中,有一个表存放同学的得分的,结构如下:表名:Score字段名类型说明StuID int 同学的 ID 值,关系是:Score. StuID=Student. IDChinese intmath int要求输出内容:姓名语文数学总成果张三 60 100 160 请编写实现上述功的ASp代码第九题:已知:某一同学:陈六,男,语文80分,数学60分,现要求编写ASp代码 将该学的数据插入数据库中,分别插入到上述的两个表Student, Score 表中。解答:第一题:Variant其次题:dim x, yif x= thenX=1end ifselect case xx=x+lx=x+2en

6、d selectfor y=0 to xresponse, write yif y=2 then exit fornextdox=x+lif x=4 then exit doloop while x48 and ansi65 and ansi97 and ansi225) thenTestEncode=TestEncodecharelseTestEncode=TestEncodecstr(Hex (ansi)end ifnext end functionfunction TestDecode(f_Str)OAdim str_len dim for_x dim char dim ansi str

7、_len=len(f_Str) for for_x=l to strlen char=mid(f_Str, for_x, 1) if char= thenansi=mid(f_Str, for_x+l, 2)TestDecode=TestDecodechr(clng(Hansi) for_x=for_x+2 elseTestDecode=TestDecodechar end if next end functionresponse. Write TestEncode(str)response. Write TestDecode(TestEncode(str)第五题:function GetWe

8、ek(aDate)if isdate(aDate) thenGetWeek=weekdayname(WeekDay(aDate) end ifend functionresponse. Write GetWeek(2023/1/3)第六题:dim x, yfor x=l to 9for y=l to xresponse. Write y*x=x*yif x=y then response. Writenextnext第七题:set rs=ConnTestDB. execute (Select top 100 name, sex from Student order by id,sex)resp

9、onse. Write 姓名性别while not rs.eofresponse. Write rs (name)rs (sex)rs. movenextwend第八题:set rs=ConnTestDB. execute(Select name, Chinese, math fromStudent,Score where StuID=ID)response. Write姓名 语文 数学 总成果while not rs.eofresponse. Write rs (name) rs (Chinese) rs(math)(rs (Chinese)+rs(math)rs. movenextwend

10、第九题:dim StrudentID, StrudentName, StrudentsexStrudentName 二陈六Strudentsex二男S_Chinese=80S_math=60Function yhsql(data)yhsql=replace(data, , )End FunctionConnTestDB. execute into Student (name, sex) value(26yhsql(StrudentName), yhsql(Strudentsex)StrudentID=ConnTestDB.execute (select max (id) as sid from

11、Strdent where name=yhsql(StrudentName)(sid)ConnTestDB. execute into Score (StuID,Chinese, math) value (S Chinese, S math)附:第7题asp程序优化之:对象变量当遍历记录集时,一个保证能提高性能的方法是使用对象变量指 向集合中的成员。例如,考虑下面的遍历含有Authors表的记录集的 例子。While Not rsAuthors. EOFResponse. Write rsAuthors (au_fname) _rsAuthors(au_lname) rsAuthors. Mo

12、veNextWend可以用下面的方法加速代码执行,同时使其更易于理解。Set FirstName = rsAuthors(au_fname)Set LastName = rsAuthors(au_lname)While Not rsAuthors. EOFResponse. Write FirstName LastNamersAuthors. MoveNextWend这里使用了两个变量,并指向记录集的Fidds集合中的特定字段(记 住,Fidds集合是缺省的集合)。由于这里建立了一个对象的引用, 所以可以使用对象变量而不是实际的变量,这意味着脚本引擎的工作 削减了,由于在集合中进行索引的次数变少了。文档内容到此结束,欢迎大家下载、修改、丰富并分享给更多有 需要的人。

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 解决方案

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁