网络+C#各个网上转载

   1、 win2000,win2003个有几个版本,每个版本最新系统补丁包是什么啊? 
    2、 DNS的实现方法? 
    3、 WEB服务器的负载均衡? 
    4、 请问目前市面上常用几种网络操作系统的优缺点? 
    5、 请问你用过那些服务器?请讲述raid0、1、5的特点和优点? 
    6、 请列出下列协议的段口号:HTTP,HTTPS,DNS,FTP,TELNET,PPTP,SMTP,POP3? 
    7、 请问局域网内想要通过UNC路径或者NETBIOS名称访问对方计算机,需要在对方计算机上开放什么协议或者端口? 
    8、 OSI七层模型?TCP/IP模型? 
    9、 能否将WIN2000P升级成WIN2000S? 
    10、 怎样保证1个文档的安全性? 
    11、 说说你知道的防火墙及其应用? 
    12、 WINDOWS域的具体实现方式?客户机要加入到域该如何操作? 
    13、 请问你对AD熟悉吗?怎样组织AD资源? 
    14、 请简述操作主机(FSMO)的作用? 
    15、 请问PKI是什么啊?在WIN下怎样实现PKI?请简述证书申请的一个过程? 
    16、 请问你用过那些远程控制软件啊? 
    17、 怎样实现WINDOWS 群集? 
    18、 你知道哪几种邮件系统?请简述安装EXCHANG 2003的详细步骤? 
    19、 请问ISA 有几大功能?请简述用ISA发布网站的过程? 
    20、 请问怎样才能让SQL服务器更安全? 
    21、 请问在生产环境中你应该如何规划SQL数据库文件存放? 
    22、 当一台DC发生宕机,你应该如何处理? 
    23、 请问你如何把你的WINDOWS服务器做得更安全? 
    24、 如何备份和还原SQL 数据库? 
    25、 如何备份和还原EXCHANG数据库? 
    26、 你用过那些杀毒软件(网络版和单机版)? 
    27、 如果有一个小型企业网络需要你去规划,请讲述你的规划 思路? 
    28、 你知道那些入侵检测系统?你能独立部署的有那些? 
    29、 请问如何加强WEB服务器的安全? 
    30、 当有一台电脑出现故障,请问你怎样解决这个问题? 
    31、 你做过系统补丁升级吗?内网如果有一百台机器的话你怎样做系统补丁升级? 
    32、 网页出现乱吗是什么原因? 
    33、 Exchang2003安装成功默认能用foxmail收发邮件吗?如果能,为什么?如果不能,请说明原因? 
    34、 请问怎样才能统一更改整个公司的邮件地址(exchange环境)? 
    35、 请问你在生产环境中如何规划EXCHANGE服务器数据库的存放? 
    36、 请你写出10条以上保证你企业网络安全的措施。 
    37、 一台WINDOWS XP的客户机,登陆域的时需要十分钟,请问是什么原因?怎么解决阿? 
    38、 当用户反映去访问一台文件服务器非常慢,请问是什么原因?如何解决? 
    39、 当用户反映上网速度非常慢,请问什么原因?如何解决? 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

1. 以下程序打印结果是什么:
public class A
 {
  private void printA()
  {
   console.writeline(printA");
  }
  private virtual valueA()
 {
  console.writeline(valueA");
 }
public classs B:A
{
 new private void printA()
 {
  console.writeline(printB");
 }
 private override valueA()
 {
 console.writeline(valueB");
 }
}
pub static int main(String[] args)
{
 B BTemp=new B();
 A ATemp=BTemp;
   ATemp.printA();
   ATemp.valueA();
   BTemp.printA();
   BTemp.valueA();
}

2. 用C#写一段代码,使用递归算法从一个数组中找出最大值和最小值.
3. 
public class BassTest
{
 public BassTest()
 {
 
 }
}
public class BassTemp:BassTest
{
 private BassTemp()
 {
 
 }
}
请问以上程序错误吗?为什么?
4. 写出以下程序运行的结果或者指出程序中的错误:
using system
name mysapce
{
 public class T1
  {
  public static int mypublicint;
  internal static int myinternalint;
  private static int myprivate=0;
  public class M1
   {
   public static int mypublicint;
   internal static int myinternalint;
   private static int myprivate=0;
   }
  private class M2
   {
   public static int mypublicint;
   internal static int myinternalint;
   private static int myprivate=0;
   }
  public class MainClass
  {
  public static int Main()
   {
    T1.mypublicint=1;
    T1.myinternalint=2;
    T1.myprivate=2;
    T1.M1.mypublicint=1;
    T1.M1.myinternalint=2;
    T1.M1.myprivate=2;
    T1.M2.
    T1.M2.
    T1.M2.
 Return 0;
   }
  }
  }
}
5. 以下程序有什么错?
public class TestClass
{
 private int intcount;
 private static int Y;
 public static setvalue
  {
  intcount=1;
  Y=1;
  } 
}
6. package,package bodies怎么理解,创建的语法怎样?
7. 写一个存储过程,用游标来作,声明是在begin后还是在前?用完后是否要关闭?
8. 什么叫值类型,什么叫引用类型?
9. ADO,ADO.NET有什么区别?
10. 类和结构有什么不同?
11. Delegate是什么,举例说明!
12. 什么是反射,举例说明?
13. overide  和重载有什么不同?
14. .net中什么类不能被继承?
15. 接口和抽象类有什么不同?
16. IS 和AS 有什么区别?
17. .net中传递参数有那些方法?有什么区别?
18. 特性和属性有什么区别?


++++++++++++++++++++++++

该面试题的题目为:用C#编写一个桌子类,类中有三个属性:长、宽、高,一个方法,方法的功能为获得桌子的体积。

这是一道不好回答的题吗,有人告诉我吗?难到是我不应该出这样的题吗?到现在为止面试了差不多40人,为什么现在的计算机系的毕业生和知名IT培训企业出来的学生没有一个完全答对的呢,郁闷啊!

参考答案:

class 桌子 {
 
decimal l, w, h;
public
decimal 长 { get { return l; } set { l = value; } }
public
decimal 宽 { get { return w; } set { w = value; } }
public decimal 高 { get { return h; } set { h = value; } }
public decimal 体积() { return * * 高; } }
+++++++++++++++++++++++++++
1、以下代码能否通过编译?如果不能,请改成正确代码,并说明原因。
<html>
   <%
       int subtract(int num1, int num2) {
          return num1-num2;
       }
   %>
   <body>
      <%
         int number = 100;
         while (number > 0) {
            Response.Write("value: " + number + "<br/>");
            number = subtract(number, 1);
         }
      %>
   </body>
</html>
未通过编译:CS1519: 类、结构或接口成员声明中的标记“while”无效——为什么是这个
                    错误呢?不清楚了。
改正:将subtract放在<script runat="server"></script>之间。
<script runat="server">
    int subtract(int num1, int num2)
    {
        return num1 - num2;
    }
</script>
2、float f=-123.567F;
   int i=(int)f;   i的值现在是_____?
   答案:-123  (float f=123.567F时,是123)
3、下面的代码中有什么错误吗?_______
     using System;
     class A
     {
          public virtual void F(){
              Console.WriteLine("A.F");
           }
      }
      abstract class B:A
       {
           public abstract override void F();
       }
   ——编译通过
4、当类T只声明了私有实例构造函数时,则在T的程序文本外部,_不可以_____(可以 or 不可以)从T派生出新的类,____(可以 or 不可以)直接创建T的任何实例。(答案:均受保护级别限制,不可以)
5、下面这段代码有错误么?
    switch (i){
    case():
        CaseZero();
        break;
    case 1:
        CaseOne();
        break;
    case 2:
    default:
        CaseTwo();
        break;
   }
——原题目的default那行是:“dufault;”,我想应该是笔误吧,改为default:后无错,当i为2和其他值时,执行CaseTwo()。
6、在下面的例子里
     using System;
     class A
     {
          public A(){
                PrintFields();
           }
          public virtual void PrintFields(){}
      }
      class B:A
      {
           int x=1;
           int y;
           public B(){
               y=-1;
           }
           public override void PrintFields(){
               Console.WriteLine("x={0},y={1}",x,y);
           }
当使用new B()创建B的实例时,产生什么输出?
答案:输出为x=1,y=0(继承的子类在new时,先new父类对象,然后new自身私有成员,当调用b.PrintFields()时,则输出x=1,y=-1)
7、下面的例子中
     using System;
     class A
     {
          public static int X;
          static A(){
               X=B.Y+1;
          }
      }
      class B
      {
           public static int Y=A.X+1;
           static B(){}
           static void Main(){
                Console.WriteLine("X={0},Y={1}",A.X,B.Y);
           }
       }
产生的输出结果是什么? X=1,Y=2

8、下面这段代码输出什么?为什么?
     int i=5;
     int j=5;
     if (Object.ReferenceEquals(i,j))
          Console.WriteLine("Equal");
     else
          Console.WriteLine("Not Equal");
答案:Not Equal——进行了装箱操作。
+++++++++++++++++++++++++++++++++++++++
1. C#中 property 与 attribute的区别,他们各有什么用处,这种机制的好处在哪里?
2. 讲一讲你理解的web service,在dot net framework中,怎么很好的结合xml?(讲概念就行了)
3. C#, Java 和 c++的特点,有什么相同的地方,不同的地方,C#分别从c++和java中吸取了他们那些优点?
4. C#可否对内存进行直接的操作?(这可是个难点哦?要注意!)
5. 用Visual C++ 6.0编写的代码(unmanaged code),如何在CLR下和其他dot net component结合?
6. 以前作过的一些项目?介绍一下自己的编程经验。(这是蒙混不过去的,基本一问就知道是真是假)
7. 你对公司有什么期望?你的薪水期望值?为什么学计算机?以前的工作经验(这非常重要)?

Q3: 维护数据库的完整性、一致性、你喜欢用触发器还是自写业务逻辑?为什么
Q4:ADO。NET相对于ADO等主要有什么改进?
Q5:ASP。NET与ASP相比,主要有哪些进步?
Q6:C#中的委托是什么?事件是不是一种委托?
Q7:描述一下C#中索引器的实现过程,是否只能根据数字进行索引?
Q8:C#中要使一个类支持FOREACH遍历,实现过程怎样?
Q10:写一个HTML页面,实现以下功能,左键点击页面时显示“您好”,右键点击时显示“禁止右键”。并在2分钟后自动关闭页面。
Q11:你对XMLHTTP、WEBSERVICE 了解吗?简单描述其特点、作用
Q12:接口和抽象类有什么区别?你选择使用接口和抽象类的依据是什么?
Q13:自定义控件和一般用户控件的异同?如果要用这两者之一,你会选择哪种?为什么
Q14:大概描述一下ASP。NET服务器控件的生命周期
Q15:UML
Q16:面向对象的概念,主要特点
Q17:类划分的依据。类粒度问题
Q18:事物管理问题

第一,谈谈final, finally, finalize的区别。
第二,Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?
第三,Static Nested Class 和 Inner Class的不同,说得越多越好(面试题有的很笼统)。
第四,&和&&的区别。
第五,HashMap和Hashtable的区别。
第六,Collection 和 Collections的区别。
第七,什么时候用assert。
第八,GC是什么? 为什么要有GC?
第九,String s = new String("xyz");创建了几个String Object?
第十,Math.round(11.5)等於多少? Math.round(-11.5)等於多少?
第十一,short s1 = 1; s1 = s1 + 1;有什么错? short s1 = 1; s1 += 1;有什么错?
第十二,sleep() 和 wait() 有什么区别?
第十三,Java有没有goto?
第十四,数组有没有length()这个方法? String有没有length()这个方法?
第十五,Overload和Override的区别。Overloaded的方法是否可以改变返回值的类型?
第十六,Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别?
第十七,给我一个你最常见到的runtime exception。
第十八,error和exception有什么区别?
第十九,List, Set, Map是否继承自Collection接口?
第二十,abstract class和interface有什么区别?
第二十一,abstract的method是否可同时是static,是否可同时是native,是否可同时是synchronized?
第二十二,接口是否可继承接口? 抽象类是否可实现(implements)接口? 抽象类是否可继承实体类(concrete class)?
第二十三,启动一个线程是用run()还是start()?
第二十四,构造器Constructor是否可被override?
第二十五,是否可以继承String类?
第二十六,当一个线程进入一个对象的一个synchronized方法后,其它线程是否可进入此对象的其它方法?
第二十七,try {}里有一个return语句,那么紧跟在这个try后的finally {}里的code会不会被执行,什么时候被执行,在return前还是后?
第二十八,编程题: 用最有效率的方法算出2乘以8等於几?
第二十九,两个对象值相同(x.equals(y) == true),但却可有不同的hash code,这句话对不对?
第三十,当一个对象被当作参数传递到一个方法后,此方法可改变这个对象的属性,并可返回变化后的结果,那么这里到底是值传递还是引用传递?
第三十一,swtich是否能作用在byte上,是否能作用在long上,是否能作用在String上?
第三十二,编程题: 写一个Singleton出来。

++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 高级 .NET 面试题,针对高级程序员求职者

A client has the need to upload images to a web site for later serving from that same site as content in an interior page. Of note, due to the high-volume of requests for content, a network load-balancer has been put into place; virtualizing the multiple servers which comprise the presence for this site.

Briefly explain how would you resolve the problem of ensuring that all interior pages which contain these uploaded images are retrievable (regardless of which server behind the NLB they land on)?

You do not need to provide code or database schemas, just your thought processes and what .NET types you may take advantage of.


///

2.
When you (de)serialize data for new .NET projects, what is your preferred method or what methodology do you employ in your selection of the method? Why?

a) If you named something from the System.Runtime.Serialization.Formatters namespace, have you ever had to deal with breaking changes in the wire format (strong named version changes, internal structure changes [i.e. adding a instance field]) and what did you do to resolve that issue?

b) If you named the System.Xml.Serialization.XmlSerializer, what issues/limitations have you found (if any)?

c) If you don't "serialize" per se, but instead populate your business types from a result set obtained via a database or XML document, how do you provide the best development experience for that? As an example, strongly-typed DataSets, a DataTable whose contents are accessed directly (i.e (int)table.Rows[0]["CustomerId"]). What did you do (if anything) to
deal with the inevitability of schema changes?
+++++++++++++++++++++++++++++++++++++++++++++
在C#中,string str = null 与 string str = “” 请尽量使用文字或图象说明其中的区别。
回答要点:说明详细的空间分配。(10分)
答:string str = null 是不给他分配内存空间,而string str = "" 给它分配长度为空字符串的内存空间.
2、请详述在dotnet中类(class)与结构(struct)的异同:(10分)
答:Class可以被实例化,属于引用类型,是分配在内存的堆上的,Struct属于值类型,是分配在内存的栈上的.
3、根据委托(delegate)的知识,请完成以下用户控件中代码片段的填写:(10)
namespace test
{
public delegate void OnDBOperate();
public class UserControlBase : System.Windows.Forms.UserControl
{
public event OnDBOperate OnNew;
privatevoidtoolBar_ButtonClick(objectsender,System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if(e.Button.Equals(BtnNew))
{
//请在以下补齐代码用来调用OnDBOperate委托签名的OnNew事件。
}
}
}
答:if( OnNew != null )
OnNew( this, e );
4、分析以下代码,完成填空(10分)
string strTmp = "abcdefg某9、 公司要求开发一个继承System.Windows.Forms.ListView类的组件,要求达到以下的特殊功能:点击ListView各列列头时, 能按照点击列的每行值进行重排视图中的所有行 (排序的方式如DataGrid相似)。根据您的知识,请简要谈一下您的思路:(10)
答:根据点击的列头,包该列的ID取出,按照该ID排序后,在给绑定到ListView中
10、给定以下XML文件,完成算法流程图。(10)
<FileSystem>
< DriverC >
<Dir DirName=”MSDOS622”>
<File FileName =” Command.com” ></File>
</Dir>
<File FileName =”MSDOS.SYS” ></File>
<File FileName =” IO.SYS” ></File>
</DriverC>
</FileSystem>
请画出遍历所有文件名(FileName)的流程图(请使用递归算法)。
答:
void FindFile( Directory d )
{
FileOrFolders = d.GetFileOrFolders();
foreach( FileOrFolder fof in FileOrFolders )
{
if( fof is File )
You Found a file;
else if ( fof is Directory )
FindFile( fof );
}
}
简单的说就是从根节点开始遍历找子节点,在从找到的子节点找它的子节点,一层层下去
++++++++++++++++++++++++++++++++++++++++++++++++
题目:猫叫,老鼠逃跑,主人惊醒。(10分)

要点:1. 联动效果,运行代码只要执行Cat.Cryed()方法。2. 对老鼠和主人进行抽象
评分标准: <1>.构造出Cat、Mouse、Master三个类,并能使程序运行(2分)
<2>从Mouse和Master中提取抽象(5分)
<3>联动效应,只要执行Cat.Cryed()就可以使老鼠逃跑,主人惊醒。(3分)
1using System;
2using System.Collections;
3
4namespace ConsoleApplication1
5{
6 public interface Observer
7 {
8 void Response(); //观察者的响应,如是老鼠见到猫的反映
9 }
10 public interface Subject 11 {
12 void AimAt(Observer obs); //针对哪些观察者,这里指猫的要扑捉的对象---老鼠
13 }

14
15 public class Mouse : Observer
16 {
17 private string name;
18 public Mouse(string name, Subject subj)
19 {
20 this.name = name;
21 subj.AimAt(this);
22 }
23
24 public void Response()
25 {
26 Console.WriteLine(name + " attempt to escape!");
27 }
28 }
29
30 public class Master : Observer
31 {
32 public Master(Subject subj)
33 {
34 subj.AimAt(this);
35 }
36
37 public void Response()
38 {
39 Console.WriteLine("Host waken!");
40 }
41 }
42
43
44 public class Cat : Subject
45 {
46 private ArrayList observers;
47 public Cat()
48 {
49 this.observers = new ArrayList();
50 }
51 public void AimAt(Observer obs)
52 {
53 this.observers.Add(obs);
54 }
55 public void Cry()
56 {
57 Console.WriteLine("Cat cryed!");
58 foreach (Observer obs in this.observers)
59 {
60 obs.Response();
61 }
62 }
63 }
64
65 class MainClass
66 {
67 /** <summary>
68 /// 应用程序的主入口点。
69 /// </summary>
70 [STAThread]
71 static void Main(string[] args)
72 {
73 Cat cat = new Cat();
74 Mouse mouse1 = new Mouse("mouse1", cat);
75 Mouse mouse2 = new Mouse("mouse2", cat);
76 Master master = new Master(cat);
77 cat.Cry();
78 }
79 }
80}

参考答案二:使用event -- delegate设计..
1using System;
2using System.Collections;
3
4
5namespace ConsoleApplication1
6{
7 public delegate void SubEventHandler();
8 public abstract class Subject
9 {
10 public event SubEventHandler SubEvent;
11 protected void FireAway()
12 {
13 if (this.SubEvent != null)
14 this.SubEvent();
15 }
16 }
17 public class Cat : Subject
18 {
19 public void Cry()
20 {
21 Console.WriteLine("cat cryed.");
22 this.FireAway();
23 }
24 }
25
26 public abstract class Observer
27 {
28 public Observer(Subject sub)
29 {
30 sub.SubEvent += new SubEventHandler(Response);
31 }
32 public abstract void Response();
33 }
34 public class Mouse : Observer
35 {
36 private string name;
37 public Mouse(string name, Subject sub) : base(sub)
38 {
39 this.name = name;
40 }
41 public override void Response()
42 {
43 Console.WriteLine(name + " attempt to escape!");
44 }
45 }
46 public class Master : Observer
47 {
48 public Master(Subject sub) : base(sub){}
49 public override void Response()
50 {
51 Console.WriteLine("host waken");
52 }
53 }
54
55 class MainClass
56 {
57 /** <summary>
58 /// 应用程序的主入口点。
59 /// </summary>
60 [STAThread]
61 static void Main(string[] args)
62 {
63 Cat cat = new Cat();
64 Mouse mouse1 = new Mouse("mouse1", cat);
65 Mouse mouse2 = new Mouse("mouse2", cat);
66 Master master = new Master(cat);
67 cat.Cry();
68 }
69 }
70}

1using System;
2using System.Collections;
3
4namespace ConsoleApplication1
5{
6 public interface Observer
7 {
8 void Response(); //观察者的响应,如是老鼠见到猫的反映
9 }
10 public interface Subject 11 {
12 void AimAt(Observer obs); //针对哪些观察者,这里指猫的要扑捉的对象---老鼠
13 }

14
15 public class Mouse : Observer
16 {
17 private string name;
18 public Mouse(string name, Subject subj)
19 {
20 this.name = name;
21 subj.AimAt(this);
22 }
23
24 public void Response()
25 {
26 Console.WriteLine(name + " attempt to escape!");
27 }
28 }
29
30 public class Master : Observer
31 {
32 public Master(Subject subj)
33 {
34 subj.AimAt(this);
35 }
36
37 public void Response()
38 {
39 Console.WriteLine("Host waken!");
40 }
41 }
42
43
44 public class Cat : Subject
45 {
46 private ArrayList observers;
47 public Cat()
48 {
49 this.observers = new ArrayList();
50 }
51 public void AimAt(Observer obs)
52 {
53 this.observers.Add(obs);
54 }
55 public void Cry()
56 {
57 Console.WriteLine("Cat cryed!");
58 foreach (Observer obs in this.observers)
59 {
60 obs.Response();
61 }
62 }
63 }
64
65 class MainClass
66 {
67 /** <summary>
68 /// 应用程序的主入口点。
69 /// </summary>
70 [STAThread]
71 static void Main(string[] args)
72 {
73 Cat cat = new Cat();
74 Mouse mouse1 = new Mouse("mouse1", cat);
75 Mouse mouse2 = new Mouse("mouse2", cat);
76 Master master = new Master(cat);
77 cat.Cry();
78 }
79 }
80}

 

 

 

参考答案二:使用event -- delegate设计..

1using System;
2using System.Collections;
3
4
5namespace ConsoleApplication1
6{
7 public delegate void SubEventHandler();
8 public abstract class Subject
9 {
10 public event SubEventHandler SubEvent;
11 protected void FireAway()
12 {
13 if (this.SubEvent != null)
14 this.SubEvent();
15 }
16 }
17 public class Cat : Subject
18 {
19 public void Cry()
20 {
21 Console.WriteLine("cat cryed.");
22 this.FireAway();
23 }
24 }
25
26 public abstract class Observer
27 {
28 public Observer(Subject sub)
29 {
30 sub.SubEvent += new SubEventHandler(Response);
31 }
32 public abstract void Response();
33 }
34 public class Mouse : Observer
35 {
36 private string name;
37 public Mouse(string name, Subject sub) : base(sub)
38 {
39 this.name = name;
40 }
41 public override void Response()
42 {
43 Console.WriteLine(name + " attempt to escape!");
44 }
45 }
46 public class Master : Observer
47 {
48 public Master(Subject sub) : base(sub){}
49 public override void Response()
50 {
51 Console.WriteLine("host waken");
52 }
53 }
54
55 class MainClass
56 {
57 /** <summary>
58 /// 应用程序的主入口点。
59 /// </summary>
60 [STAThread]
61 static void Main(string[] args)
62 {
63 Cat cat = new Cat();
64 Mouse mouse1 = new Mouse("mouse1", cat);
65 Mouse mouse2 = new Mouse("mouse2", cat);
66 Master master = new Master(cat);
67 cat.Cry();
68 }
69 }
70}

 

+++++++++++++++++++++++++====++++++++++

  1. C#中与数据库操作ADO.NET相关的面试题

    • What is the role of the DataReader class in ADO.NET connections?
      It returns a read-only, forward-only rowset from the data source.  A DataReader provides fast access when a forward-only sequential read is needed.  
       
    • What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
      SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix.  OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET. 
       
    • What is the wildcard character in SQL? www.MianNiu.com(面试大牛网)
      Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’. 
       
    • Explain ACID rule of thumb for transactions.
      A transaction must be:
      1.       Atomic - it is one unit of work and does not dependent on previous and following transactions.
      2.       Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.
      3.       Isolated - no transaction sees the intermediate results of the current transaction).
      4.       Durable - the values persist if the data had been committed even if the system crashes right after. 
       
    • What connections does Microsoft SQL Server support?
      Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password). 
       
    • Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
      Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction. 
       
    • What does the Initial Catalog parameter define in the connection string?
      The database name to connect to. 
        
    • What does the Dispose method do with the connection object?
      Deletes it from the memory.
      To Do: answer better.  The current answer is not entirely correct. 
       
    • What is a pre-requisite for connection pooling?
      Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.  The connection string must be identical.


 

<script type=text/javascript> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript> </script> <script> window.google_render_ad(); </script>

C#面向对象(类设计相关)的面试题

  1. What is the syntax to inherit from a class in C#?
    Place a colon and then the name of the base class.
    Example: class MyNewClass : MyBaseClass 
     
  2. Can you prevent your class from being inherited by another class?
    Yes.  The keyword “sealed” will prevent the class from being inherited. 
     
  3. Can you allow a class to be inherited, but prevent the method from being over-ridden?
    Yes.  Just leave the class public and make the method sealed. 
     
  4. What’s an abstract class?
    A class that cannot be instantiated.  An abstract class is a class that must be inherited and have the methods overridden.  An abstract class is essentially a blueprint for a class without any implementation. 
     
  5. When do you absolutely have to declare a class as abstract?
    1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
    2.  When at least one of the methods in the class is abstract. 
     
  6. What is an interface class?
    Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. 
     
  7. Why can’t you specify the accessibility modifier for methods inside the interface?
    They all must be public, and are therefore public by default. 
     
  8. Can you inherit multiple interfaces? www.MianNiu.com(面试大牛网)
    Yes.  .NET does support multiple interfaces. 
     
  9. What happens if you inherit multiple interfaces and they have conflicting method names?
    It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.
    To Do: Investigate 
     
  10. What’s the difference between an interface and abstract class?
    In an interface class, all methods are abstract - there is no implementation.  In an abstract class some methods can be concrete.  In an interface class, no accessibility modifiers are allowed.  An abstract class may have accessibility modifiers. 
     
  11. What is the difference between a Struct and a Class?
    Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval.  Another difference is that structs cannot inherit.

++++++++++++++++++++++++++

C#常规面试题

  1. Does C# support multiple-inheritance?
    No.
     
  2. Who is a protected class-level variable available to?
    It is available to any sub-class (a class inheriting this class).
     
  3. Are private class-level variables inherited?
    Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited. 
     
  4. Describe the accessibility modifier “protected internal”.
    It is available to classes that are within the same assembly and derived from the specified base class. 
     
  5. What’s the top .NET class that everything is derived from?
    System.Object. 
     
  6. What does the term immutable mean?
    The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory. 
     
  7. What’s the difference between System.String and System.Text.StringBuilder classes?
    System.String is immutable.  System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. 
     
  8. What’s the advantage of using System.Text.StringBuilder over System.String?
    StringBuilder is more efficient in cases where there is a large amount of string manipulation.  Strings are immutable, so each time a string is changed, a new instance in memory is created.
     
  9. Can you store multiple data types in System.Array?
    No. 
     
  10. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
    The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array.  The CopyTo() method copies the elements into another existing array.  Both perform a shallow copy.  A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array.  A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.
     
  11. How can you sort the elements of the array in descending order?
    By calling Sort() and then Reverse() methods. 
     
  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?­
    Yes.
     
  15. What’s the C# syntax to catch any possible exception?
    A catch block that catches the exception of type System.Exception.  You can also omit the parameter data type in this case and just write catch {}. 
     
  16. Can multiple catch blocks be executed for a single try statement?
    No.  Once the proper catch block processed, control is transferred to the finally block (if there are any). 
     
  17. Explain the three services model commonly know as a three-tier application.
    Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值