ASP.NET中我们可以使用两个类来实现字符串的处理,就是System.String类和System.Text.StringBuilder类。System.String类是系统内置的字符串类型,而System.Text.StringBuilder类是.NET Framework Library中专为字符串处理而提供的类。二者最主要的区别在于String类的操作一般建立并返回一个新的字符串,而StringBuilder则是在原来的字符串上进行修改。当对于一个字符串重新修改的时候最好String会不停地在内存中创建新的字符串对象,这样就很消耗系统内存资源。而StringBuilder则不会。
笔试题:
1. a=10,b=15,在不用第三方变量的前提下,把a,b的值互换。
a = a+b;
b = a-b;
a = a-b
2. 请说明在.net中常用的几种页面间传递参数的方法,并说出他们的优缺点。
Response.Redirect : this have a round from the client to the server then back to the client and url is also changed.
Server.Transfer: back from the server direct and the url is not changed. Obviously better performance than “Response.Redirect”.
ViewState: can only be used in the current page lift circle.
Application: can be used in the whole application.
Session: can be used in the whole application, but easily lost.
Cookie: maybe disabled by the client.
3. ASP.NET中new有几种用法?
Operator、Modifier、Restriction(操作符、修饰符、约束)
4. C#中,string str = null 与 string str ="",请尽量用文字说明区别。(要点:说明详细的内存空间分配)
String str =null : an empty reference, doesn’t waste the memory space.
String str = “”: an empty character string, the variable “str” has been instanced and it also waste some memory space.
5.在下面的数列中,下一个数字是多少:10, 9, 60, 90, 70, 66,?
(1)96
(2)10的100次方
(3)以上皆是
(4)以上皆不是
答案是4 (10+70=80 9+66=75 60+10=70 故答案?应该是10)
6. 对一批编号为1-100全部开关朝上(开)的灯进行以下操作:
凡是1的倍数反方向拨一次开关;2的倍数反方向又拨一次开关;3的倍数反方向又拨一次开关。。。。。。
问:最后为关熄状态的灯的编号。
1,4,9,16,25,36,49,64,81,100(约束为奇数的灯最后熄灭的)
7. SQLSERVER服务器中,给定表 table1 中有两个字段 ID、LastUpdateDate,ID表示更新的事务号, LastUpdateDate表示更新时的服务器时间,请使用一句SQL语句获得最后更新的事务号。
Select top 1 ID from table1 order by LastUpdateDate desc
8. 写出一条Sql语句: 取出表A中第31到第40记录(SQLServer, 以自动增长的ID作为主键, 注意:ID可能不是连续的。)
Select top 10 * from A where ID not in (select top 30 ID from A order by ID desc) order by ID desc.
9. 某一密码仅使用K、L、M、N、O共5个字母,密码中的单词从左向右排列,密码单词必须遵循如下规则:
(1) 密码单词的最小长度是两个字母,可以相同,也可以不同
(2) K不可能是单词的第一个字母
(3) 如果L出现,则出现次数不止一次
(4) M不能使最后一个也不能是倒数第二个字母
(5) K出现,则N就一定出现
(6) O如果是最后一个字母,则L一定出现
问题一:下列哪一个字母可以放在LO中的O后面,形成一个3个字母的密码单词?
A) K B)L C) M D) N
答案:B
问题二:如果能得到的字母是K、L、M,那么能够形成的两个字母长的密码单词的总数是多少?
A)1个 B)3个 C)6个 D)9个
答案A
问题三:下列哪一个是单词密码?
A) KLLN B) LOML C) MLLO D) NMKO
答案C
浙公网安备 33010602011771号