

















1.将手机号转化为由随机字母表示?
2.描述数据适配器中的多表查询?
3.调用存储过程及返回值的提取?
4.SQL中游标的定义?
5.ASP.NET中,用手工的形式对字段进行数据绑定及分页方法?
6.有一人事表,计算两个同时入职的员工的生日的差,用一句 SQL语句 将EGTB1中的结果变成EGTB2的结果?
Field_AField_BField_C
User12004-10-261981-01-01
User22004-10-261976-01-01
………
Question 31. (单选)
根据线程安全的相关知识,分析以下代码,当调用test方法时i>10时是否会引起死锁?
public void test(int i)
{
lock(this)
{
if (i>10)
{
i--;
test(i);
}
}
}
1. 会锁死
2. 不会锁死
Question 32. (单选)
以下描述错误的是()
1. 在C++中支持抽象类而在C#中不支持抽象类。
2. C++中可在头文件中声明类的成员而在CPP文件中定义类的成员,在C#中没有头文件并且在同一处声明和定义类的成员。
3. 在C#中可使用 new 修饰符显式隐藏从基类继承的成员。
4. 在C#中要在派生类中重新定义基类的虚函数必须在前面加Override。
Question 33. (单选)
int[][] myArray3=new int[3][]{new int[3]{5,6,2},new int[5]{6,9,7,8,3},new int[2]{3,2}}; myArray3[2][2]的值是()。
1. 9
2. 2
3. 6
4. 越界
Question 34. (单选)
在C#中利用Socket进行网络通信编程的一般步骤是:建立Socket侦听、( )、利用Socket接收和发送数据。
1. 建立Socket连接
2. 获得端口号;
3. 获得IP地址;
4. 获得主机名;
Question 35. (单选)
如果设treeView1=new TreeView(),TreeNode node=new TreeNode("根结点" ),则treeView1.Nodes.Add(node)返回的是一个 ()类型的值。
1. TreeNode;
2. int;
3. string;
4. TreeView;
Question 36. (单选)
声明一个委托public delegate int myCallBack(int x); 则用该委托产生的回调方法的原型应该是
1. void myCallBack(int x)
2. int receive(int num)
3. string receive(int x)
4. 不确定的
Question 37. (单选)
关于ASP.NET中的代码隐藏文件的描述正确的是
1. Web窗体页的程序的逻辑由代码组成,这些代码的创建用于与窗体交互。编程逻辑唯一与用户界面不同的文件中。该文件称作为“代码隐藏”文件,如果用C#创建,该文件
2. 项目中所有Web窗体页的代码隐藏文件都被编译成.EXE文件
3. 项目中所有的Web窗体页的代码隐藏文件都被编译成项目动态链接库(.dll)文件
4. 以上都不正确
Question 38. (单选)
What compiler switch creates an xml file from the xml comments in the files in an assembly?
1. /text
2. /doc
3. /xml
4. /help
Question 39. (单选)
下面的代码实现了设计模式中的什么模式
public class A {
private A instance;
private A() {
}
public static A Instance {
get
{
if ( A == null )
A = new A();
return instance;
}
}
}
1. Factory
2. Abstract Factory
3. Singleton
4. Builder
Question 40. (单选)
class Class1
{
public static int Count = 0;
static Class1()
{
Count++;
}
public Class1()
{
Count++;
}
}
Class1 o1 = new Class1();
Class1 o2 = new Class1();
请问,Class1.Count的值是多少?( )
1. 1
2. 2
3. 3
4. 4
Question 41. (单选)
abstract class BaseClass
{
public virtual void MethodA()
{
Console.WriteLine("BaseClass");
}
public virtual void MethodB()
{
}
}
class Class1: BaseClass
{
public void MethodA()
{
Console.WriteLine("Class1");
}
public override void MethodB()
{
}
}
class Class2: Class1
{
new public void MethodB()
{
}
}
class MainClass
{
public static void Main(string[] args)
{
Class2 o = new Class2();
o.MethodA();
}
}
请问,此程序输出结果是:
1. BaseClass
2. BassClass Class1
3. Class1
4. Class1 BassClass
Question 42. (单选)
public static void Main(string[] args)
{
int i = 2000;
object o = i;
i = 2001;
int j =(int) o;
Console.WriteLine("i={0},o={1}, j={2}",i,o,j);
}
1. i=2001,o=2000,j=2000
2. i=2001,o=2001,,j=2001
3. i=2000,o=2001,,j=2000
4. i=2001,o=2000,j=2001
Question 43. (多选)
您要创建ASP.NET应用程序用于运行AllWin公司内部的Web站点,这个应用程序包含了50个页面。您想要配置这个应用程序以便当发生一个HTTP代码错误时它可以显示一个自定义的错误页面给用户。您想要花最小的代价完成这些目标,您应该怎么做?(多选)
1. 在这个应用程序的Global.asax文件中创建一个Application_Error过程去处理ASP.NET代码错误。
2. 在这个应用程序的Web.config文件中创建一个applicationError节去处理ASP.NET代码错误。
3. 在这个应用程序的Global.asax文件中创建一个CustomErrors事件去处理HTTP错误。
4. 在这个应用程序的Web.config文件中创建一个CustomErrors节去处理HTTP错误。
Question 44. (单选)
如下程序的运行结果是:
public abstract class A
{
public A()
{
Console.WriteLine('A');
}
public virtual void Fun()
{
Console.WriteLine("A.Fun()");
}
}
public class B: A
{
public B()
{
Console.WriteLine('B');
}
public new void Fun()
{
Console.WriteLine("B.Fun()");
}
public static void Main()
{
A a = new B();
a.Fun();
}
}
1. A B A.Fun()
2. A B B.Fun()
3. B A A.Fun()
4. B A B.Fun()
Question 45. (单选)
Which of these string definitions will prevent escaping on backslashes in C#?*
1. string s = #”n Test string”;
2. string s = “’n Test string”;
3. string s = @”n Test string”;
4. string s = “n Test string”;
Question 46. (单选)
Which of the following operations can you NOT perform on an ADO.NET DataSet?
1. A DataSet can be synchronised with a RecordSet.
2. A DataSet can be synchronised with the database.
3. A DataSet can be converted to XML.
4. You can infer the schema from a DataSet
Question 47. (单选)
In Object Oriented Programming, how would you describe encapsulation?
1. The conversion of one type of object to another.
2. The runtime resolution of method calls.
3. The exposition of data.
4. The separation of interface and implementation.
Question 48. (单选)
How does assembly versioning in .NET prevent DLL Hell?
1. The runtime checks to see that only one version of an assembly is on the machine at any one time.
2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run.
3. The compiler offers compile time checking for backward compatibility.
4. It doesn’t.
Question 49. (单选)
三种常用的字符串判空串方法:
1: bool isEmpty = (str.Length == 0);
2: bool isEmpty = (str == String.Empty);
3: bool isEmpty = (str == "");
哪种方法最快?
1. 1
2. 2
3. 3
Question 50. (单选)
public sealed class SampleSingleton1
{
private int m_Counter = 0;
private SampleSingleton1()
{
Console.WriteLine(""初始化SampleSingleton1。"");
}
public static readonly SampleSingleton1 Singleton = new SampleSingleton1();
public void Counter()
{
m_Counter ++;
}
}
以上代码实现了设计模式中的哪种模式?
1. 原型
2. 抽象工厂
3. 单键
4. 生成器
1.<%# %> 和 <% %> 有什么区别?
<%# %>表示绑定的数据源
<% %>是服务器端代码块
2.以下代码能否通过编译?如果不能,请改成正确代码,并说明原因。
<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>
3.通过Web Site Administration Tool (in VS2005) 可以实现哪些功能?Web Site Administration Tool 会自动对哪些文件进行修改或添加?
4.解释一下带 “original_” 前缀的Data Parameter和不带前缀的Data Parameter有什么异同。(可用简单的代码说明)
5.修改下面的代码段,使GridView能Update数据。
<%@ Page Language="C#" %>
<html>
<head runat="server">
<title>GridView</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" AllowSorting="true" AllowPaging="true" Runat="server"
DataSourceID="SqlDataSource1" DataKeyNames="id" AutoGenerateColumns="False">
<Columns>
<asp:BoundField ReadOnly="true" HeaderText="ID" DataField="id" SortExpression="id" />
<asp:BoundField HeaderText="Last Name" DataField="lname" SortExpression="lname" />
<asp:BoundField HeaderText="First Name" DataField="fname" SortExpression="fname" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" Runat="server"
SelectCommand="SELECT [id], [lname], [fname] FROM [authors]"
ConnectionString="<%$ ConnectionStrings:Pubs %>" />
</form>
</body>
</html>
6.GridView没有内置Insert 数据的功能,如果想在GridView内Insert数据,你有什么想法?
7.ASP.NET 2.0 哪个(些)特性是你觉得最激动人心的?为什么?(也可以谈C#2.0)
ASP.NET 2.0相对于1.1突出了3大理念,
1,提高生产力
A 一致性(masterpage)
B 会员管理
C 资料存取
D 个性化
2 管理能力的提高(例如WEB.CONFIG)
3 提升效能,满足更多人的访问
8.你觉得ASP.NET 2.0(VS2005)和你以前使用的开发工具(.Net 1.0或其他)有什么最大的区别?你在以前的平台上使用的哪些开发思想(pattern / architecture)可
以移植到ASP.NET 2.0上 (或者已经内嵌在ASP.NET 2.0中)
1 ASP.NET 2.0 把一些代码进行了封装打包,所以相比1.0相同功能减少了很多代码.
2 同时支持代码分离和页面嵌入服务器端代码两种模式,以前1.0版本,.NET提示帮助只有在分离的代码文件,无法在页面嵌入服务器端代码获得帮助提示,
3 代码和设计界面切换的时候,2.0支持光标定位.这个我比较喜欢
4 在绑定数据,做表的分页.UPDATE,DELETE,等操作都可以可视化操作,方便了初学者
5, 在ASP.NET中增加了40多个新的控件,减少了工作量
9.把你在学习过程中做过的demo发一个给我,或者把你做过的demo组合在一个项目中发给我
1、override与重载的区别
2、.net的错误处理机制是什么
3、C#中接口和类的异同
4、DataReader和DataSet的异同
Override用来重写父类的方法,重载使用相同名的方法或操作符拥有不同类型的参数
.net错误处理机制采用try->catch->finally结构,发生错误时,层层上抛,直到找到匹配的Catch为止。
接口和类都是类,不同的事,接口只包含方法或属性的声明,不包含具体实现方法的代码,接口可以实现多继承,而类只能是单继承,继承接口的类必须实现接口中声明的方法或属性。接口主要定义一种规范,统一调用方法,在大型项目中接口正发挥日益重要的作用。
DataReader用于读取数据,DataSet用于在内存中保存数据。
重载与覆盖的区别
1、方法的覆盖是子类和父类之间的关系,是垂直关系;方法的重载是同一个类中方法之间的关系,是水平关系。
2、覆盖只能由一个方法,或只能由一对方法产生关系;方法的重载是多个方法之间的关系。
3、覆盖要求参数列表相同;重载要求参数列表不同。
4、覆盖关系中,调用那个方法体,是根据对象的类型(对象对应存储空间类型)来决定;重载关系,是根据调用时的实参表与形参表来选择方法体的。
4、DataReader和DataSet的异同
DataReader和DataSet最大的区别在于,DataReader使用时始终占用SqlConnection,在线操作数据库..任何对SqlConnection的操作都会引发DataReader的异常..因为DataReader每次只在内存中加载一条数据,所以占用的内存是很小的..因为DataReader的特殊性和高性能.所以DataReader是只进的..你读了第一条后就不能再去读取第一条了..
DataSet则是将数据一次性加载在内存中.抛弃数据库连接..读取完毕即放弃数据库连接..因为DataSet将数据全部加载在内存中.所以比较消耗内存...但是确比DataReader要灵活..可以动态的添加行,列,数据.对数据库进行回传更新操作...
一.填空题
1.c#中的三元运算符是_____?
2.当整数a赋值给一个object对象时,整数a将会被_____?
3.类成员有_____种可访问形式?
4.public static const int A=1;这段代码有错误么?是什么?
5.float f=-123.567F;
int i=(int)f;
i的值现在是_____?
6.利用operator声明且仅声明了==,有什么错误么?
7.委托声明的关键字是______?
8.用sealed修饰的类有什么特点?
9.在Asp.net中所有的自定义用户控件都必须继承自________?
10.在.Net中所有可序列化的类都被标记为_____?
11.在.Net托管代码中我们不用担心内存漏洞,这是因为有了______?
12.下面的代码中有什么错误吗?_______
using System;
class A
{
public virtual void F(){
Console.WriteLine("A.F");
}
}
abstract class B:A
{
public abstract override void F();
}
13.当类T只声明了私有实例构造函数时,则在T的程序文本外部,______(可以 or 不可以)从T
派生出新的类,____(可以 or 不可以)直接创建T的任何实例。
14.下面这段代码有错误么?
switch (i){
case():
CaseZero();
break;
case 1:
CaseOne();
break;
case 2:
dufault;
CaseTwo();
break;
}
15.在.Net中,类System.Web.UI.Page 可以被继承么?
二.简答题
1.在c#中using和new这两个关键字有什么意义,请写出你所知道的意义?
2.在下面的例子里
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的实例时,产生什么输出?
3.下面的例子中
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);
}
}
产生的输出结果是什么?
4.谈谈类和结构的区别?
5.一个长度为10000的字符串,通过随机从a-z中抽取10000个字符组成。请用c#语言编写主要程
序来实现。
6.对于这样的一个枚举类型:
enum Color:byte{
Red,
Green,
Blue,
Orange
}
试写一段程序显示出枚举类型中定义的所有符号名称以及它们对应的数值。
7.您了解设计模式么?请列出您所知道的设计模式的名称。
8.请在SQL Server中设计表来保存一个树状结构的组织结构图(假设结构图中只有名称这一项内容
需要保存),如果我想查询某一职位下的所有职位,用一个存储过程来实现,你有什么思路?
9.什么叫做SQL注入,如何防止?请举例说明。
10.下面这段代码输出什么?为什么?
int i=5;
int j=5;
if (Object.ReferenceEquals(i,j))
Console.WriteLine("Equal");
else
Console.WriteLine("Not Equal");
1 ?:
2 装箱
3 3种
4 const成员都是static所以应该去掉static
5 -123
6 要同时修改Equale和GetHash() ? 重载了"==" 就必须重载 "!="
7 delegate
8 不可被继承
9 System.Web.UI.UserControl
10 [serializable]
11 gC
12 abstract override 是不可以一起修饰
13 不可以,不可以
14 case():不行 default;
15 可以
1 Using 引入一个名子空间,或在使用了一个对像后自动调用其IDespose,New 实例化一个对
像,或修饰一个方法,表此方法完全重写此方法,
2 X=1,Y=0
3 x=1,y=2
4 最大区别一个是引用类型,一个是值类型 默认成员访问为public是另外一个区别
.NET & C# 基础知识试题 (20%)
1. 在.net(C# or vb.net)中如何获得当前窗体或控件的句柄,特别是控件本身的句柄(请列举)。
答案:this(C#) Me(vb.net).
2. 在.net(C# or vb.net)中如何用户自定义消息,并在窗体中处理这些消息。
答案:
在form中重载DefWndProc函数来处理消息:
protected override void DefWndProc ( ref System.WinForms.Message m )
{
switch(m.msg)
{
case WM_Lbutton :
///string与MFC中的CString的Format函数的使用方法有所不同
string message = string.Format("收到消息!参数为:{0},{1}",m.wParam,m.lParam);
MessageBox.Show(message);///显示一个消息框
break;
case USER:
处理的代码
default:
base.DefWndProc(ref m);///调用基类函数处理非自定义消息。
break;
}
}
3. 在.net(C# or vb.net)如何启动另一个程序。
答案:process
4. 在.net(C# or vb.net)中如何取消一个窗体的关闭。
答案:
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel=true;
}
5. 在.net(C# or vb.net)中,Appplication.Exit 还是 Form.Close有什么不同?
答案:一个是退出整个应用程序,一个是关闭其中一个form
6. 在C#中有一个double型的变量,比如10321.5,比如122235401.21644,作为货币的值如何按各个不同国家的习惯来输出。比如美国用$10,321.50和$122,235,401.22而在英国则为£10 321.50和£122 235 401.22
答案:
System.Globalization.CultureInfo MyCulture = new System.Globalization.CultureInfo("en-US");
//System.Globalization.CultureInfo MyCulture = new System.Globalization.CultureInfo("en-GB");为英国货币类型
decimal y = 9999999999999999999999999999m;
string str = String.Format(MyCulture,"My amount = {0:c}",y);
7. 某一密码仅使用K、L、M、N、O共5个字母,密码中的单词从左向右排列,密码单词必须遵循如下规则:
(1) 密码单词的最小长度是两个字母,可以相同,也可以不同
(2) K不可能是单词的第一个字母
(3) 如果L出现,则出现次数不止一次
(4) M不能使最后一个也不能是倒数第二个字母
(5) K出现,则N就一定出现
(6) O如果是最后一个字母,则L一定出现
问题一:下列哪一个字母可以放在LO中的O后面,形成一个3个字母的密码单词?
A) K B)L C) M D) N
答案:B
问题二:如果能得到的字母是K、L、M,那么能够形成的两个字母长的密码单词的总数是多少?
A)1个 B)3个 C)6个 D)9个
答案:A
问题三:下列哪一个是单词密码?
A) KLLN B) LOML C) MLLO D)NMKO
答案:C
8. 62-63=1 等式不成立,请移动一个数字(不可以移动减号和等于号),使得等式成立,如何移动?
答案:62移动成2的6次方
A while back, I posted a list of ASP.NET Interview Questions. Conventional wisdom was split, with about half the folks saying I was nuts and that it was a list of trivia. The others said basically "Ya, those are good. I'd probably have to look a few up." To me, that's the right response.
Certainly I wasn't trying to boil all of .NET Software Development down to a few simple "trivia" questions. However, I WAS trying to get folks thinking. I believe that really good ASP.NET (and for that matter, WinForms) is a little [read: lot] more than just draging a control onto a designer and hoping for the best. A good race driver knows his car - what it can do and what it can't.
So, here's another list...a greatly expanded list, for your consumption (with attribution). I wrote this on a plane last week on the way from Boise to Portland. I tried to take into consideration the concerns that my lists contain unreasonable trivia. I tried to make a list that was organized by section. If you've never down ASP.NET, you obviously won't know all the ASP.NET section. If you're an indenpendant consultant, you may never come upon some of these concepts. However, ever question here has come up more than once in the last 4 years of my time at Corillian. So, knowing groking these questions may not make you a good or bad developer, but it WILL save you time when problems arise.
What Great .NET Developers Ought To Know
Everyone who writes code
Mid-Level .NET Developer
Senior Developers/Architects
C# Component Developers
ASP.NET (UI) Developers
Developers using XML
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。