--------------------------------------------------------------------------------------------------------------------------------------------------------

  1. Please implement atoi function

根据经验总结

 

 

  1. Please describe the query process of “select a,b,c from tablea where id in (7,8,9)” in Database, and how to create Index in this table?

select a,b,c from tablea where id in (7,8,9)表示 查询tablea表id包含7,8,9的记录,显示a,b,c字段

例如:

 

if object_id('tbTest') is not null

drop table tbTest

GO

----创建测试数据

create table tbTest(型号 varchar(10),批号 varchar(10), 级别 varchar(10))

insert tbTest

select '0530', 'A', '良' union all

select '0530', 'A', '次' union all

select '0648', 'B', '次' union all

select '0648', 'B', '良' union all

select '0530', 'C', '良' union all

select '0648', 'A', '次'

----为型号列创建聚集索引

create CLUSTERED index idx_tbTest_型号 on tbTest(型号)

GO

 

----查询

select * from tbTest order by 型号,批号

----清除测试环境

drop table tbTest

 

/*结果

型号      批号       级别        

---------- ---------- ----------

0530       A          良

0530       A          次

0530       C          良

0648       A          次

0648       B          良

0648       B          次

*/

 

 

 

 

 

           

  1. Please try to say what’s the difference between Web services and traditional Form?

Web services 指为了一些功能提供接口,让它可以被Web上的其他程序访问的一种技术

这里所说的功能是从数据库获取数据,执行一个数学运算,或者更复杂的任务

传统的Form都是B/S 主要的都是3层架构,或者在此基础上的扩充,他们没有接口,直接访问数据库等等

 

 

  1. What’s the different between HTML Control and Server Control in ASP.NET?

             http://www.extremeexperts.com/Net/FAQ/DiffBetweenServerandHTMLControls.aspx

            

SereverControl有微软自己开发的控件 HTMLCONTROL 是微软把 HTML的控件又封装 一下

 

 

5.   Please try to draw this web page

 

<body style="background:#09c">

<table border="0" cellspacing="0" cellpadding="0">

 <tr>

    <td colspan="3" bgcolor="#FFFFFF"></td>

    <td colspan="3" bgcolor="#000000"></td>

 </tr>

 <tr>

    <td bgcolor="#FFFFFF"></td>

    <td width="50" height="50"></td>

    <td bgcolor="#FFFFFF"></td>

    <td></td>

    <td width="50" height="50"></td>

    <td rowspan="2" bgcolor="#000000"></td>

 </tr>

 <tr>

    <td colspan="3" bgcolor="#FFFFFF"></td>

    <td colspan="2"></td>

 </tr>

    <tr>

    <td rowspan="2" bgcolor="#000000"></td>

    <td></td>

    <td rowspan="2"></td>

    <td colspan="3" bgcolor="#000000"></td>

 </tr>

 <tr>

    <td width="50" height="50"></td>

    <td bgcolor="#000000"></td>

    <td width="50" height="50"></td>

    <td bgcolor="#000000"></td>

 </tr>

 <tr>

    <td colspan="6" bgcolor="#000000"></td>

 </tr>

</table>

</body>

 

 

 

6. Can you use a batch SQL or store procedure to calculating the Number of Days in a Month

  

/* the Number of Days in a Month*/

Declare @Year int, @Month Int

Select @Year = 2007, @Month = 6

 

/*把行数据增加到临时表里面*/

Select TOP 50 ID = Identity(Int, 0, 1) Into #T From SysColumns

SelectConvert(Varchar(10),DateAdd(day, ID,Cast(Rtrim(@Year)+'-'+Rtrim(@Month)+'-'+'01'AsDateTime)), 120)

From #T

Where ID < DateDiff(day, Cast(Rtrim(@Year) + '-' + Rtrim(@Month) + '-' + '01' As DateTime), DateAdd(mm, 1, Cast(Rtrim(@Year) + '-' + Rtrim(@Month) + '-' + '01' As DateTime)))

Drop Table #T

 

 

或者

select datepart(dd,dateadd(dd,-1,dateadd(mm,1,cast(cast(year(getdate()) as varchar)+'-'+cast(month(getdate()) as varchar)+'-01' as datetime))))

 

 

注:datepart  ( DATEPART ( datepart , date ) )

返回表示指定日期的指定日期部分的整数。

Dateadd: DATEADD (datepart , number, date )

返回给指定日期加上一个时间间隔后的新 datetime 值。

 

 

 

 

       7. The

Fastest Way

to Recompile All Stored Procedures
  I have a problem with a database running in SQL Server 6.5 (Service Pack 4). We moved the database (object transfer) from one machine to another last night, and an error (specific to a stored procedure) is cropping up. However, I can't tell which procedure is causing it. Permissions are granted in all of our stored procedures; is there a way from the isql utility to force all stored procedures to recompile?

Tips: sp_recompile can recomplie a store procedure each time

在执行存储过程时,使用 with recompile 选项强制编译新的计划;使用sp_recompile系统存储过程强制在下次运行时进行重新编译

 

 

 

 --------------------------------------------------------------------------------------------------------------------------------------------------------

1.    What is DNS? Given a hostname, how to find its corresponding IP address? If every time’s accessing a web server requests a newly load of every object, how can you ensure that?

 

DNS:    Domain Name Server 域名服务器

Hostname: 主机名

hostnames可用于计算机定位于网络.

For the computer to contact another computer by using a hostname, the hostname will either appear in the DNS server or in the hosts file.

Ping www.163.com 可以查看到对应的IP

 

主机部分的域名是computer1

computer1.server.tech-faq.com

 

对缓存进行设置

 

2.    Suppose you are an admin of a commercial web site. This web site is hosted by your company and managed via IIS. If one day, you are called by a customer, he/she tells you that they cannot visit your web site. How are you going to investigate what problem with your web site?

 

首先DNS与hostname 是否连通

当前的Web Service 是否启动

本地的WebService 断口是否打开

 

 

3.    If a flash video does not work on a web page, if the web page is hosted on your company and managed by IIS, could you think out what’s wrong with it?

 

首先是缺少flash插件

然后判断客户端是否禁用了Flash

然后判断客户端的插件的版本

 

4.    Briefly explain what IIS is? Where can you configure your IIS settings in Windows system?

 

Internet Information Service

微软公司的Web服务器

配置IIS服务器

首先 安装IIS

然后控制面版 /管理工具/ Internet 信息服务/

 然后建立虚拟目录

 选择网站内容目录

然后权限设置

完成

 

 

 

 

5.    How to enable and disable ActiveX controls?

设置IE

 

6.    There are two tables, one is classstulink with fields: classID, clsssName, studentID; another talbe is students with field: studentID, studentName, studentInfo. The two tables are inner joined by studentID. Now the question is: please write SQL script or stored procedure to add 10 students into DB.

写存储过程

Create produce sp_InsertRecord

As

Declare @errorid int

Set @errorid=0

Begin transaction

Insert

Into targettable(columnname)

Select A.*,B.*

From classstulink A inner join TableB b on A.studentID=B. studentID

 

if    @errorid=0   --    if @@error<>0

                    begin                

                            commit transaction

 

                   end

               else

                    begin

                             rollback transaction

                              --RAISERROR ('传入的SQL语句执行出错', 16, 1)

 

                     end

 

 

 

 

7.    Write a function to round an input as double to an integer. (i.e. input:2.69->3; -2.6->-3)

 

大于0加0.5,小于0加-0.5

取整

Math.Round()

 ------------------------------------------------------------------------------------------------------------------------------
 

1.   There are 3 baskets. one of them have apples, one has oranges only and the other has mixture of apples and oranges. The labels on their baskets always lie. (i.e. if the label says oranges, you are sure that it doesn't have oranges only, it could be a mixture) The task is to pick one basket and pick only one fruit from it and then correctly label all the three baskets.

 

 

2.   How to test an elevator system?

       

 

3.   How to test web services?

    通常的做法就是调用服务的一个接口,不成功就不存在。发送请求调用,根据结果来判断

4.   What are cookies?

    什么是Cookies(“小甜饼”)呢?简单来说,Cookies就是服务器暂存放在你的电脑里的资料(.txt格式的文本文件),好让服务器用来辨认你的计算机。当你在浏览网站的时候,Web服务器会先送一小小资料放在你的计算机上,Cookies 会帮你在网站上所打的文字或是一些选择都记录下来。当下次你再访问同一个网站,Web服务器会先看看有没有它上次留下的Cookies资料,有的话,就会依据Cookie里的内容来判断使用者,送出特定的网页内容给你。

5.   What is stored procedure, trigger; write a loop function in T-SQL.

   USE AdventureWorks;

GO

WHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300

BEGIN

   UPDATE Production.Product

      SET ListPrice = ListPrice * 2

  SELECT MAX(ListPrice) FROM Production.Product

   IF (SELECT MAX(ListPrice) FROM Production.Product) > $500

      BREAK

   ELSE

      CONTINUE

END

PRINT 'Too much for the market to bear';

 

 

6.   XML/XSLT/HTML, what are the differences?

  XML+XSL!=HTML

XSLeXtensible Stylesheet Language),即可扩展样式表语言,是w3c推荐的一种标准,用以定义XML 文档的转换与格式化。

7.   If there is a 404 error when you navigate to a web page, could you list some of the possible reasons?

 

 

1. Make sure .NET is installed on your machine

 

2. If IIS was installed before .Net run 'aspnet_regiis -i' from your Microsoft.NET\Framework\vXXX directory

 

3. In "Internet Information Services Manager" on your server you should have "Web Sites" folder as well as a "Web Service Extensions" folder. In that folder there are some services listed there and you should have "ASP.NET v<version>" listed. The service should be set to "Allow".

 

8.   Write a function to reverse a string.

private string ReverseString(string InputStr)

{

 char[] Chars = InputStr.ToCharArray();

 int Length = InputStr.Length-1;

 

 for (int x=0;x<Length;x++,Length--)

 {

    Chars[x] ^= Chars[Length];

    Chars[Length] ^= Chars[x];

    Chars[x] ^= Chars[Length];

 }

 

 return new string(Chars);

}

 

9.   Write a function to determine the days in a month, assuming Feb has 28 days. (input: Integer,i.e. input 2->28)

10. Write a function to check if a give string is a palindrome. (Palindrome example: “bob”,”peep”,”zeus sees suez”,”mix a maxim”… Words that is not a Palindrome:”ounce”,”pupil”,”hi,there”,”no matter how”…)
---------------------------------------------------------------------------------------------------------------------------------------------------------