日期:2014-05-18  浏览次数:20421 次

2012、2、22比较二的面试题
1.编程遍历页面上的所有TextBox空间并给它赋值为String.Empty
2.两个从小到大排序的整形数组,将这两个合并到一个新数组中,并按从小到大的顺

序排序。
3.SQL分页代码 取出表中第31条到40条记录
4.写正则提取String strA="www.pkulaw.cn/fulltext_form.aspx?Db=chl&Gid=25464"

中的"Gid"的值
5.设计购物车系统功能如下:
①对教材类图书实行每本一元的折扣
②对连环画类图书每本7%的促销折扣
③对非教材类的计算机图书3%的折扣
④其余图书没有折扣
6.某站点使用ASP.NET架设了在线书店系统,在首页为增加搜索引擎收录效果,现要求

编写URL重写如下:
(1)图书动态页是/BookDetail.aspx?id=数字
(2)希望用户可以通过/book/数字.shtml访问该图书的详细信息("book"目录实际上并

不存在)
要求:
①修改配置文件,将所有针对"Book"目录中的shtml访问指向URLRewrite类进行处理
②编写实现IHttpHandler的类URLRewrite
③去的请求的URL,从中得到请求图书的id
④执行对应的动态页面

------解决方案--------------------
C# code


第一题:
foreach (Control control in this.Controls)
{
    if (control is TextBox)
    {
        TextBox tb = (TextBox)control;
        tb.Text = String.Empty;
    }
} 



第二题 [color=#FF0000]st()方法排序那里不是很会,从网上down下来的,有点小BUG,只做参考[/color]

int[] ar1 ={5,12,9};
int[] ar2 ={0,6,22};

int[] sum = new int[ar1.Length + ar2.Length];

ar1.CopyTo(sum, 0);
ar2.CopyTo(sum, ar2.Length);

int[] k = st(sum);

for (int i = 0; i < sum.Length; i++)
{

      Response.Write(k[i] + ",");
}
 

public int[] st(int[] array)
    {
        int[] fianlmtm = new int[array.Length];

        for (int j = 0; j < array.Length; j++)
        {
            int last = 0;
            for (int i = 1; i < array.Length - j; i++)
            {
                int t = array[i];

                if ((array[i]) < (array[i - 1]))
                {

                    array[i] = array[i - 1];
                    last = array[i];
                    array[i - 1] = t;

                }
                else
                {
                    last = array[i];

                }

            }
            fianlmtm[array.Length - (j + 1)] = last;

        }
        return fianlmtm;

}






第三题:
mysql:select * from tablename limit 31,40

mssql:select top 10 * from table1 where id not in(select top 10 * from table1)



第四题:不会啊



第五题:太多,只做一题,其他思路也差不多

商品总类名称表 type

id    typeAllName
1     教材类
2     连环画
3     非教材类

商品信息表 typeInfo

id    typeName     typeId      typeSum
1     A            1           22
2     B            1           55
3     C            2           55
4     D            2           23
5     E            1           2
6     F            3           22



select i.typeName as 商品名称,

t.typeAllName as 商品类型,

i.typeSum as 商品价格,

sum(typeSum-1) as 商品折扣后价格

from typeInfo i 

left join [type] t on i.typeId=t.Id

where i.typeId=1 

group by i.typeName,t.typeAllName,i.typeSum



/*
商品名称   商品类型    商品价格    商品折扣后价格
A        教材类     22          21
B        教材类     55          54
E        教材类     2          1

*/



第六题 你还是看这个网址吧:

http://www.cnblogs.com/junjun0803/articles/781807.html

------解决方案--------------------
探讨
C# code



第一题:
foreach (Control control in this.Controls)
{
if (control is TextBox)
{
TextBox tb = (TextBox)control;
tb.Text = String.Empty;
}
}



第二题 [c……

------解决方案--------------------
第四题: protected void Page_Load(object sender, EventArgs e)
{
GetValue("Gid");
}
public static string GetValue(string key)
{
string strA = "www.pkulaw.cn/fulltext_form.aspx?Db=chl&Gid=25464";
string pattern = @"(?is)(?<=" + key + @"=)([^&]*)";
string result = Regex.Match(strA, pattern).Value;
return result;
}酱油的路过