这些是C#和ASP.NET数据库面试题,全部从网上收集而来,经整理而发表,希望给大家带来帮助,有错误的地方还请各位高手指出,在下倾听指教。
These are the interviews for the C# and ASP.NET databases, which are all collected from the Internet and published in the hope that they will be of help to all.
1. 简述private、protected、public、internal 修饰符的访问权限。
1. & nbsp; provides a brief description of access rights for private, protected, public, internal modifiers.
答. private : 私有成员, 在类的内部才可以访问。
Answer. Pravate: Private members, can only be accessed within the class.
protected: 保护成员,该类内部和继承类中可以访问。
Protected: Protection of members, which is accessible both internally and in the succession category.
public: 公共成员,完全公开,没有访问限制。
Public membership, totally public, with no access restrictions.
internal:在同一命名空间内可以访问。
International: Accessible in the same namespace.
2 .列举ASP.NET 页面之间传递值的几种方式。
答.
Answer.
1.使用QueryString, 如....?id=1; response.Redirect()....
1. Use Query String, e.g....?id=1; recall.Redirect()....
2.使用Session变量
2. Use of Session variables
3.使用Server.Transfer
3. Use Server.Transfer
4.使用Application
4. Use of application
5.使用Cache
5. Use Cache
6使用HttpContext的Item属性
6 Using the Item Properties of HttpContext
7.使用文件
7. Use of documents
8.使用数据库
8. Access to databases
9.使用Cookie
9. Use Cookie
3. 一列数的规则如下: 1、1、2、3、5、8、13、21、34...... 求第30位数是多少, 用递归算法实现。
3. The rules in one row are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 What is the 30th number, to be achieved by a regression algorithm.
答:public class MainClass
Answer: public class MainClass
{
public static void Main()
{
Console.WriteLine(Foo(30));
}
public static int Foo(int i)
{
if (i <=0)
return 0;
else if(i > 0 && i <=2)
return 1;
else return Foo(i -1) + Foo(i - 2);
}
}
4.C#中的委托是什么?事件是不是一种委托?
What was the commission in 4/span>.C#? Was the event a commission?
答 :
Answer:
委托可以把一个方法作为参数代入另一个方法。
The commission can replace one method with another as a parameter.
委托可以理解为指向一个函数的引用。
The commission can be understood as a reference pointing to a function.
是,是一种特殊的委托
Yes, it's a special commission.
5.override与重载的区别
答 :
Answer:
重载是方法的名称相同。参数或参数类型不同,进行多次重载以适应不同的需要
Reload is the same name for the method. Different parameters or types of parameters, multiple loads are performed to accommodate different needs
Override是进行基类中函数的重写。实现多态。
Override is the rewrite of the function in the base class.
6.如果在一个B/S结构的系统中需要传递变量值,但是又不能使用Session、Cookie、Application,您有几种方法进行处理?
6. If a system with a B/S structure needs to transmit variable values but cannot use Ssession, Cookie, Application, how can you handle it?
答 :
Answer:
1.使用QueryString, 如....?id=1; response.Redirect()....
1. Use Query String, e.g....?id=1; recall.Redirect()....
2.使用Server.Transfer
2. Use Server.Transfer
3.使用Cache
3. Use of Cache
4使用HttpContext的Item属性
4 Using Item Properties of HttpContext
5.使用文件
5. Use of documents
6.使用数据库
6. Access to databases
7.请编程遍历页面上所有TextBox控件并给它赋值为string.Empty?
答:
Response:
foreach(System.Windows.Forms.Control control in this.Controls)
{
if (control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox tb=(System.Windows.Forms.TextBox)control ;
tb.Text=String.Empty ;
}
}
8.请编程实现一个冒泡排序算法?
8. Please program to achieve a bubble sorting algorithm?
答:
Response:
int[] array=new int [*] ;
inttemp=0 ;
for(int i=0 ; i < array.Length - 1 ; i++)
{
for (int j=i + 1 ; j < array.Length ; j++)
{
if (array[j] < array[i])
{
temp=array[i] ;
array[i]=array[j] ;
array[j]=temp ;
}
}
}
9.描述一下C#中索引器的实现过程,是否只能根据数字进行索引?(索引器是对属性的封装,具体查看msdn)
答:不是。可以用任意类型。
A: No. Use any type.
10.求以下表达式的值,写出您想到的一种或几种实现方法:1-2+3-4+……+m
答:
Response:
intNum=this.TextBox1.Text.ToString() ;
intSum=0 ;
for(int i=0 ; i < Num + 1 ; i++)
{
if((i%2)==1)
{
Sum +=i ;
}
else
{
Sum=Sum - I ;
}
}
System.Console.WriteLine(Sum.ToString());
System.Console.ReadLine();
11.用.net做B/S结构的系统,您是用几层结构来开发,每一层之间的关系以及为什么要这样分层?
11. Systems with a B/S structure with a.net, you developed with several layers of structures, the relationship between each layer, and why the stratification?
答:使用MVC模式分层
Answer: use MVC mode to stratification
一般为3层
It's generally 3 floors.
数据访问层,业务层,表示层。
Data access level, operations level, indicates layers.
数据访问层对数据库进行增删查改。
The database is updated and deleted from the data access level.
业务层一般分为二层,业务表视层实现与表示层的沟通,业务规则层实现用户密码的安全等。
The level of operations is generally divided into two layers, the level of communication with the expression layer is achieved on the operational surface, the level of operational rules is secured by user passwords, etc.
表示层为了与用户交互例如用户添加表单。
indicates that the layer adds a form for interaction with the user, such as the user.
优点:分工明确,条理清晰,易于调试,而且具有可扩展性。
Advantages: clear division of labour, well-structured, easily calibrated and scalable.
缺点:增加成本。
Disadvantage: Increased costs.
12.在下面的例子里
12. In the following example
usingSystem;
classA
{
public A()
{
PrintFields();
}
public virtual void PrintFields(){}
}
classB: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的实例时,产生什么输出?
What output does it produce when using the example of new B() to create B?
答:X=1,Y=0;x=1 y=-1
Answer: X=1, Y=0; x=1 y=1
注:B类中的PrintFields()未用override关键字实现重写的时候,创建B的实例时:
Note: In class B, when Prince Fields() did not rewrite with the override key, when creating the example of B:
X=1,Y=-1
13.什么叫应用程序域?
13 . What's the application field?
答:应用程序域可以理解为一种轻量级进程。起到安全的作用。占用资源小。
Answer: The application domain can be understood as a lightweight process.
14.CTS、CLS、CLR分别作何解释?
答:CTS:通用类型系统。CLS:公共语言规范。CLR:公共语言运行库。
Q: CTS: Universal Type System. CLS: Public Language Code. CLR: Public Language Operating Bank.
15.什么是装箱和拆箱?
15. What's boxing and unpacking?
答:从值类型接口转换到引用类型装箱。从引用类型转换到值类型拆箱。
Answer: Converts from the value type interface to the reference type box. Converts from the reference type to the value type and unboxes it.
16.什么是受管制(托管)的代码?
16 . What's the regulated (host) code?
答:
Response:
托管代码是运行.NET 公共语言运行时CLR的代码
Host code is CLR code when running.NET public language
unsafe:非托管代码。不经过CLR运行。程序员自行分配和释放内存空间
Unsafe: Non-host code. Not run by CLR. The programmer assigns and releases the memory space.
17.什么是强命名程序集?
17. . What's a powerful program?
答:程序集需要经过加密签名,强命名程序集可以部署到全局程序集缓存中,成为公共程序集
Answer: The program set needs to be signed encrypted, and a powerful program set can be deployed to the global program collection cache to become a public program set
18..net中读写数据库需要用到那些类?他们的作用?
What kind of database needs to read and write in 18.net? What's their role?
答:
Response:
DataSet:数据集。
DataSet: Data set.
DataCommand:执行语句命令。
DataCommand: Execute statement command.
DataAdapter:数据的集合,用语填充。
DataAdapter: Data set, term filled.
DataReader:数据只读器
DataReader: Data Reader
19.ASP.net的身份验证方式有哪些?分别是什么原理?
19 .ASP.net What is the rationale for each?
答:
Response:
Windows(默认)用IIS控制
& nbsp;Windows (default) controlled with IIS
From(窗体)用帐户
& nbsp; From (form) account
Passport(密钥)
& nbsp;passport (Keys)
20.什么是Code-Behind技术?
What's Code-Behind Technology?
答:代码后置。
Answer: Code after code.
21.在.net中,配件的意思是?
答:程序集。(中间语言,源数据,资源,装配清单)
Answer: Set of programs. (Intermediate language, source data, resources, assembly list)
22.常用的调用WebService的方法有哪些?
答:1.使用WSDL.exe命令行工具。
Answer: 1. Use the WSDL.exe command line tool.
2.使用VS.NET中的Add Web Reference菜单选项
2. Use the Add Web Release menu option in VS.NET
23..netRemoting 的工作原理是什么?
What is the working principle of the NetRemoning?
答:服务器端向客户端发送一个进程编号,一个程序域编号,以确定对象的位置。
Answer: The server sends a process number, a programme area number, to the client to determine the location of the object.
24.在C#中,string str=null 与string str=“” 请尽量使用文字或图象说明其中的区别。
答:string str=null 是不给他分配内存空间,而string str="" 给它分配长度为空字符串的内存空间。
Answer: String str=null does not assign memory space to him, while String str=" assigns memory space with an empty string length.
25.请详述在dotnet中类(class)与结构(struct)的异同?
答:class可以被实例化,属于引用类型,class可以实现接口和单继承其他类,还可以作为基类型,是分配在内存的堆上的
Answer: Class can be exaggerated, of the reference type, of the interface and single succession to other categories, and can also be used as the base type, which is assigned to the memory piles
struct属于值类型,不能作为基类型,但是可以实现接口,是分配在内存的栈上的.
Strutt belongs to the value type and cannot be the base type, but the interface can be made, which is assigned to the memory.
26.根据委托(delegate)的知识,请完成以下用户控件中代码片段的填写:
26. Based on the knowledge of the commission (delegate), please complete the following user-controlled snippets:
namespacetest
{
public delegate voidOnDBOperate();
public class UserControlBase :System.Windows.Forms.UserControl
{
public event OnDBOperate OnNew;
private void toolBar_ButtonClick(objectsender,System.Windows.Forms.ToolBarButtonClickEventArgse)
{
if(e.Button.Equals(BtnNew))
{
//请在以下补齐代码用来调用OnDBOperate委托签名的OnNew事件。
/ Please complete the code below to call the OnNew event with the OnDBOPERate commission signature.
}
}
}
答:if( OnNew !=null )
Answer: if (OnNew! = null)
OnNew( this, e );
27.分析以下代码,完成填空
stringstrTmp="abcdefg某某某";
StringstrTmp= "abcdefg something";
inti=System.Text.Encoding.Default.GetBytes(strTmp).Length;
intj=strTmp.Length;
以上代码执行完后,i=j=
When the above code is implemented, i=j=
答:i=13,j=10
Answer: i=13,j=10
28.Sql Server服务器中,给定表table1 中有两个字段ID、LastUpdateDate,ID表示更新的事务号,LastUpdateDate表示更新时的服务器时间,请使用一句SQL语句获得最后更新的事务号
28. Sql Server server with two fields ID, LastUpdateDate, ID for updated service number, LastUpdateDate for updated server time, using a SQL statement for last updated service number
答:Select ID FROM table1 WhereLastUpdateDate=(Select MAX(LastUpdateDate) FROM table1)
Answer: Select ID FROM table1 WhereLastUpdateDate=(Select MAX(LastUpdateDate) FROM table1)
29.根据线程安全的相关知识,分析以下代码,当调用test方法时i>10时是否会引起死锁?并简要说明理由。
29. Analyse the following codes based on relevant knowledge of linear security, i> when calling the test method; do you cause a dead lock at 10? and provide a brief explanation of the reasons.
publicvoid test(int i)
{
lock(this)
{
if (i>10)
{
i--;
test(i);
}
}
}
答:不会发生死锁,(但有一点int是按值传递的,所以每次改变的都只是一个副本,因此不会出现死锁。但如果把int换做一个object,那么死锁会发生)
Answer: There will be no dead locks, but a little bit of the int is delivered by value, so every change is a copy, so there will be no dead locks. If the int is replaced by an object, the dead lock will happen.
30.简要谈一下您对微软.NET 构架下remoting和webservice两项技术的理解以及实际中的应用。
30. Briefly, your understanding of the two technologies under Microsoft.NET and Webservice and their application in practice.
答:webservice主要是可利用HTTP,穿透防火墙。
A: Webservice mainly uses HTTP to penetrate firewalls.
Remoting可以利用TCP/IP,二进制传送提高效率。
Remoting can use TCP/IP to enhance efficiency through binary transmission.
31.公司要求开发一个继承System.Windows.Forms.ListView类的组件,要求达到以下的特殊功能:点击ListView各列列头时,能按照点击列的每行值进行重排视图中的所有行(排序的方式如DataGrid相似)。根据您的知识,请简要谈一下您的思路
答:根据点击的列头,把该列的ID取出,按照该ID排序后,在给绑定到ListView中。
Answer: Take out the ID from the clicked row header, sort it according to the ID and bind it to ListView.
32.给定以下XML文件,完成算法流程图。
<FileSystem>
<DriverC>
<DirDirName="MSDOS622">
<FileFileName =" Command.com" ></File>
</Dir>
<FileFileName ="MSDOS.SYS" ></File>
<FileFileName =" IO.SYS" ></File>
</DriverC>
</FileSystem>
请画出遍历所有文件名(FileName)的流程图(请使用递归算法)。
答:
Response:
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 );
}
}
33.写出一条Sql语句:取出表A中第31到第40记录(SQL Server以自动增长的ID作为主键,注意:ID可能不是连续的。
33. Write a Sql statement: take records 31 through 40 in Form A (SQL Server uses automatically growing ID as the main key, note that ID may not be continuous.
答:
Response:
解1: select top 10 * from A whereid not in (select top 30 id from A)
Solver 1: second top 10 * from A whereid not in (second top 30 id from A)
解2: select top 10 * from A whereid > (select max(id) from (select top 30 id from A )as A)
Solver 2: sect top 10 * from A whereid & gt; (setmax(id) from (sett top 30 id from A)as
34.面向对象的语言具有________性、_________性、________性
34. Target-oriented language is of _____ sex, sex, sex,
答:封装、继承、多态。
Answer: Sealed, inherited, multi-stated.
35.能用foreach遍历访问的对象需要实现________________接口或声明________________方法的类型。
35. Type of interface or declaration method required to achieve the object that can be accessed withforeach.
答:IEnumerable 、GetEnumerator。
Answer: IEnumerable, GetEnumerator.
36.GC是什么? 为什么要有GC?
36 . what's GC? Why is there GC?
答:GC是垃圾收集器。程序员不用担心内存管理,因为垃圾收集器会自动进行管理。要请求垃圾收集,可以调用下面的方法之一:
A: GC is a garbage collector. The programmer does not have to worry about memory management because the garbage collector is automatically managed. To request garbage collection, one of the following methods can be called:
System.gc()
Runtime.getRuntime().gc()
37.String s=new String("xyz");创建了几个String Object?
答:两个对象,一个是“xyx”,一个是指向“xyx”的引用对象s。
Answer: Two objects, one “xyx” and one refers to the Xyx reference objects.
38.abstract class和interface有什么区别?
What's the difference between
答:
Response:
声明方法的存在而不去实现它的类被叫做抽象类(abstractclass),它用于要创建一个体现某些基本行为的类,并为该类声明方法,但不能在该类中实现该类的情况。不能创建abstract 类的实例。然而可以创建一个变量,其类型是一个抽象类,并让它指向具体子类的一个实例。不能有抽象构造函数或抽象静态方法。Abstract 类的子类为它们父类中的所有抽象方法提供实现,否则它们也是抽象类为。取而代之,在子类中实现该方法。知道其行为的其它类可以在类中实现这些方法。
The category in which the declaration method exists without realizing it is called the abstract category (abstractclas), which is used to create a category that reflects certain basic acts and for which the declaration method is not possible. Examples of the abstract category cannot be created. However, a variable can be created, the type of which is an abstract category and it points to an example of a specific subcategory. There can be no abstract typographical function or abstract static approach. The subcategory in the Abstract category provides for the realization of all abstract methods in their parent category, otherwise they are also abstract.
接口(interface)是抽象类的变体。在接口中,所有方法都是抽象的。多继承性可通过实现这样的接口而获得。接口中的所有方法都是抽象的,没有一个有程序体。接口只可以定义static final成员变量。接口的实现与子类相似,除了该实现类不能从接口定义中继承行为。当类实现特殊接口时,它定义(即将程序体给予)所有这种接口的方法。然后,它可以在实现了该接口的类的任何对象上调用接口的方法。由于有抽象类,它允许使用接口名作为引用变量的类型。通常的动态联编将生效。引用可以转换到接口类型或从接口类型转换,instanceof 运算符可以用来决定某对象的类是否实现了接口。
Interfaces (interface) are abstract variants. In the interfaces, all methods are abstract. Multiheritability can be obtained by achieving such interfaces. All methods in the interfaces are abstract and none have a program. The interfaces can only define the static binal member variables. The interfaces are similar to subcategories, but they cannot inherit from the interface definition. When the class achieves a special interface, it defines the method of all such interfaces (to be given by the program). Then, it can call the interfaces on any object that achieves the interface. Because of the abstract category, it allows the use of the interface name as the type of reference variable. The usual dynamic mix will take effect. The reference can be converted to the interface type or from the interface type, and the instanceof operator can be used to determine whether an object class has achieved the interface.
39.启动一个线程是用run()还是start()?
39 . Does a thread start with run() or start()?
答:启动一个线程是调用start()方法,使线程所代表的虚拟处理机处于可运行状态,这意味着它可以由JVM调度并执行。这并不意味着线程就会立即运行。
Answer: A thread is activated by calling start() to make the virtual processor that the thread represents operational, which means that it can be deployed and executed by JVM. This does not mean that the thread is running immediately.
run()方法可以产生必须退出的标志来停止一个线程。
The run() method can produce a sign that must exit to stop a thread.
40.接口是否可继承接口? 抽象类是否可实现(implements)接口? 抽象类是否可继承实体类(concrete class)?
答:接口可以继承接口。
Answer: The interface can inherit the interface.
抽象类可以实现(implements)接口,抽象类是否可继承实体类,但前提是实体类必须有明确的构造函数。
Abstract classes can achieve (implements) interfaces, and abstract classes can inherit the entity category, provided that the entity category has a clear tectonic function.
41.构造器(构造函数)Constructor是否可被override?
答:构造器Constructor不能被继承,因此不能重写Overriding,但可以被重载Overloading。
Answer: Constructor cannot be inherited and therefore cannot rewrite Overriding, but can be reloaded.
42.是否可以继承String类?
42 . Can you inherit String?
答:String类是密封类故不可以继承。
A: String is a closed category and cannot be inherited.
43.try {}里有一个return语句,那么紧跟在这个try后的finally {}里的code会不会被执行,什么时候被执行,在return前还是后?
答:会执行,在return前执行。
Answer: Will do it, before return.
44.两个对象值相同(x.equals(y)==true),但却可有不同的hash code,这句话对不对?
44. The two objects have the same value (x.equils(y)=true), but they can have different hash code, right?
答:不对,有相同的hash code。
A: No, there's the same hash code.
45.swtich是否能作用在byte上,是否能作用在long上,是否能作用在String上?
45 . swtich can play a role byte, a role at long and a role at String?
答:switch(expr1)中,expr1是一个整数表达式。因此传递给switch 和case 语句的参数应该是int、short、char 或者byte。long,string 都不能作用于swtich。
Answer: In switch(expr1), expr1 is an integer expression. So the parameters passed to switch and case statements should be int, Short, Char, or byte. Long, String does not work on swtich.
46.什么是SOAP,有哪些应用?
46 . What's SOAP and what's the application?
答:SOAP(SimpleObject Access Protocol)简单对象访问协议是在分散或分布式的环境中交换信息并执行远程过程调用的协议,是一个基于XML的协议,使用SOAP,不用考虑任何特定的传输协议(最常用的还是HTTP协议),可以允许任何类型的对象或代码,在任何平台上以任何语言相互通信,这种相互通信采用的是XML格式的消息。
A.S.S.O.P.A.S.A.S.A.S.A.S.S.A.S.S.S.A.S.S.S.S.A.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.P.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S. is a decentralized or distributed environment for the exchange of information and remote process calls.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.
SOAP也被称作XMLP,为两个程序交换信息提供了一种标准的工作机制。在各类机构之间通过电子方式相互协作的情况下完全有必要为此制定相应的标准。
SOAP, also known as XMLP, provides a standard working mechanism for the exchange of information between the two processes. In the case of electronic collaboration between various types of agencies, it is absolutely necessary to develop standards for this purpose.
SOAP描述了把消息捆绑为XML的工作方式。它还说明了发送消息的发送方、消息的内容和地址以及发送消息的时间。SOAP是Web Service的基本通信协议。SOAP规范还定义了怎样用XML来描述程序数据(Program Data),怎样执行RPC(RemoteProcedure Call)。大多数SOAP解决方案都支持RPC-style应用程序。SOAP还支持 Document-style应用程序(SOAP消息只包含XML文本信息)。
SOAP describes the way the message is tied to XML. It also describes the sender, the content and address of the message, and the time when the message is sent. SOAP is the basic communication protocol for Web Service. SOAP norms also define how to describe program data with XML and how to implement RPC (RemoteProcedure Call). Most SOAP solutions support the RPC-style application. SOAP also supports the Document-Style application (SOAP messages contain only XML text information).
最后SOAP规范还定义了HTTP消息是怎样传输SOAP消息的。MSMQ、SMTP、TCP/IP都可以做SOAP的传输协议。
Finally, SOAP norms define how HTTP messages transmit SOAP messages. MSMQ, SMTP, TCP/IP can all do SOAP transfer protocols. & nbsp;
SOAP 是一种轻量级协议,用于在分散型、分布式环境中交换结构化信息。 SOAP 利用 XML 技术定义一种可扩展的消息处理框架,它提供了一种可通过多种底层协议进行交换的消息结构。 这种框架的设计思想是要独立于任何一种特定的编程模型和其他特定实现的语义。
SOAP defines a scalable message processing framework using XML technology, which provides an information structure that can be exchanged through multiple bottom protocols. This framework is designed to be independent of any particular programming model and other specific semantics.
SOAP 定义了一种方法以便将 XML 消息从 A 点传送到 B 点。 为此,它提供了一种基于 XML 且具有以下特性的消息处理框架: 1) 可扩展, 2) 可通过多种底层网络协议使用, 3) 独立于编程模型
SOAP defines a method to transmit XML messages from point A to point B. To this end, it provides a message processing framework based on XML with the following characteristics: 1) scalable, 2) usable through multiple bottom network protocols, 3) independent of programming models
47.当一个线程进入一个对象的一个synchronized方法后,其它线程是否可进入此对象的其它方法?
47. Can other threads enter an object's synchronized method?
不能,一个对象的一个synchronized方法只能由一个线程访问。
No, one synchronized method for one object can only be accessed by one thread.
48.abstract的method是否可同时是static,是否可同时是native,是否可同时是synchronized?
48 .abstract's method could be both state, native and synchronized?
答:都不能。
Answer: None.
49.List, Set, Map是否继承自Collection接口?
答:List、Set是,Map不是
Answer: List, Set yes, Map is not
50.Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别?
50 . The elements in Set cannot be repeated, so what is the way to distinguish between repetition and repetition? = = or equitables()? What is the difference?
答:Set里的元素是不能重复的,那么用iterator()方法来区分重复与否。equals()是判读两个Set是否相等。
Answer: The elements in Set cannot be repeated, so use the interator() method to distinguish between repetition and non-repetition. Equals() interpret whether the two Sets are equal.
equals()和==方法决定引用值是否指向同一对象equals()在类中被覆盖,为的是当两个分离的对象的内容和类型相配的话,返回真值。
equals() and = method to determine whether the reference value is covered in the class for the same object equals() so that the true value is returned when the content and type of the two separated objects match.
51.数组有没有length()这个方法? String有没有length()这个方法?
答:数组没有length()这个方法,有length的属性。String没有length()这个方法,有length属性。
Answer: The arrays do not have the Length method, they have the Length attribute. String does not have the Length method, they have the Length attribute.
52.sleep() 和wait() 有什么区别?
52.sleep() andwait()?
答:sleep()方法是使线程停止一段时间的方法。在sleep 时间间隔期满后,线程不一定立即恢复执行。这是因为在那个时刻,其它线程可能正在运行而且没有被调度为放弃执行,除非(a)“醒来”的线程具有更高的优先级
Answer: sleep() method is the way to stop the thread for a certain period of time. After the sleep time interval has expired, the thread may not necessarily resume immediately. This is because at that point, other threads may be running and are not scheduled to be abandoned, unless (a) the “wake” thread has a higher priority.
(b)正在运行的线程因为其它原因而阻塞。
(b) Operating threads are blocked for other reasons.
wait()方法是线程交互时,如果线程对一个同步对象x 发出一个wait()调用,该线程会暂停执行,被调对象进入等待状态,直到被唤醒或等待时间到。
wait() method is a linear interaction and if the thread sends await() call to a synchronous objectx, the line is suspended and the callee is in a state of waiting until the awakening or waiting time comes.
53.short s1=1; s1=s1 + 1;有什么错? short s1=1; s1 +=1;有什么错?
53. short s1=1; s1=s1+1; wrong: short s1=1; s1+=1; wrong:
答:short s1=1; s1=s1 + 1;有错,s1是short型,s1+1是int型,不能显式转化为short型,需要强制转换类型。可修改为s1=(short)(s1 + 1) 。short s1=1; s1 +=1正确。
Answer: Short s1=1; s1=s1+1; error: s1 is shortt, s1+1 is int, cannot be visibly converted to shortt, which requires a mandatory conversion type. This can be modified to s1=(short)(s1+1). Short s1=1; s1+=1 is correct.
54.谈谈final, finally, finalize的区别。
54. . > >. >. >. >. >...................................................................................................................................
答:
Response:
final—修饰符(关键字)如果一个类被声明为final,意味着它不能再派生出新的子类,不能作为父类被继承。因此一个类不能既被声明为abstract的,又被声明为final的。将变量或方法声明为final,可以保证它们在使用中不被改变。被声明为final的变量必须在声明时给定初值,而在以后的引用中只能读取,不可修改。被声明为final的方法也同样只能使用,不能重载
final - If a class is declared as final, it means that it can no longer produce a new subcategory and cannot be inherited as a parent. Thus, a class cannot be declared both as aabstract and as final. Declaring variables or methods as final is a guarantee that they will not be changed in use. Variables declared as final must be given a starting value at the time of the declaration, whereas in subsequent references they can only be read and cannot be changed. The method declared as final can also be used only and not reloaded.
finally—在异常处理时提供finally 块来执行任何清除操作。如果抛出一个异常,那么相匹配的catch 子句就会执行,然后控制就会进入finally 块(如果有的话)。
finally - Provides a full block for any clean-up operations during an anomaly. If an anomaly is thrown, the matching catch sentence will be executed and the control will enter the complete block (if any).
finalize—方法名。Java 技术允许使用finalize() 方法在垃圾收集器将对象从内存中清除出去之前做必要的清理工作。这个方法是由垃圾收集器在确定这个对象没有被引用时对这个对象调用的。它是在Object 类中定义的,因此所有的类都继承了它。子类覆盖finalize() 方法以整理系统资源或者执行其他清理工作。finalize() 方法是在垃圾收集器删除对象之前对这个对象调用的。
finalize - Method name. Java technology allows the necessary clean-up before the waste collector removes the object from the memory. This method is used by the waste collector when it determines that the object is not cited. It is defined in the Object category, so all classes inherit it. Subclass cover finalize() to organize system resources or perform other clean-up work.
55.如何处理几十万条并发数据?
答:用存储过程或事务。取得最大标识的时候同时更新..注意主键不是自增量方式这种方法并发的时候是不会有重复主键的..取得最大标识要有一个存储过程来获取.
Answer: Use storage process or services .
56.Session有什么重大BUG,微软提出了什么方法加以解决?
56 .
答:是IIS中由于有进程回收机制,系统繁忙的话Session会丢失,可以用Sate server或SQL Server数据库的方式存储Session不过这种方式比较慢,而且无法捕获Session的END事件。
Answer: As a result of the process recovery mechanism in IIS, Session will be lost if the system is busy, and Session may be stored in the form of Sate Server or SQL Server databases, albeit slowly, and cannot capture Session's END events.
57.进程和线程的区别?
57 . The difference between process and thread?
答:
Response:
1.线程(Thread)与进程(Process)二者都定义了某种边界,不同的是进程定义的是应用程序与应用程序之间的边界,不同的进程之间不能共享代码和数据空间,而线程定义的是代码执行堆栈和执行上下文的边界。
Both Thread and Process define a certain boundary, unlike processes that define boundaries between applications and applications, where codes and data space cannot be shared between different processes , while threads define the boundaries of code execution stacks and context enforcement.
2.一个进程可以包括若干个线程,同时创建多个线程来完成某项任务,便是多线程。而同一进程中的不同线程共享代码和数据空间。用一个比喻来说,如果一个家庭代表一个进程,在家庭内部,各个成员就是线程,家庭中的每个成员都有义务对家庭的财富进行积累,同时也有权利对家庭财富进行消费,当面对一个任务的时候,家庭也可以派出几个成员来协同完成,而家庭之外的人则没有办法直接消费不属于自己家庭的财产。
A process can include a number of threads, while creating multiple threads to do a task is a multiline. Different thread sharing codes and data spaces in the same process. uses a metaphor. If a family represents a process, each member of the family is a thread within the family, each member of the family is obliged to accumulate the wealth of the family and has the right to consume the wealth of the family. When faced with a task, families can send several members to work together, while people outside the family have no means to consume directly the property that is not their own family.
或者:
进程是系统进行资源分配和调度的单位; & nbsp; & nbsp; & nbsp; & nbsp; processes are units of the system for resource allocation and movement; 线程是CPU调度和分派的单位,一个进程可以有多个线程,这些线程共享这个进程的资源。 & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; threads are units of CPU dispatch and assignment and a process can have multiple threads that share the resources of the process. 58.堆(Heap)和栈(stack)的区别? 58. The difference between a pile (Heap) and a pad (stack)? 答: Response: 栈:由编译器自动分配、释放。在函数体中定义的变量通常在栈上。 Lodge: The compiler automatically assigns, releases. The variables defined in the function are usually on the pad. 堆:一般由程序员分配释放。用new、malloc等分配内存函数分配得到的就是在堆上。 Stacks: Generally the programmer distributes the release. Allocating memory functions with new, Malloc, etc. is assigned on the stack. 59.成员变量和成员函数前加static的作用? 59. The role of membership variables and membership functions before a state? 答:它们被称为常成员变量和常成员函数,又称为类成员变量和类成员函数。分别用来反映类的状态。比如类成员变量可以用来统计类实例的数量,类成员函数负责这种统计的动作。 Answer: They are referred to as permanent member variables and permanent member functions, and also as class member variables and class member functions. They are used separately to reflect the status of the class. For example, the class member variables can be used for the number of statistical examples, and the class member functions are responsible for the statistical action. 60.ASP.NET与ASP相比,主要有哪些进步? What are the main advances compared to ASP? 答:asp解释形,aspx编译型,性能提高,有利于保护源码。 Answer: asp interpretive, aspx-edited, improved performance, which helps to protect the source code. 61.产生一个int数组,长度为100,并向其中随机插入1-100,并且不能重复。 61. Generates an int array of 100 lengths and inserts 1-100 randomly and cannot be repeated. int[]intArr=new int[100]; ArrayListmyList=new ArrayList(); Randomrnd=new Random(); while(myList.Count<100) { int num=rnd.Next(1,101); if(!myList.Contains(num)) myList.Add(num); } for(inti=0;i<100;i++) intArr[i]=(int)myList[i]; 62.请说明在.net中常用的几种页面间传递参数的方法,并说出他们的优缺点。 62. Please describe the methods used to transmit parameters between pages in.net and indicate their strengths and weaknesses. 答: Response: session(viewstate)简单,但易丢失 Session (viewstate) is simple, but easily lost application全局 Application Global cookie简单,但可能不支持,可能被伪造 Cookie is simple, but it may not be supported. It may be faked. inputttype="hidden" 简单,可能被伪造 Inputtype= "hidden" simple, possibly faked. url参数简单,显示于地址栏,长度有限 The url parameter is simple, displayed in the address bar, limited in length 数据库稳定,安全,但性能相对弱 Databases are stable, secure, but relatively weak. 63.请指出GAC的含义? 63 . Please indicate what GAC means? 答:全局程序集缓存。 Answer: Global program collection cache. 64.向服务器发送请求有几种方式? 64. How can you send a request to a server? 答:get,post。 Answer: Get, post. get一般为链接方式,post一般为按钮方式。 Get is usually a link, and post is usually a button. 65.DataReader与Dataset有什么区别? What's the difference between DataReader and Dataset? 答:一个是只能向前的只读游标,一个是内存中的表。 Answer: One is a forward read-only cursor
66.软件开发过程一般有几个阶段?每个阶段的作用?
66. How often are the software development processes? The role of each stage?
答:可行性分析(风险控制),需求分析,架构设计,代码编写,测试,部署,维护
Answer: Feasibility analysis (risk control), needs analysis, architecture design, code development, testing, deployment, maintenance
67.在c#中using和new这两个关键字有什么意义,请写出你所知道的意义?
67. What's the meaning of using and news in c#, please write what you know?
答:using 引入名称空间或者使用非托管资源,使用完对象后自动执行实现了IDisposable接口的类的Dispose方法
Answer: Using introduces namespaces or uses non-host resources to automate the Dispose method of achieving an IDisposable interface when objects are used
new 新建实例或者隐藏父类方法
New Example or Hide Parent Method
68.需要实现对一个字符串的处理,首先将该字符串首尾的空格去掉,如果字符串中间还有连续空格的话,仅保留一个空格,即允许字符串中间有多个空格,但连续的空格数不可超过一个.
答:string inputStr=" xx xx";
Answer: String inputstr="xxx";
inputStr=Regex.Replace(inputStr.Trim(),"*"," ");
69.下面这段代码输出什么?为什么?
69. What's the next part of the code? Why?
inti=5;
intj=5;
if(Object.ReferenceEquals(i,j))
Console.WriteLine("Equal");
else
Console.WriteLine("NotEqual");
答:不相等,因为比较的是对象
Answer: Not equal, because the comparison is with the object
70.什么叫做SQL注入,如何防止?请举例说明。
70. What's SQL Injection, how can it be prevented? Please give examples.
答:利用SQL关键字对网站进行攻击。
Response: The SQL keyword is used to attack the website.
预防SQL注入:过滤关键字、使用存储过程、参数化等
Prevent SQL injection: filter keywords, use storage processes, parameterisation, etc.
71.什么是反射?
What's reflective?
答:动态获取程序集信息
Answer: Dynamic access to program set information
或者:
程序集包含模块,而模块又包括类型,类型下有成员,反射就是管理程序集,模块,类型的对象,它能够动态的创建类型的实例,设置现有对象的类型或者获取现有对象的类型,能调用类型的方法和访问类型的字段属性。它是在运行时创建和使用类型实例 The application set contains modules that include the type, with members under the type, the reflective is the management application set, the module, the type of object, the example of the type of creation that it can dynamically create, the type of existing object or the type of existing object, the method of calling the type and the field properties of the access type. It is an example of the type created and used while running. 72.用Singleton如何写设计模式 72
答:static属性里面new ,构造函数private
Answer: new instatic properties, construction function private
73.什么是Application Pool?
What's "Application Pool"?
答:Web应用,类似Thread Pool,提高并发性能。
Answer: Web application, like Thread Pool, improves and develops performance.
74.什么是虚函数?什么是抽象函数?
74. What is a false function? What is an abstract function?
答:虚函数:没有实现的,可由子类继承并重写的函数。
Answer: Fault function: If not realized, the function can be inherited and rewritten by a subcategory.
抽象函数:规定其非虚子类必须实现的函数,必须被重写。
& nbsp; & nbsp; & nbsp; Abstract function: a function that specifies that it is not a vanity subcategory and must be rewritten.
75.什么是XML?
What's XML?
答:XML即可扩展标记语言。eXtensible MarkupLanguage.标记是指计算机所能理解的信息符号,通过此种标记,计算机之间可以处理包含各种信息的文章等。如何定义这些标记,即可以选择国际通用的标记语言,比如HTML,也可以使用像XML这样由相关人士自由决定的标记语言,这就是语言的可扩展性。XML是从SGML中简化修改出来的。它主要用到的有XML、XSL和XPath等。
Answer: XML extends tag language. eXtensible MarkupLanguage. Tags refer to information symbols that computers understand, through which computers can process articles containing various types of information, etc. How to define these markers, i.e. they can choose internationally used marking languages such as HTML, or sign languages such as XML, which are freely determined by the person concerned, which is the scalability of the language. XML is simplified from SGML. It is mainly used for XML, XSL and XPath.
76列举一下你所了解的XML技术及其应用
76 > /span > lists the XML technologies and their applications you know about
答:xml用于配置,用于保存静态数据类型。接触XML最多的是web Services.和config,存储经常使用但是不经常修改的数据
Answer: xml is used to configure and save static data types.
77.什么是Web Service?UDDI?
What's Web Service? UDDI?
答:Web Service便是基于网络的、分布式的模块化组件,它执行特定的任务,遵守具体的技术规范,这些规范使得Web Service能与其他兼容的组件进行互操作。
A: Web Service is a network-based, distributed modular component that performs specific tasks and follows specific technical specifications that enable Web Service to interoperate with other compatible components.
UDDI 的目的是为电子商务建立标准;UDDI是一套基于Web的、分布式的、为Web Service提供的、信息注册中心的实现标准规范,同时也包含一组使企业能将自身提供的Web Service注册,以使别的企业能够发现的访问协议的实现标准。
The purpose of UDDI is to establish standards for e-commerce; UDDI is a set of Web-based, distributed, information registration centre compliance standards for Web Service, and also includes a set of standards to enable enterprises to register Web Service, which they provide, to enable other enterprises to discover access agreements.
78.什么是ASP.net中的用户控件?
What's a user control in ASP.net?
答:用户控件一般用在内容多为静态,或者少许会改变的情况下。.用的比较多,类似ASP中的include。但是功能要强大的多。
Answer: User controls are usually used in cases where the content is mostly static, or where a few changes.... More is used, like include in ASP. But more powerful.
79.什么是code-Behind(代码后置)技术。
79 . What's code-Behind technology.
答:ASPX、RESX和CS三个后缀的文件,这个就是代码分离。实现了HTML代码和服务器代码分离,方便代码编写和整理。
Answer: ASPX, RESX and CS suffix files, this is code separation. HTML and server codes are separated to facilitate code preparation and collation.
80.ADO.net中常用的对象有哪些?
What are the usual objects in ADO.net ? .
答:
Response:
SqlConnection数据库连接对象
SqlConnection database connects objects
SqlCommand数据库命令对象
SqlCommand database command object
SqlDataAdapter数据适配器
SqlDataAdapter data adapter
SqlDataReader数据库读取器,“只读、向前”,不能后退地读取数据
SqlDataReader Database Reader, Read-only, Forward, Cannot Read Data Backward
DataSet 数据集,相当于内存中的数据库
Dataset & nbsp; datasets, equivalent to databases in memory
81. 62-63=1 等式不成立,请移动一个数字(不可以移动减号和等于号),使得等式成立,如何移动?
81. 62-63=1 Equivalent. Please move a number (can't move minus or equal number) so that the equation is established and how can it move ?
答:62移动成2的6次方
Answer: 62 moves to the 6th of 2.
82.C#中property 与attribute的区别,他们各有什么用处,这种机制的好处在哪里?
What use are the differences between property and antribute in 82 .C#, and where are the benefits of such a mechanism?
答:一个是特性,用来标识类,方法等的附加性质;
Response: One is the additional nature of characteristics, used to identify categories, methods, etc.;
一个是属性,用于存取类的字段,
One is a property, a field for access to a class,
83.XML 与HTML 的主要区别
83 .XML to HTML
答:
Response:
1.XML是区分大小写字母的,HTML不区分。
1. XML is case-sensitive and HTML is not.
2. 在HTML中,如果上下文清楚地显示出段落或者列表键在何处结尾,那么你可以省略</p>或者</li>之类的结束标记。在XML中,绝对不能省略掉结束标记。
In HTML, if the context clearly shows the end of the paragraph or the list key, you can omit the end mark </p> or </li> or so on. In XML, the end mark must not be omitted.
3. 在XML中,拥有单个标记而没有匹配的结束标记的元素必须用一个/ 字符作为结尾。这样分析器就知道不用查找结束标记了。
3. In XML, elements with a single and unmatched end mark must end with one/ character. The analyser will then know that the end mark is no longer searchable.
4. 在XML中,属性值必须分装在引号中。在HTML中,引号是可用可不用的。
4. In XML, the attribute value must be separated into quotation marks. In HTML, quotation marks are usable and usable.
5. 在HTML中,可以拥有不带值的属性名。在XML中,所有的属性都必须带有相应的值。
5. In HTML, you can have a non-value attribute name. In XML, all properties must have a corresponding value.
84.C#中的三元运算符是?
The Trinity Operator in 84.C# is?
答:?:。
Answer:?
85.当整数a赋值给一个object对象时,整数a将会被?
85. When an integer a value is given to an object object, the integer a will be given?
答:装箱。
Answer: Pack the boxes.
86.类成员有_____种可访问形式?
86. There are ___ forms of accessibility?
答:this.;
Answer: thisis.;
new Class().Method;
87.public static const int A=1;这段代码有错误么?是什么?
87. public state next int A=1; is there an error in this code?
答:const不能用static修饰。
A: Const cannot be modified with static.
88.float f=-123.567F; int i=(int)f;i的值现在是_____?
答:-123。
Answer:-123.
89.委托声明的关键字是______?
89. The key word for the power statement is?
答:delegate.
Answer: delegate.com
90.用sealed修饰的类有什么特点?
What are the characteristics of the saaled modifier?
答:密封,不能继承。
A: Sealed, not inherited.
91.在Asp.net中所有的自定义用户控件都必须继承自________?
答:Control。
Answer: Contractor.
92.在.Net中所有可序列化的类都被标记为_____?
答:[serializable]
Answer: [serializeable]
93.在.Net托管代码中我们不用担心内存漏洞,这是因为有了______?
答:GC(垃圾收集器)。
Response: GC (waste collector).
94.下面的代码中有什么错误吗?_______
94. Any errors in the code below?
usingSystem;
classA
{
public virtual void F()
{
Console.WriteLine("A.F");
}
}
abstractclass B:A
{
public abstract overridevoid F();
} //new public abstract void F();
答:abstract override 是不可以一起修饰.
Answer: abstract override can't be trimmed together.
95.当类T只声明了私有实例构造函数时,则在T的程序文本外部,___可以___(可以or 不可以)从T派生出新的类,不可以____(可以or 不可以)直接创建T的任何实例。
95. When class T only declares the construction of a function in private cases, external to the text of the T application, _ may (may or may not) produce a new category from T and may not (may or may) directly create any example of T.
答:不可以,不可以。
Answer: No, no.
96.下面这段代码有错误么?
96. Is this code wrong?
switch(i)
{
case(): 答://case()条件不能为空
Case(): & nbsp; answer: /case() condition cannot be empty
CaseZero();
break;
case 1:
CaseOne();
break;
case 2:
dufault; 答://wrong,格式不正确
dufault; answer < wrong, incorrect format
CaseTwo();
break;
}
97.在.Net中,类System.Web.UI.Page 可以被继承么?
. In.Net, can type System.Web.UI.Page be inherited?
答:可以。
Answer: Yes.
98..net的错误处理机制是什么?
What's the bug-handling mechanism in the net?
答:.net错误处理机制采用try->catch->finally结构,发生错误时,层层上抛,直到找到匹配的catch为止。
Answer:.net error-handling mechanisms use try-> Catch-> finally structure, when an error occurs, the layer is thrown up until a match match is found.
99.利用operator声明且仅声明了==,有什么错误么?
99. Any mistake using the Operator to declare = = = = = = = = = = = =
答:要同时修改Equale和GetHash() ? 重载了"==" 就必须重载"!="
Answer: To modify Equale and GetHash() at the same time, the "=" must be reloaded!"
100.在.net(C# or vb.net)中如何用户自定义消息,并在窗体中处理这些消息。
100. How to customize messages in.net (C# or vb.net) and process them in form.
答:在form中重载DefWndProc函数来处理消息:
Answer: Reload the DefWndProc function in Form to handle messages:
protectedoverride void DefWndProc ( ref System.WinForms.Message m ) operator
{
switch(m.msg)
{
case WM_Lbutton :
///string与MFC中的CString的Format函数的使用方法有所不同
//string is different from the use of Cstring's Format function in MFC
string message=string.Format("收到消息!参数为:{0},{1}",m.wParam,m.lParam);
"String message@string.Format" ("Received message! Arguments: ), m.wParam, m.lParam;
MessageBox.Show(message);///显示一个消息框
MessageBox.Show(message); // Show a message box
break;
case USER:
处理的代码
Codes processed
default:
base.DefWndProc(ref m);///调用基类函数处理非自定义消息。
Base.DefWndProc(ref m);///call base functions to handle non-defined messages.
break;
}
}
101.在.net(C# or vb.net)中如何取消一个窗体的关闭。
101. How to remove a form from.net (C# or vb.net).
答:
Response:
privatevoid Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel=true;
}
102.在.net(C# or vb.net)中,Appplication.Exit 还是Form.Close有什么不同?(winform题目非asp.net题目)
102. What's the difference between application.Exit or Form.Close in.net?
答:一个是退出整个应用程序,一个是关闭其中一个form。
Answer: One is to exit the entire application and one is to close one of theforms.
103.在C#中有一个double型的变量,比如10321.5,比如122235401.21644,作为货币的值如何按各个不同国家的习惯来输出。比如美国用$10,321.50和$122,235,401.22而在英国则为£10 321.50和£122 235 401.22
103. There is a double variable in C #, for example 10321.5, for example 122,350,1.21644, which is how the value of the currency is exported according to the customs of different countries. For example, the United States uses $10,321.50 and $122,235,401.22, compared to £10,321.50 and £122,235,401.22 in the United Kingdom.
答:System.Globalization.CultureInfo MyCulture=new System.Globalization.CultureInfo("en-US");
//System.Globalization.CultureInfoMyCulture=new System.Globalization.CultureInfo("en-GB");为英国货币类型
/System.Globalization. CultureInfoMyCulture=new System.Globalization.CultureInfo("en-GB"); for British currency type
decimaly=9999999999999999999999999999m;
stringstr=String.Format(MyCulture,"My amount={0:c}",y);
104.某一密码仅使用K、L、M、N、O共5个字母,密码中的单词从左向右排列,密码单词必须遵循如下规则:
104. A password used only K, L, M, N, O in five letters, the word in the password is arranged from the left to the right, and the password word must follow the following rule:
(1)密码单词的最小长度是两个字母,可以相同,也可以不同
(1) The minimum length of a password word is two letters, which can be the same or different
(2)K不可能是单词的第一个字母
(2) K cannot be the first letter of a word
(3)如果L出现,则出现次数不止一次
(3) If L appears, it occurs more than once
(4)M不能使最后一个也不能是倒数第二个字母
"M" can't make the last one or the penultimate letter.
(5)K出现,则N就一定出现
(5) K shows up, N shows up.
(6)O如果是最后一个字母,则L一定出现
(6) If O is the last letter, L must appear.
问题一:下列哪一个字母可以放在LO中的O后面,形成一个3个字母的密码单词?
Question I: Which of the following letters can be placed behind an O in LO and form a three-letter password word?
A) KB)L C) M D) N
答案:B
Answer: B
问题二:如果能得到的字母是K、L、M,那么能够形成的两个字母长的密码单词的总数是多少?
Question II: If K, L, M are available, what is the total number of two-letter-long password words that can be formed?
A)1个B)3个C)6个D)9个
A) 1 B) 3 C) 6 D) 9
答案:A
Answer: A
问题三:下列哪一个是单词密码?
Question III: Which of the following is the word password?
A)KLLN B) LOML C) MLLO D)NMKO
答案:C
Answer: C
105.对于这样的一个枚举类型:
105. For such an item type:
enumColor:byte
{
Red,Green,Blue,Orange
}
答:string[]ss=Enum.GetNames(typeof(Color));
Answer: String[] ss=Enum.GetNames(typeof(Color));
byte[]bb=Enum.GetValues(typeof(Color));
106. C#中 property 与attribute的区别,他们各有什么用处,这种机制的好处在哪里?
What is the use of the difference between property in C and antribute, and the benefits of such a mechanism?
答:attribute:自定义属性的基类;property :类中的属性
Answer: attribute: the base class for custom properties; property: the properties in the class
107.C#可否对内存进行直接的操作?
107 .C# Direct operation of memory?
答:在.net下,.net引用了垃圾回收(GC)功能,它替代了程序员。但在C#中,不能直接实现Finalize方法,而是在析构函数中调用基类的Finalize()方法
Answer: Under.net, the waste recovery (GC) function is quoted as replacing the programmer. In C#, instead of directly achieving the Finalize method, instead of calling the base type Finalize() method in the parsing function
108.ADO.NET相对于ADO等主要有什么改进?
108 . What are the main improvements in ADO.NET vis-à-vis ADO?
答:
Response:
1:ado.net不依赖于ole db提供程序,而是使用.net托管提供的程序,
1:ado.net does not rely on the ole db to provide the program, but instead uses the.net hosting to provide the program,
2:不使用com
2: Not using com
3:不在支持动态游标和服务器端游标
3: Do not support dynamic cursors and server-side cursors
4:,可以断开connection而保留当前数据集可用
4: The current data set can be maintained without connection
5:强类型转换
5: Strong-type conversion
6:xml支持
6:xml support
109.写一个HTML页面,实现以下功能,左键点击页面时显示“您好”,右键点击时显示“禁止右键”,并在2分钟后自动关闭页面。
109. Write a HTML page to achieve the following functions, show " Hello " when you click on the page, " Stop right " when you click on the right, and close the page automatically after 2 minutes.
答:
Response:
<scriptlanguage=javascript>
setTimeout('window.close();',3000);
functionshow()
{
if (window.event.button==1)
{
alert("左");
& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & alert("left");
}
else if (window.event.button==2)
{
alert("右");
& nbsp; & nbsp; & nbsp; & nbsp; aert("right");
}
}
</script>
110.大概描述一下ASP.NET服务器控件的生命周期
110. Describe the life cycle of the ASP.NET server control
答:初始化,加载视图状态,处理回发数据,加载,发送回发更改通知,处理回发事件,预呈现保存状态,呈现,处置,卸载。
Answer: Initializes, loads the view status, processes the return data, loads, sends the return change notification, processes the return event, pre-presents the saving status, presents, disposes of, uninstalls.
111.AnonymousInner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?
111 . AnonymousInner Clas (anonymous internal category) Is it possible to extends (inheritance) to other categories and to enable them (realization) interface?
答:不能,可以实现接口
Answer: No, you can make interfaces.
112.StaticNested Class 和Inner Class的不同(说得越多越好)
112 .
答:Static Nested Class是被声明为静态(static)的内部类,它可以不依赖于外部类实例被实例化。而通常的内部类需要在外部类实例化后才能实例化。
Answer: Static Nested Class is an internal class that is declared static, and it can not rely on the exemplification of external class examples. The usual internal class can only be exemplified once the external class is exemplified.
113.&和&&的区别。
The difference between 113 >. and .
答:&是位运算符,表示按位与运算;
Answer: & is a bit operator, which means by bit and by operation;
&&是逻辑运算符,表示逻辑与(and).
& nbsp; & nbsp; & nbsp; & & & is a logic operator for logic and (and).
114.HashMap和HashTable的区别。
The difference between HashMap and HashTable.
答:HashMap是HashTable的轻量级实现(非线程安全的实现),他们都完成了Map接口,主要区别在于HashMap允许空(null)键值(key),由于非线程安全,效率上可能高于Hashtable。
Q: HashMap is a lightweight achievement for HashTable (a non-linear secure realization), and they have all completed the Map interface, the main difference being that HashMap allows empty (null) key (key) values, which may be more efficient than Hashtable due to offline security.
115.概述反射和序列化(serializable)
115. Overview reflection and sequencing
反射:反射提供了封装程序集,模块和类型对象,可以用反射动态的创建类型的实例,将类型绑定到现有对象,或者从现有对象类型里获取类型,然后调用类型的方法或访问字段的属性。
reflective : Reflectives provide cover program sets, modules and type objects that can be used as examples of the creation type of reflective dynamics to bind the type to an existing object, or to obtain the type from an existing object type, and then call the type method or access field properties.
序列化:将对象转换为另一种媒介传输的格式过程,如,序列化一个对象,用HTTP通过internet在客户端和服务器之间传递该对象,在另一端用反序列化从该流中重新得到对象。
Sequencing : A formatting process to convert an object to another medium, e.g., sequencing an object, transmitting the object via HTTP over the internet between the client and the server, and re-sequencing the object from the stream at the other end with countersequentization.
116.Overloaded的方法是否可以改变返回值的类型?
答:Overloaded的方法是可以改变返回值的类型。
Answer: Overload can change the type of return value.
117.Error和Exception有什么区别?
What's the difference between Error and Exchange?
答:
Response:
Error表示恢复不是不可能但很困难的情况下的一种严重问题。比如说内存溢出。不可能指望程序能处理这样的情况。
Error says that recovery is not a serious problem in an impossible but difficult situation. For example, there is an overflow of memory. It cannot be expected that the procedure will deal with such a situation.
Exception表示一种设计或实现问题。也就是说,它表示如果程序运行正常,从不会发生的情况。
Exception represents a design or realization problem. That is, it indicates a situation that never occurs if the program works properly.
118.<% #%> 和<% %> 有什么区别?
118.< %> and %> and %> and what's the difference?
答:<% # %>表示绑定的数据源
Answer: < %# %gt; meaning bound data source
<% %>是服务器端代码块
& lt; %> is a server end code block
119.你觉得ASP.NET 2.0(VS2005)和你以前使用的开发工具(.Net 1.0或其他)有什么最大的区别?你在以前的平台上使用的哪些开发思想(pattern / architecture)可以移植到ASP.NET 2.0上(或者已经内嵌在ASP.NET 2.0中)
119. What do you think is the greatest difference between ASP.NET 2.0 (VS2005) and the development tools you used earlier (.Net 1.0 or others)? Which development ideas you used on previous platforms can be transplanted to ASP.NET 2.0 (or already embedded in ASP.NET 2.0)
答:
Response:
1ASP.NET 2.0 把一些代码进行了封装打包,所以相比1.0相同功能减少了很多代码.
1ASP.NET 2.0 wraps up some codes, so it's a lot less code than the same 1.0 function.
2 同时支持代码分离和页面嵌入服务器端代码两种模式,以前1.0版本,.NET提示帮助只有在分离的代码文件,无法 在页面嵌入服务器端代码获得帮助提示,
2 Supports both modes of code separation and page embedding of server end code, previously version 1.0.NET help only in separated code files, unable to get help tips for embedded server end code on the page,
3 代码和设计界面切换的时候,2.0支持光标定位.这个我比较喜欢
2.0 supports cursor positioning when code and design interfaces are switched. I prefer this one.
4 在绑定数据,做表的分页.UPDATE,DELETE,等操作都可以可视化操作,方便了初学者
4 At the time of binding the data, the tabs. UPDATE, DELETE, etc., can be visualized to facilitate starters.
5 在ASP.NET中增加了40多个新的控件,减少了工作量
5 More than 40 new controls added to ASP.NET, resulting in reduced workload
120.重载与覆盖的区别?
答:
Response:
1、方法的覆盖是子类和父类之间的关系,是垂直关系;方法的重载是同一个类中方法之间的关系,是水平关系
1. The method covers the relationship between the sub-category and the parent and is vertical; the method reloads the relationship between the same category of methods and the horizontal relationship
2、覆盖只能由一个方法,或只能由一对方法产生关系;方法的重载是多个方法之间的关系。
2. Coverage can be linked only by one method, or only by one pair of methods; the reloading of methods is the relationship between multiple methods.
3、覆盖要求参数列表相同;重载要求参数列表不同。
3. The list of parameters for coverage requirements is the same; the list of parameters for heavy load requirements is different.
4、覆盖关系中,调用那个方法体,是根据对象的类型(对象对应存储空间类型)来决定;重载关系,是根据调用时的实参表与形参表来选择方法体的。
4. Cover relationships, which are determined by the type of object (the type of object's relative storage space); and reload relationships, which are selected on the basis of the material and form references at the time of the call.
121.描述一下C#中索引器的实现过程,是否只能根据数字进行索引?
121. Describe how the indexer in C# is being realized and whether it can only be indexed on the basis of numbers?
答:C#中索引器的实现过程,所谓索引器就是一类特殊的属性,通过它们你就可以像引用数组一样引用自己的类,显然,这一功能在创建集合类的场合特别适用,而在其他某些情况下,比如处理大型文件或者抽象某些有限资源等,能让类具有类似数组的行为
Answer: The process of realization of indexers in C# is a special type of attribute through which you can refer to your category like reference arrays. Clearly, this function is particularly applicable in the context of the creation of clusters, whereas in some other cases, such as handling large files or abstracting certain limited resources, it allows classes to behave in a similar array.
给类定义的索引器:
Indexor for class definition:
this [argument list]
{
get
{
// Get codesgoes here
}
set
{
// Set codesgoes here
}
}
如:
For example:
class Sample
{
public stringthis [int index]
{
get {return "You passed " + index; }
}
}
类似数组的行为常受到程序言的喜爱,所以还可以为接口定义索引器,IList和IDictionary集合接口都声明了索引器,在为接口声明索引器的时候,记住声明只是表示索引器的存在,如:
Similar arrays of behaviors are often favoured by the script, so indexers can also be defined for interfaces, IList and IDactionary assembly interfaces both declare indexers, and when they are indexers for interface statements, remember that statements merely represent the existence of indexers, such as:
interface IImplementMe {
string this[int index]
{
get;
set;
}
不是。可以用任意类型。
No. You can use any type.
122.列举ADO.NET中的共享类和数据库特定类
122. Examples of shared and database-specific categories in ADO.NET
共享类:DataSet、DataTable、DataRow、DataColumn、DataRelation、Constraint、
Share categories: DataSet, DataTable, DataRow, DataColumn, DataRelation, Constraint,
DataColumnMapping、DataTableMapping
特定类:(x)Connection、(x)Command、(x)CommandBuilder、(x)DataAdapter、
Specific categories: (x)Connection, (x)Command, (x)CommandBuilder, (x)DataAdapter, (x)
(x)DataReader、(x)Parameter、(x)Transaction
123.死锁的必要条件?
123. >/span's key?
答:系统的资源不足,进程的推进的顺序不合适,资源分配不当,一个资源每次只能被一个进程使用,一个资源请求资源时,而此时这个资源已阻塞,对已获得资源不放,进程获得资源时,未完成前,不能强行剥夺。 Response: The system is under-resourced, the process is not proceeding in an appropriate sequence, the allocation of resources is inappropriate, a resource is used only by one process at a time, and a resource is requested at a time when this resource is blocked, resources are available and the process cannot be forcibly deprived before it is completed. 124.Collection与Collections的区别? 124. >/span >Collection and Collects? 答:Collection是集合类的上级接口,Collections是针对集合类的一个帮助类,它提供一系列静态方法来实现对各种集合的搜索,排序,线程安全操作。 Response: Collect is the superior interface for the assembly group, and Collects is a help group for the assembly group, which provides a series of static methods for searching, sorting and line safe operations for the various clusters. 125.分析以下代码。 125. Analyse the following codes. publicstatic void test(string ConnectString) { System.Data.OleDb.OleDbConnection conn=newSystem.Data.OleDb.OleDbConnection(); conn.ConnectionString=ConnectString; try { conn.Open(); ……. } catch(Exception Ex) { MessageBox.Show(Ex.ToString()); } finally { if(!conn.State.Equals(ConnectionState.Closed)) conn.Close(); } } 请问 1)以上代码可以正确使用连接池吗? 1) Can the connection pool be used correctly? 答:回答:如果传入的connectionString是一模一样的话,可以正确使用连接池。不过一模一样的意思是,连字符的空格数,顺序完全一致。 Answer: If the connection String is the same, you can use the connection pool correctly. But the exact same meaning is that the number of spaces hyphenated is in exactly the same order. 2)以上代码所使用的异常处理方法,是否所有在test方法内的异常都可以被捕捉并显示出来? 2) Are all anomalies in the test method captured and displayed? 答:只可以捕捉数据库连接中的异常吧. (finally中,catch中,如果有别的可能引发异常的操作,也应该用try,catch。所以理论上并非所有异常都会被捕捉。) Answer: Only an anomaly in a database connection can be captured. (Finally, catch, if there is anything else that could trigger an anomaly, should also be used as a try catch. So, theoretically, not all anomalies are arrested.) 126.const和ReadOnly的区别? The difference between strong and ReadOnly? const是编程时申明常量,ReadOnly用来申明运行时常量 Const is the constant for programming, and ReadOnly is the constant for running. 127.什么是WSE?目前最新的版本是多少? What's WSE? What's the latest version? 答:WSE (Web Service Extension) 包来提供最新的WEB服务安全保证,目前最新版本2.0。 RESPONSE: WEE (Web Service Exchange) package to provide updated WEB service security guarantees, currently version 2.0. 128.在下面的例子里 usingSystem; classA { public A() { PrintFields(); } public virtual void PrintFields(){} } classB:A { int x=1; int y; public B() { y=-1; } publicoverride void PrintFields() { Console.WriteLine("x={0},y={1}",x,y); } 当使用new B()创建B的实例时,产生什么输出? What output does it produce when using the example of new B() creating B? 答:X=1,Y=0 Answer: X=1, Y=0 129.下面的例子中 129. In the example below usingSystem; classA { public static int X; static A() { X=B.Y+1; } } classB { public static int Y=A.X+1; static B(){} static void Main() { Console.WriteLine("X={0},Y={1}",A.X,B.Y); } } 产生的输出结果是什么? What's the output from ? 答:x=1,y=2 Answer: x=1, y=2 130.String和StringBuilder的区别。 The difference between String and StringBuilder. 答案:因为StringBuffer内部实现是char数组,默认初始化长度为16,每当字符串长度大于 Answer: Because StringBuffer's internal realization is a char array, the default initialization length is 16, whenever the string length is greater than char数组长度的时候,JVM会构造更大的新数组,并将原先的数组内容复制到新数组。String是不可变对象,每次"+="操作都会造成构造新的String对象。 During the char array length, JVM constructs a larger new array and reproduces the original array content to the new array. String is an immutable object, and every "+=" operation results in the construction of a new String object. 关键点 Keypoints 1). 简单的认为 .append() 效率好于 "+=" 是正确的! Simple belief...append() is more efficient than "+=" is correct! 2). 不要使用 new 创建 String 2). Do not use new to create String 3). 注意 .intern() 的使用 3). Note the use of.intern() 4). 在编译期能够确定字符串值的情况下,使用"+"效率最高 4). The use of "+" is most efficient where string values can be determined during the compilation period 5). 避免使用 "+=" 来构造字符串 5). Avoid using "+=" to construct strings 6). 在声明StringBuffer对象的时候,指定合适的capacity,不要使用默认值(16) 6). Assign the right capacitity at the time the StringBuffer object is stated, do not use the default value (16) 在.Net中是StringBuilder,而在JAVA中是StringBuffer StringBuilder in.Net, and StringBuffer in JAVA. String s=new String ("abc"); 131.简述asp.net缓存技术。 1.整页缓存:适用于不需要频繁更新数据的页面,占用大量时间和资源才能编译生成的页面 1. Page-wide cache: suitable for pages that do not require frequent updating of data and that take a significant amount of time and resources to compile generated pages 2.页面部分缓存:适用于页面内某些部分可能每次请求时都需要最新数据的情况,用缓存后替换的方法:就是将整个页面缓存,然后替换页面中不需要缓存的部分,主要通过使用Substitution控件实现的。 2. Part of the page cache: This applies to situations in which some parts of the page may require up-to-date data at each request, and is replaced by a cache of the entire page, which then replaces those parts of the page that do not require a cache, mainly through the use of the Substitution control. 注意:Substitution控件MethodName属性所调用的方法必须满足: & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Note: The method called by the Substitution Control MethodName Properties must satisfy: 必须是静态的方法 & nbsp; & nbsp; & nbsp; & nbsp; must be static 返回类型必须是String型 & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; the returned type must be String 参数类型必须是HttpContext类型 & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & ; & nbsp; the parameter type must be the HtttpContext type 3.应用程序缓存:是用来存储与应用程序相关的对象,主要由Cache类,实现缓存依赖的添加,检索,删除,它给我们提供了一种机制,使得我们可以通过编码方式灵活的控制缓存的操作,与前两种缓存方式相比,应用程序缓存的优点是灵活性 3. Application cache: which is used to store applications-related objects, mainly in the Cache category, to achieve the addition, retrieval, deletion, which provides us with a mechanism that allows us to control cache operations in a coding and flexible manner. The advantage of application caches is flexibility compared to the first two types of caches. 注意添加缓存的方法: & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Note how to add a cache: 1.指定键值 & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; 1. Specified key values 2.使用Add()方法 & nbsp; & nbsp; & nbsp; 2. Using Add() method 3.使用Insert()方法 & nbsp; & nbsp; & nbsp; 3. Use of Insert() method 132.Asp.net中常用的几种页面传递参数的方法,优缺点? 132 .Procedures and disadvantages of several page transfer parameters commonly used in Asp.net? 答:session(viewstate)简单,但易丢失 Answer: Session (viewstate) is simple, but easily lost application 全局的 It's global. cookie简单,但可能不支持,长度有限 Cookie's simple, but probably unsupported, limited in length 数据库,稳定,安全,但性能相对弱 Databases, stable, secure, but relatively weak. 133.ASP.NET和ASP相比的进步? 133. ASP.NET versus ASP? asp解释型,aspx编译型,性能高,可以跟美工的工作分开进行,更有利于团队开发 The asp interpretive, aspx-editorial, high performance, can be separated from the work of the artwork, which is more conducive to team development. 134.sleep() 和 wait() 有什么区别? 134.sleep() and wait() differ? sleep()方法是将当前线程挂起指定的时间。 The sleep() method is to hang the current thread at the specified time. wait()释放对象上的锁并阻塞当前线程,直到它重新获取该锁。 Wait() to release the lock on the object and block the current thread until it regains the lock. 135.new 关键字用法 135.new keyword new 运算符 用于创建对象和调用构造函数。 The new operator is used to create objects and call construction functions. new 修饰符 用于向基类成员隐藏继承成员。 The new modifier is used to hide the successor member from the base category. new 约束 用于在泛型声明中约束可能用作类型参数的参数的类型。 New type of constraint The type of parameter that is used to bind parameters that may be used as parameters of a type in a generic statement. new实现多态 New is multi-stated. 136.如何把一个Array复制到ArrayList里 实现1 string[] s={ "111","22222" }; ArrayList list=new ArrayList(); list.AddRange(s); Achieved 1string[] s={ "111", "22222"}; ArrayList List=new ArrayList(); list.AddRange(s); 实现2 string[] s={ "111","22222" }; ArrayList list=new ArrayList(s); Achieved 2string[] s={ "111", "22222"}; ArrayList List=new ArrayList(s); 137.DataGrid的DataSouse可以连接什么数据源 DataTable DataView DataSet DataViewManager 任何实现IListSource接口的组件 Any component to achieve the IListSource interface 任何实现IList接口的组件 Any component to achieve the IList interface 138.什么是强类型,什么是弱类型?哪种更好些?为什么? What's the strong type, what's the weak type? Which is better? Why? 强类型是在编译的时候就确定类型的数据,在执行时类型不能更改,而弱类型在执行的时候才会确定类型。 The strong type is defined when the data are compiled and cannot be changed at the time of implementation, whereas the weak type is determined at the time of implementation. 没有好不好,二者各有好处,强类型安全,因为它事先已经确定好了,而且效率高。 No good or bad, the two have advantages, strong types of security, as it has been identified in advance and is efficient. 一般用于编译型编程语言,如c++,java,c#,pascal等,弱类型相比而言不安全,在运行的时候容易出现错误,但它灵活,多用于解释型编程语言,如javascript,vb等。 Commonly used for programming languages such as c++, java, c#, pascal, which are less secure than for weak types, are prone to error while running, but are flexible and more often used for interpreting programming languages such as javascript, vb, etc. 139.DateTime是否可以为null? 139.DateTime for null? 不能,因为其为Struct类型,而结构属于值类型,值类型不能为null,只有引用类型才能被赋值null No, because it's the Struct type and the structure is the value type, the value type is not null, only the reference type can be assigned null 140.using()语法有用吗?什么是IDisposable?它是如何实现确定性终结的 有用,实现了IDisposiable的类在using中创建,using结束后会自定调用该对象的Dispose方法,释放资源。不明白什么是确定性终结 Useful, realizing that the Disposable class is created in using, and using the client's Dispose method to release resources after using it. I don't know what a definitive end is. 141.Assembly.Load("foo.dll");这句话是否正确? 错误,正确的应该是Assembly.Load("foo");或者Assembly.LoadFrom("foo.dll"); Error, right as Assembly. Load; or Assembly. LoadFrom ("foo.dll"); 142.如何理解死锁的概念?死锁是如何形成的?在应用中应注意什么事项避免死锁? 死锁是一种条件,不仅仅是在关系数据库管理系统 (RDBMS)中发生,在任何多用户系统中都可以发生的。当两个用户(或会话)具有不同对象的锁,并且每个用户需要另一个对象的锁时,就会出现死锁。每个用户都等待另一个用户释放他的锁。当两个连接陷入死锁时,Microsoft? SQL Server? 会进行检测。其中一个连接被选作死锁牺牲品。该连接的事务回滚,同时应用程序收到错误。 阻塞 任何基于锁的并发系统都不可避免地具有可能在某些情况下发生阻塞的特征。当一个连接控制了一个锁,而另一个连接需要冲突的锁类型时,将发生阻塞。其结果是强制第二个连接等待,或在第一个连接上阻塞。 其实所有的死锁最深层的原因就是一个——资源竞争。 表现一: 一个用户A 访问表A(锁住了表A),然后又访问表B,另一个用户B 访问表B(锁住了表B),然后企图访问表A。这时用户A由于用户B已经锁住表B,它必须等待用户B释放表B,才能继续,好了他老人家就只好老老实实在这等了。 同样用户B要等用户A释放表A才能继续这就死锁了。 解决方法: 这种死锁是由于你的程序的BUG产生的,除了调整你的程序的逻辑别无他法。 仔细分析你程序的逻辑: 1:尽量避免同时锁定两个资源; 2: 必须同时锁定两个资源时,要保证在任何时刻都应该按照相同的顺序来锁定资源。 表现二: 用户A读一条纪录,然后修改该条纪录,这是用户B修改该条纪录,这里用户A的事务里锁的性质由共享锁企图上升到独占锁(for update),而用户B里的独占锁由于A有共享锁存在所以必须等A释放掉共享锁,而A由于B的独占锁而无法上升的独占锁也就不可能释放共享锁,于是出现了死锁。 这种死锁比较隐蔽,但其实在稍大点的项目中经常发生。 解决方法: 让用户A的事务(即先读后写类型的操作),在select 时就是用Updatelock 143.什么是事务? 使用事务的语句有哪些? 答:事务是一种机制,是一个操作序列,它包括了一组数据库操作命令,并且所有的命令作为一个整体向 系统提交或者撤消操作请求,要么全部,要么全部不执行. begin transaction commit transaction rollbacktransaction 145.请谈谈你对OOP的理解。 面向对象编程(Object Oriented Programming,OOP,面向对象程序设计)是一种计算机编程架构。OOP 的一条基本原则是计算机程序是由单个能够起到子程序作用的单元或对象组合而成。OOP 达到了软件工程的三个主要目标:重用性、灵活性和扩展性。为了实现整体运算,每个对象都能够接收信息、处理数据和向其它对象发送信息。OOP 主要有以下的概念和组件: 组件 -数据和功能一起在运行着的计算机程序中形成的单元,组件在 OOP 计算机程序中是模块和结构化的基础。 抽象性 -程序有能力忽略正在处理中信息的某些方面,即对信息主要方面关注的能力。 封装 -也叫做信息封装:确保组件不会以不可预期的方式改变其它组件的内部状态;只有在那些提供了内部状态改变方法的组件中,才可以访问其内部状态。每类组件都提供了一个与其它组件联系的接口,并规定了其它组件进行调用的方法。 多态性 -组件的引用和类集会涉及到其它许多不同类型的组件,而且引用组件所产生的结果得依据实际调用的类型。 继承性- 允许在现存的组件基础上创建子类组件,这统一并增强了多态性和封装性。典型地来说就是用类来对组件进行分组,而且还可以定义新类为现存的类的扩展,这样就可以将类组织成树形或网状结构,这体现了动作的通用性。 146.UDP连接和TCP连接的异同。 146. UDP connection to TCP. 或者
TCP是传输控制协议,提供的是面向连接的,是可靠的,字节流服务,当用户和服务器彼此进行数据交互的时候,必须在他们数据交互前要进行 TCP连接之后才能传输数据。TCP提供超时重拨,检验数据功能。 TCP is a transmission control protocol and provides a link-oriented, reliable, byte stream service, and when users and servers interact with each other, they must have TCP connections before they interact with each other before transmitting data. UDP是用户数据报协议,是一个简单的面向数据报的传输协议,是不可靠的连接。 UDP is a user data reporting protocol, a simple data reporting transfer protocol, an unreliable connection. 147.常用的调用web service方法有哪些? 147. 148.私有程序集与共享程序集有什么区别? 148.
答:前者只管传,不管数据到不到,无须建立连接.后者保证传输的数据准确,须要连结.
/strong> answer: transfer only, whether data are available or not, does not need to be connected. >..............................................................................................................................................................
答:
可以从浏览器、ASP页或其他WEB服务调用可以使用HTTP-GET HTTP-POST访问WEB服务也可以从ASP页或其他WEB服务向其他WEB服务发出SOAP请求HTTP-GET HTTP-POSTSOAP 使用WEB服务代理
>/span> from browser, ASP or other WEB services to access HTTP-GET HTTP-POSTOP WEB services to access WEB services from ASP pages or other WEB services to send SOAP requests to HTTP-GET HTTP-POSTSOAP and WEB service agent
一个私有程序集通常为单个应用程序所使用,并且存储于这个应用程序所在的目录之中,或此目录下面的一个子目录中。共享程序集通常存储在全局程序集缓存(Global Assembly Cache)之中,这是一个由.NET运行时所维护的程序集仓库。共享程序集通常是对许多应用程序都有用的代码库,比如.NET Framework类。
149.CLR与IL分别是什么含义?
CLR:公共语言运行时,类似于Java中的JVM,Java虚拟机;在.Net环境下,各种编程语言使用一种共同的基础资源环境,这就是CLR,CLR将直接与*作系统进行通信,而编程语言如C#.NET将尽量避免直接与*作系统直接通信,加强了程序代码的执行安全性,可以这样看:CLR就是具体的编程语言如:C#.NET与*作系统之间的翻译,同时它为具体的编程语言提供了许多资源:
IL,中间语言,也称MSIL,微软中间语言,或CIL,通用中间语言;所有.NET源代码(不管用哪种语言编写)在进行编译时都被编译成IL。在应用程序运行时被即时(Just-In-Time,JIT)编译器处理成为机器码,被解释及执行。
In the context of.Net, the programming languages use a common basic resource environment in which the CLR, the CLR will communicate directly with the * system, while the programming language such as C#.NET will avoid direct communication with the * system and enhance the safety of the implementation of the program code, as can be seen from the fact that the CLR is a specific programming language such as the system translation between C#.NET and *, while it provides many resources for the specific programming language:
IL, the intermediate language, also known as the MSIL, the Microsoft Intermediate Language, or the CIL, the Universal Intermediate Language; and all the.NET source code (in whatever language it is prepared) is translated into the L.J. at the time when the application is translated into the I.J.
150.请解释ASP.NET中以什么方式进行数据验证
答:Asp.net 中有非空验证,比较验证,取值范围验证,正则表达式验证及客户自定义验证五大控件,另还有一个集中验证信息处理控件
150. Please explain the manner in which the data validation in ASP.NET was carried out in
/strong>
>br>
150.请解释web.config文件中的重要节点
appSettings包含自定义应用程序设置。
system.web 系统配置
compilation动态调试编译设置
customErrors自定义错误信息设置
authentication身份验证,此节设置应用程序的身份验证策略。
authorization授权, 此节设置应用程序的授权策略.
150. Explains the key nodes in the web.config
/span> file appSettings contains custom application settings.
system.web system configuration
companiment dynamic deburetation settings
customErrors customise bug information settings
Authification authentication strategies for applications.
Authorization authorization, & nbsp; set up application authorization strategies in this section.
151.请解释ASP.NET中的web页面与其隐藏类之间的关系?
一个ASP.NET页面一般都对应一个隐藏类,一般都在ASP.NET页面的声明中指定了隐藏类例如一个页面Tst1.aspx的页面声明如下
<%@ Page language="c#" Codebehind="Tst1.aspx.cs"AutoEventWireup="false" Inherits="T1.Tst1" %>
Codebehind="Tst1.aspx.cs" 表明经编译此页面时使用哪一个代码文件
Inherits="T1.Tst1" 表用运行时使用哪一个隐藏类。
152.什么是viewstate,能否禁用?是否所用控件都可以禁用?
Viewstate是保存状态的一种机制,EnableViewState属性设置为false即可禁用。
what is a viewstate, can it be disabled? Are the controls available to be disabled?
/strang>Viewstate is a mechanism for keeping the state that can be disabled by setting the properties of EnableViewState as false?
153.发现不能读取页面上的输入的数据时很有可能是什么原因造成的?怎么解决?
很有可能是在Page_Load中数据处理时没有进行Page的IsPostBack属性判断
154.请解释什么是上下文对象,在什么情况下要使用上下文对象
上下文对象是指HttpContext类的Current 属性,当我们在一个普通类中要访问内置对象(Response,Request,Session,Server,Application等)时就要以使用此对象
//strang> is probably the result of the fact that Page's PostBack properties were not processed in Page_Load.
br>br>154. explains what is the context object, and under what circumstances the context object
/strang> is used to refer to the parent & nbsp in the HttpContex category; attributes, when we have access to internal objects in a general category (Response, Request, Session, Server, Application, etc.) we have to use this object
155.请简述一下用Socket进行同步通讯编程的详细步骤
1、在应用程序和远程设备中使用协议和网络地址初始化套接字
2、在应用程序中通过指定端口和地址建立监听
3、远程设备发出连接请求
4、应用程序接受连接产生通信scoket
5、应用程序和远程设备开始通讯(在通讯中应用程序将挂起直到通讯结束)
6、通讯结束,关闭应用程序和远程设备的Socket回收资源
Please describe briefly the detailed steps for synchronizing communications programming with Socket
1, the use of protocols and network addresses in applications and remote devices
2, the establishment of listening
3 in applications by specified ports and addresses, requests for connection from remote devices
4, requests for connection from applications to receive connection resulting in communications scoket
5, applications and remote devices starting communications (in which applications will be hung up until the end of the communication)
6, communications closed, and Socket recovery resources from applications and remote devices
>br > >.
156.能用foreach遍历访问的对象需要实现?
答:需要实现IEnumerable接口和GetEnumerator()方法。
needs to be achieved by using forach to visit?
Answer: There is a need to achieve the IEnumerable interface and the GetEnumerator() method.
157.维护数据库的完整性、一致性、你喜欢用触发器还是自写业务逻辑?为什么
答:尽可能用约束(包括CHECK、主键、唯一键、外键、非空字段)实现,这种方式的效率最好;其次用触发器,这种方式可以保证无论何种业务系统访问数据库都能维持数据库的完整性、一致性;最后再考虑用自写业务逻辑实现,但这种方式效率最低、编程最复杂,当为下下之策
158.ASP.NET与ASP相比,主要有哪些进步?
答 asp.net 可以使用强类型语言
页面是编译,执行速度快, 增加安全性和可靠性
,通过继承机制来支持代码的重用,提供声明性服务器控件减少代码行数
Asp需要解释,执行速度慢,重用代码不方便,没有调试机制
159.用最有效的方法算出等已8对于几?
答:2<<3.
160.请解释转发与跳转的区别?
答:Transfer是转发包括HttpHandler对象,Redirect是跳转。
Server.Transfer(ASP 3.0 以上)和Response.Redirect 在以前的ASP中就存在了,Page.Navigate是ASP.NET Beta 1 提供的新功能,它们之间的区别在于:
1、 Server.Transfer - 用于把处理的控制权从一个页面转移到另一个页面,在转移的过程中,没有离开服务器,内部控件(如:request, session 等)的保存的信息不变,因此,你能从页面 A 跳到页面 B 而不会丢失页面 A 中收集的用户提交信息。此外,在转移的过程中,浏览器的 URL 栏不变。
2、Response.Redirect - 发送一个 HTTP 响应到客户端,告诉客户端跳转到一个新的页面,客户端再发送跳转请求到服务器。使用此方法时,将无法保存所有的内部控件数据,页面 A 跳转到页面 B,页面 B 将无法访问页面 A 中 Form 提交的数据。
3、Page.Navigate - Page.Navigate 实现的功能和 Response.Redirect 差不多,它实际上包括三个步骤:首先调用 Response.Redirect,其次依次卸载所有的控件,最后调用 Response.End。
Page. Navigate - & nbsp; Page. Navigate functions performed and Response.Redirect roughly, it actually consists of three steps: first call Response.Redirect, which unloads all controls in turn and finally calls Response. End.
161.请解释ASP.NET中button、linkbutton、imagebutton及hyperlink这四个控件之间的区别。
答: button和imagebutton 将数据传递回服务器
hyperlinK 页面之间的导航
linkbutton主要用于将数据保存到服务器或访问服务器上的数据
162.如果出现ASP.NET中的事件不能触发可能由于什么原因造成?
如果在web窗体中使用了验证控件,那么当验证控件中的验证逻辑没有通过时一般会使事件不能触发执行。
如果使用了诸如Textchange、Checkchange、Selectedindexchanged这类事件并在
服务器端进行了事件处理,但是没有设置AutoPostBack属性时会使事件不能触发执行。
163.什么情况用HTML控件,什么情况用WEB控件,并比较两者差别
答:客户端表现用html控件,如果想和server端交互,那么加上runat=server,它就成了服务器端控件,但它没有web控件的很多方法和属性,如果你需要用到,那么还是用webcontrols。
answer: Client performance uses html controls, and if you want to interact with the server end, plus runat=server, it becomes a server control, but it does not have many methods and attributes for web controls, and if you need to use them, it uses Webcontrols.
164.你在写复杂web界面的时候遇到的最大困难是哪些方面
其实,复杂页面最大的困难并非如何画出此界面,而是如何让此界面清晰有条理.我们做页面,并非仅显示数据,而是要准确/清晰地显示数据,想想看,如果用户要在此页面中查找一个数据,却杂乱无章,难以查看,你说用户会满意吗?
166.NET里面的datagrid翻页大多是先把数据读全部取到dataset里面,但是遇到10W条数据以上,这样的翻页事件开销会很大,页面执行起来反映很慢,你有什么好方法解决?
在数据量大的时候,有两个解决办法
1.使用存储过程.并且,并非因为存储过程比较快的原因.由于在数据库内部的存储过程,能够实现一些特殊的功能,比如说,可以直接根据当前的排序结果,仅仅取需要的几条数据,如此,无论数据是多少,它仅仅取需要的几条.
2.在实际的操作中,取出的数据,并非你有10万条,它就会把10万条全部取出来,而是受限于服务器的缓存,其实一次一般仅取1000条左右的记录,无论你数据多少,它仅会一次取这么多出来.所以,配合分页控件,再配合.NET提供的加载N条数据的方法,数据量大的情况下,不见得就会慢.
据我测试,真正慢的,是在取数据总共多少条这个步骤上.此操作在数据少时,没有影响,但在百万条记录以上时,求取数据总数,耗时就会大量增加.所以,大数据量条件下,即不应再显示"共几条/当前第几条"这样的信息.
167.权限控制方面问题:
从面向对象的角度讲,如果一个程序中,没有应用角色及角色组的话,那么这个程序是不合格的.一般来说,权限是由权限及流程角色组合而来的,如果仅有权限而没有角色,那么这个控制不灵活;如果仅有角色没有权限,那么这个控制不细致.
当然,用SESSION肯定是要的,但这个SESSION,应当只记录当前用户的个人信息,比如他的用户名.在需要判断的时候,根据他的用户名(唯一),至数据库中去取他的权限,或在类中编写权限/角色,根据此用户的用户号及当前模块号,计算当前用户是否对当前页面有操作权限.不过,如果把用户的权限也取出来放在SESSION中的话,这种做法一般仅在很小的网站中使用,稍大一点的系统,基本不允许这么做,而且也做不到。
168.如何理解.net中的垃圾回收机制?
答:.NET中的垃圾回收机制是引用程序对内存的回收和释放。当每次用new关键字创建一个对象时,运行库都要从托管堆中为其分配内存,因为空间是有限的,最终垃圾回收机制是要回收不用的内存的。已释放内存,重新使用。
169.解释一下UDDI、WSDL的意义及其作用?
答:UDDI是统一描述集成协议,是一套基于Web的,分布式的,为WEB服务提供的信息注册的实现标准规范,同时为也是为企业本身提供的 Web服务注册以让别的企业能够发现并访问的协议标准。提供了基于标准的规范,用于描述和发现服务,还提供了一组基于因特网的实现。
WSDL这是一个基于XML的描述WEB服务的接口。
170.在.NET中所有类的基类是?
答:object。
171.WEB控件可以激发服务端事件,请谈谈服务端事件是怎么发生并解释其原理?自动传回是什么?为什么要使用自动传回。
在web控件发生事件时,客户端采用提交的形式将数据交回服务端,服务端先调用Page_Load事件,然后根据传回的状态信息自动调用服务端事件自动传回是当我们在点击客户端控件时,采用提交表单的形式将数据直接传回到服务端
只有通过自动传回才能实现服务端事件的机制,如果没有自动回传机制就只能调用客户端事件,而不能调用服务端事件
172.值类型和引用类型的区别?
答:值类型的值是存放在堆栈中的,改变其值,不改变变量原有的值,而引用类型的值是存放在栈中的,其引用的地址是存放在堆栈中的,改变其值也就改变了变量原有的值。值类型不允许包含null值,然而可空类型可以将null赋值给值类型。
173.什么叫应用程序域?什么是托管代码?什么是强类型系统?什么是装箱和拆箱?什么是重载?CTS、CLS和CLR分别作何解释?
答:应用程序域:就是为安全性,可靠性,隔离性,和版本控制,及卸载程序提供的隔离边界。它通常由运行库宿主创建,应用程序域提供了一个更安全,用途更广的处理单元。
托管代码:使用CLR编译语言编辑器开发编写的代码就叫托管代码。
装箱和拆箱:是把值类型转换为引用类型的过程,是隐式的,相反的过程就是拆箱,是显式的。
CTS是公共类型系统,CLS是公共语言规范,CLR公共语言运行库。
强类型系统:每个变量和对象都必须具有申明类型。
174.构造器Constructor是否可以被继承?是否可以被Override?
答:Constructor不可以被继承,因此不能被重写(Overriding),但可以被重载(Overloading)。
175.当一个线程进入一个对象的方法后,其它线程是否可以进入该对象的方法
答:不可以,一个对象的方法只能由一个线程访问。
176.接口是否可以继承接口?抽象类是否可以实现接口?抽象类是否可以继承实体类?
答:接口是可以继承接口的,抽象类是可以实现接口的,抽象类可以继承实体类,但是有个条件,条件是,实体类必须要有明确的构造函数。
177.谈谈final,finally,finallize的区别?
答:final用于申明属性,方法和类,表示属性不可变,方法不可以被覆盖,类不可以被继承。
Finally是异常处理语句结构中,表示总是执行的部分。
Finallize表示是object类一个方法,在垃圾回收机制中执行的时候会被调用被回收对象的方法。
以下是08年3月新增面试题
1. asp.net中web应用程序获取数据的流程:
1. .asp.net to access data from web applications:
A.WebPage
B.Fill
C.Sql05
D.DataSourse
E.DataGrid
F.DataSet
G.Selectand Connect
CommandsH.Sql Data Adapter
答案:a,e,d,f,h,g,b,c
Answer: a,e,d,f,h,g,b,c
2. Asp.net执行模式中各组件填入到对应位置:
2. Each component in the Asp.net execution mode is filled in to its corresponding position:
A.OutputCache
B.Parser
C.AssemblyCache
D.IE
E.Memory
F.Compiler
WebPage被第一次请求时:
When WebPage was first requested:
D->__->__->__->__->D
WebPage被第二次请求时:
When WebPage was asked for a second time:
D->__->__->D
WebPage的页面输出缓存被打开时:
When WebPage's page output cache is opened:
D->__->D
答案:
Answer:
WebPage被第一次请求时:
When WebPage was first requested:
D->_b_->_f_->_a_->_e_->D
WebPage被第二次请求时:
When WebPage was asked for a second time:
D->_b_->_e_->D
WebPage的页面输出缓存被打开时:
When WebPage's page output cache is opened:
D->_a_->D
3.两个数组[n] [m] n>m 第一个数组的数字无序排列第二个数组为空取出第一个数组的最小值放到第二个数组中第一个位置, 依次类推. 不能改变A数组,不能对之进行排序,也不可以倒到别的数组中。
3. Two arrays [n] [m] n>m the number of the first array unordered the second array to empty the minimum value of the first array and place it in the first position of the second array, by analogy.
int[]a={ -20, 9, 7, 37, 38, 69, 89, -1, 59, 29, 0, -25, 39, 900, 22, 13, 55 };
int[]b=new int[10];
intintTmp=a[0], intMaxNum;
for(int i=0; i < a.Length; i++)
{
intTmp=a[i] > intTmp ? a[i] : intTmp;
}
intMaxNum=intTmp;
for(int j=0; j < b.Length; j++)
{
for (int i=0; i < a.Length; i++)
{
if (j==0)
intTmp=a[i] < intTmp ? a[i] : intTmp;
else
{
if(a[i] > b[j - 1])
intTmp=a[i] < intTmp ? a[i] : intTmp;
}
}
b[j]=intTmp;
intTmp=intMaxNum;
}
foreach(int bb in b)
{
Console.WriteLine(bb);
}
Console.ReadLine();
4.请将字符串"I am a student"按单词逆序输出如"student a am I"
4. Please export the string "I am a student" in reverse order of words like "student a am I"
stringS="I am a student";
char[]C=new char[] { ' '};
string[]n=S.Split(C);
intlength=S.Length;
for(int i=length-1 ; i >=0; i--)
{
Console.Write(n[i]);
if (i !=0)
{
Console.Write(" ");
}
}
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论