当前位置: 代码迷 >> ASP.NET >> 分享面试题与求解答案,该怎么解决
  详细解决方案

分享面试题与求解答案,该怎么解决

热度:4975   发布时间:2013-02-25 00:00:00.0
分享面试题与求解答案
(1)自我评估

自我评估三道题:

(a)请估计你的编码量(机器生成的代码不算)

(b)你使用过什么源代码管理工具?(只使用过一、两次的不算)

(c)你习惯使用什么样的开发工具/IDE?

(2)机试

一个hello world题。主要考察基本的OO设计及编码风格。

C#版:

(a)写一个类Message,该类具备以下成员:

·一个名为message,储存消息文本;

·一个方法Show(),打印消息文本;

·一个构造函数,根据传递的字符串,初始化消息文本。

·其它你认为需要的东西

(b)调用Message的实例,打印“hello world”。。

(3)请谈谈 DataTable, DataSet, DataAdapter的角色与功能

(4)简答题

(a) 谈谈你对facade模式的理解与心得

(b) 谈谈你对.net framework的理解与使用心得

(c) 想产生一个数列:T(n) = T(n-1),n,T(n-1),T(0) = 1

比如T(3)是1,2,1,3,1,2,1

T(4)是1,2,1,3,1,2,1,4,1,2,1,3,1,2,1

不用递归有什么效率高的算法吗?

------解决方案--------------------------------------------------------
除了算法没看,因为我数学不好,直接跳过了.其他的貌似有点小简单.谢谢分享
------解决方案--------------------------------------------------------
facade模式 惭愧...
------解决方案--------------------------------------------------------
不用递归有什么效率高的算法吗?

考人啊。
------解决方案--------------------------------------------------------
让上网用GOOGLE哇?
------解决方案--------------------------------------------------------
mark
------解决方案--------------------------------------------------------
facade是什么?
------解决方案--------------------------------------------------------
(b)vss
(c)vs
using System; 
public class HelloWorld 

public string strHelloWorld 

get 

return "Hello World"; 



public static void Main() 

HelloWorld hw = new HelloWorld(); 
Console.WriteLine(cs.strHelloWorld); 


Facade(外观)模式
Facade设计模式更从架构的层次去看系统,而不是单个类的层次。Facade很多时候更是一种架构设计模式。
------解决方案--------------------------------------------------------
看看
------解决方案--------------------------------------------------------
理论上讲不用递归可以使用栈
------解决方案--------------------------------------------------------
想知道最后一题
------解决方案--------------------------------------------------------
学习
------解决方案--------------------------------------------------------
xx
------解决方案--------------------------------------------------------
学习
------解决方案--------------------------------------------------------
看看
------解决方案--------------------------------------------------------
.....没几个会的
------解决方案--------------------------------------------------------
还好,不太难,只是没估计过自己的代码量
------解决方案--------------------------------------------------------
facade模式要求一个子系统的外部与其内部的通信必须通过一个统一的门面(Facade)对象进行。门面模式提供一个高层次的接口,使得子系统更易于使用。

即里面无论多莫复杂,对外只提供一个统一接口


------解决方案--------------------------------------------------------
网上找了个facade模式例子
C# code
 using System;public class Camera{  public void TurnOn()  {    Console.WriteLine("Turning on the camera.");  }  public void TurnOff()  {    Console.WriteLine("Turning off the camera.");  }  public void Rotate(int degrees)  {    Console.WriteLine("Rotating the camera by {0} degrees.", degrees);  }}public class Light{  public void TurnOff()  {    Console.WriteLine("Turning on the light.");  }  public void TurnOn()  {    Console.WriteLine("Turning off the light.");  }  public void ChangeBulb()  {    Console.WriteLine("changing the light-bulb.");  }}public class Sensor{  public void Activate()  {    Console.WriteLine("Activating the sensor.");  }  public void Deactivate()  {    Console.WriteLine("Deactivating the sensor.");  }  public void Trigger()  {    Console.WriteLine("The sensor has triggered.");  }}public class Alarm{  public void Activate()  {    Console.WriteLine("Activating the alarm.");  }  public void Deactivate()  {    Console.WriteLine("Deactivating the alarm.");  }  public void Ring()  {    Console.WriteLine("Ringing the alarm.");  }  public void StopRing()  {    Console.WriteLine("Stop the alarm.");  }}public class Client{  private static Camera camera1, camera2;  private static Light light1, light2, light3;  private static Sensor sensor;  private static Alarm alarm;  static Client()  {    camera1 = new Camera();    camera2 = new Camera();    light1 = new Light();    light2 = new Light();    light3 = new Light();    sensor = new Sensor();    alarm = new Alarm();  }    public static void Main( string[] args )  {    camera1.TurnOn();    camera2.TurnOn();    light1.TurnOn();    light2.TurnOn();    light3.TurnOn();    sensor.Activate();    alarm.Activate();  }}
  相关解决方案