`
hxix29hxix
  • 浏览: 13142 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

面试者自述

 
阅读更多

面试者自述
2010年07月20日
  You should answer 7 optional questions plus all 3 required questions.  SQL (Required): 1.    Table: Student (Student ID, Student Name)                          Lesson (Lessoned, LessonName, StudentID)  There are students without Lesson information.   Please write Sql script to create table and get all students and their lesson information. CREATE TABLE [dbo].[Student] (        [StudentID] [varchar] (50)  AS NOT NULL ,        [StudentName] [varchar] (50)  AS NOT NULL  ) ON [PRIMARY] GO   Select Student.*, Lesson.* from Student inner join Lesson ON Student.StudentID= Lesson. LessonID   2.    Please list out the difference between Cluster index and Non-cluster index.  聚簇索引是跟数据的物理排列顺序相关的,所以查询起来效率相对高一些,找到了索引值,也就找到了这个数据,非聚簇索引可以理解为数据的逻辑存储相关,找到了非聚簇索引,不一定找到了这个数据,因为它不包含实际的数据,所以效率相对低一些。
  3.     How to get the last day of a month using Sql script from any given date? 
  Declare @year (int)
  Declare @month (int)
  Declare @day (int)
  Declare @newDate (varchar20)
  Declare @nextMonth (int)
  Declare @endDate (DateTime)
  @year=YEAR(@givenDate)
  @month=MONTH(@givenDate)
  @day=DAY(@givenDate)
  @nextMonth=@month+1
  @endDate=
  @newDate=DATEDIFF(@givenDate,@endDate)
  @day=@newDate+@day
  Print @day
  General Questions (optional)
  1.      Does C# support multiple-inheritance?
  C#不支持多重继承
  2.      Who is a protected class-level variable available to? 
  只有继承了该类的子类才能具有可用的权限。
  3.      Are private class-level variables inherited? 
  private变量不能被继承的。
  4.      Describe the accessibility modifier "protected internal". 
  在一个程序集中具有继承关系的类之间可以具有访问性
  5.      What's the top .NET class that everything is derived from? 
  System.Object
  6.      What does the term immutable mean?
  7.      What's the difference between System.String and System.Text.StringBuilder classes?
  String是恒定变量字符串,当重新赋值或追加值时候,需要重新分配空间,
  stringBuilder不是恒定变量,是可变变量,追加赋值的时候不需要重新分配空间。
  8.      What's the advantage of using System.Text.StringBuilder over System.String?
  在进行大量的字符串处理操作时候stringBuilder效率和性能会很高,不需要分配太多的空间
  9.      Can you store multiple data types in System.Array? 
  不能
  10.  What's the difference between the System.Array.CopyTo() and System.Array.Clone()? 
  copyTo()方法是拷贝元素到另一个存在的数组里面,是元素值的拷贝;而clone()方法是对象的克隆技术来实现,有浅拷贝和深拷贝,浅拷贝是:返回一个新的对象,该对象包含了所有原始对象的元素,深拷贝是:拷贝引用,可以看作是为每个元素都创建一个引用实例,然后拷贝值。
  11.  How can you sort the elements of the array in descending order?  
  调用sort()方法,然后调用Reverse()倒叙。
  12.  What's the .NET collection class that allows an element to be accessed using a unique key?  
  HashTable.
  13.  What class is underneath the SortedList class?  
  A sorted HashTable.
  14.  Will the finally block get executed if an exception has not occurred? ??  
  Finally块会执行的。
  15.  What's the C# syntax to catch any possible exception?  
  Catch(Exception ex)捕获System.Expection类型任何可能的异常。
  16.  Can multiple catch blocks be executed for a single try statement?  
  不能捕获,只能捕获跟try块相匹配的异常,如果没有找到,则CLR会沿着调用栈向更高一层搜索能够接受该异常的捕获块。
  17.   Explain the three services model commonly know as a three-tier application.  
  UI  Business Logic  DataAccess层层之间实现松散的耦合关系,通过相关的设计模式实现依赖注入、动态绑定等来提高架构的灵活性和高维护性。
  Class Questions (optional)
  1.      What is the syntax to inherit from a class in C#? 
  public class1 : BaseClass,使用":"来实现。 Can you prevent your class from being inherited by another class? 
  Yes "sealed" keyword
  可以将方法和类标记成sealed。
  3.      Can you allow a class to be inherited, but prevent the method from being over-ridden?  
  方法不要定义成:virtual就可以了。
  4.      What's an abstract class?  
  具有抽象方法的,可以被其他类继承的通用性的类,不能被实例化的,可以理解为具有架构和蓝图性的类,可以定义成抽象类。
  5.      When do you absolutely have to declare a class as abstract?  
  这个类具有被继承类的一些通用特征,至少有一个方法定义成抽象的,6.      What is an interface class?  
  用来实现多重继承,具有一些属性、方法和事件等特性,不像类,接口是没有实现的,只是实现了类之间的一个契约。说明这个类能够做什么。
  7.      Why can't you specify the accessibility modifier for methods inside the interface?  
  接口是用来定义类之间的的一个协定,所以必须定义为public,以便类和类之间的通信。默认是public
  8.      Can you inherit multiple interfaces?  
  是的,可以继承多重接口
  9.      What happens if you inherit multiple interfaces and they have conflicting method names?
  显式的实现接口的方法调用方法。
  (Interface1)Interface1.Method ()
  (Interface2)Interface2.Method ()
  10.  What's the difference between an interface and abstract class?  
  表面上,接口是用来实现多重继承的,接口中的方法是没有实现的,抽象类中的方法只要不是定义成抽象方法,是可以有方法的实现的。本质上,接口定义了类之间的协定,说明了这个类能够做什么,而抽象类是定义了类的一些本质的特性,一些通用的性的蓝图性的特性。
  11.   What is the difference between a Struct and a Class?  
  Struct 是个值类型,不能被继承,Class是个引用类型,可以被继承。Struct是在线程堆栈上分配的,不受垃圾回收机制控制,class是在托管堆上分配的,收垃圾回收机制控制。
  Method and Property Questions(optional)
  1.      What's the implicit name of the parameter that gets passed into the set method/property of a class? 
  value关键字是get/set操作的一个隐含的参数。
  2.      What does the keyword "virtual" declare for a method or property? 
  这个方法被定义成virtual后,继承这个类的的子类,可以重写这个方法,具有重写这个方法的权利。 How is method overriding different from method overloading? 
  overriding是重写这个方法,如上面描述的,重写父类被定义成virtual的方法。
  Overloading是重载这个方法,方法名称是不变的,可以是改变这个方法的参数类型,增加方法的参数等,以来实现一个方法具有不同的功能,改变方法的行为,封装好了接受调用。
  4.      Can you declare an override method to be static if the original method is not static? 
  不能的,虚方法的版本要同步。
  5.      What are the different ways a method can be overloaded? 
  函数名称相同,参数类型可以不同,参数个数可以不同,参数顺序可以不同。
  6.      If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
  可以的,使用":"
  关键字是基于(参数列表调用适当的构造函数)在被继承类中定义的重载构造函。
  Events and Delegates (optional)
  1.      What's a delegate? 
  delegate就是委托,是函数指针的概念。在事件编程中提供回调函数机制。
  2.             What's a multicast delegate? 
  一个delegate可以触发多个函数被调用
  Debugging and Testing Questions (optional)
  1.        What debugging tools come with the .NET SDK?  
  DbgCLR:Visual Studio 使用的
  2.      What does assert () method do? 
  断言和断言方法是用来验证自己写的代码是否满足需要的功能,断言为真的时候,说明程序运行正常,没有什么问题,如果为假,证明程序发生意料之外的错误。 What's the difference between the Debug class and Trace class? 
  Debug class是需要Debug Builds Trace class 需要debug和释放builds
  4.     Why are there five tracing levels in System.Diagnostics.TraceSwitcher? 
  5.      Where is the output of TextWriterTraceListener redirected?
  6.      How do you debug an ASP.NET Web application?
  通过aspnet_wp.exe进程,可以设置断点,单布跟踪,看堆栈调用情况,值的变化情况。
  7.      What are three test cases you should go through in unit testing? 
  1、积极的正确的测试用例Positive test cases(正确的数据输入,正确的输出)
  2、消极的测试用例Negative test cases(错误的数据,看是否有错误的输出,是否有出错处理等)
  3、例外的测试用例Exception test cases (异常被捕获,并处理了异常等). 
  8.      Can you change the value of a variable while debugging a C# application? 
  可以,如果用Visual Studio来调试,可以使用窗口来查看和改变值。
  ADO.NET and Database Questions (optional)
  1.        What is the role of the DataReader class in ADO.NET connections? 
  数据阅读器,获取一个数据阅读器记录集,提供只向前读和只读的的功能,对于简单的读取数据来说,性能较高,是基于连接的,所以读完以后需要手动的关闭。
  2.      What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? 
  .NET框架附带了两个.NET数据提供程序:SQLServer.NET数据提供程序和OLEDB.NET数据提供程序。SQLServer.NET数据提供程序是高速的和高性能的,但是需要SQL Server许可来从OLEDB.NET获取,但相对OLEDB.NET会快很多。
  3.      What is the wildcard character in SQL? 
  确定特定字符串是否与指定模式相匹配,如like '%"+L +"%, _(下划线),[ ]等.
  4.      Explain ACID rule of thumb for transactions. 
  事务必须是
  (1)原子级的;
  (2)具有一致性的,定义事务必须保持数据一致;
  (3)具有隔离性的,一个事务是必须独立于其他事务的;
  (4)具有持久性的,一个事务完成后,它的影响永久地保留在数据库中了。
  5.      What connections does Microsoft SQL Server support?
  Windows 验证 ( Active Directory) 和 SQL Server 验证 (Microsoft SQL Server username and password). 
  6.      Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
  Windows验证具有更高的可信任性,SQL Server验证是不太可信任的, Windows验证是通过Active Directory来验证用户名和密码,
  7.   What does the Initial Catalog parameter define in the connection string?
  databaseName(数据库名称),详细如下:
  Initial Catalog=databaseName;User ID=UserName;Password=password
  8.      What does the Dispose method do with the connection object? 
  用来释放一些非托管资源的。关闭一个连接,释放一个连接到连接池中。
  9.             What is a pre-requisite for connection pooling?
  连接池的大小,同一时间允许共享的连接数,安全设置等一些属性。
  Assembly Questions (optional)
  1.        How is the DLL Hell problem solved in .NET? 
  将类型生成模块,然后将模块组合成程序集,这些程序集能够重用的、具有版本控制和实施安全策略的单元。
  2.      What is a satellite assembly?
  具有特定语言文化资源的程序集为卫星程序集,该程序集反映了其中的一些语言文化特性。
  3.      What namespaces are necessary to create a localized application? 
  System.Globalization 和 System.Resources
  4.      What is the smallest unit of execution in .NET?
  应用程序域是.net一个执行单元,应用程序域中加载相应的程序集。
  5.      Whet is the garbage collector  in Net. When should you call the garbage collector in .NET?  
  GC是.NET中垃圾回收器,当分配在托管堆中的对象将托管堆内存空间占用满了,垃圾回收器就开始工作了,它是个多线程的。
  6.      How do you convert a value-type to a reference-type?  
  显式类型转换,隐式类型转换,存在装箱的操作,
  Int i=10;
  Object o=i;
  i=(int)o
  7.      What happens in memory when you Box and Unbox a value-type?
  当存在装箱时候,内存托管堆要分配空间,分配引用类型的指针,然后进行值的一个拷贝,       当存在拆箱操作的时候,线程堆栈上要进行分配空间,然后进行值的拷贝,然后垃圾回收器来进行回收无用的对象引用。
  面试者:
  1.       给定一个字符串(包含有空格,数字,控制符等),求其中单词的个数;
  2.       给定一个字符串,将其内容反转,并写出测试用例;
  总结:
  1.       对C语言和数据结构、算法等有较高的要求;
  2.       白板代码书写能力。    
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics