. Net face Questions Summary (iii)

Source: Internet
Author: User
Tags closing tag finally block

101. What are the authentication methods for ASP. What is the principle of the distinction?
Answer: Windwos (default) with IIS ...
From (form) with account
Passport (Key)


102. In. NET, what does the accessory mean?
Answer: Assembly. (intermediate language, source data, resources, assembly list)


103. How does net Remoting work?
A: The server sends a process number to the client, a program field number to determine the location of the object


104, according to the relevant knowledge of thread safety, analyze the following code, when the test method is called when the i>10 will cause a deadlock? And briefly explain the reasons.
public void Test (int i)
{
Lock (This)
{
if (i>10)
{
i--;
Test (i);
}
}
}


A: There is no deadlock, but a bit of int is passed by value, so each change is just a copy, so there is no deadlock. But if you change int into an object, the deadlock will happen.)

106. Briefly discuss your understanding of the two technologies of remoting and webservice under the Microsoft. NET Framework and the practical applications.
A: WS is primarily able to use HTTP to penetrate firewalls. Remoting can improve efficiency with TCP/IP, binary delivery

107, in C # to achieve the following functions
A generates an int array with a length of 100 and a random insertion of 1-100 into it, and cannot be repeated


Answer: List l=new list ();
Random random = new random ();
for (int i = 1; i <=; i++)
{
if (L.indexof (i) < 0)
{
L.add (random. Next (1,100));
}
}
b sort the array generated above, need to support ascending, descending order of two
Answer L.reverse (L);
L.sort (L);

108. Please describe the error handling mechanism in. NET, and for example


An exception is an object that inherits from the Exception class class. The exception is raised from the area of the code where the problem occurred, and then passes up the stack until the application processes it or the program terminates.
Try
{//Execute code, not sure if error}
Catch
{//Error handling}
Finally
{//No matter what, execute}

109, please say the meaning of strong name
The principle of garbage collection is based on whether a null reference is used, and the data type consumes memory to determine how much memory to reclaim. A strongly typed white is one that must have a data type.

110. Please list the methods of several loops in C #, and point out their differences
Answer for while the foreach do While

111, please indicate the meaning of the GAC
Answer Global Access Cache

112, SQL srever, insert new data into a table, how to quickly get the current value of the Increment field
Answer INSERT into jobs (JOB_DESC,MIN_LVL,MAX_LVL)
VALUES (' Accountant ', 12,125)

113. What is a Web control? What are the advantages of using Web controls?
A Web control is a control that can be executed on a server, with the advantage of being able to return data with event-driven

114, please explain the ASP. How does data validation be done in net?
A. NET provides several data validation controls that can be verified on either the server side or the client.

115, please talk about the regular expression of the view?
A: It is primarily used for string matching, regardless of the specific locale.

116, ASP. How many kinds of controls are there in the CPC? What's the difference?


Answer HTML control traditional HTML markup
WEB controls can return data, event-driven
Custom controls add functionality based on the original control
Compound control multiple child controls are composited into a new control

117. Web control can be used to stress the service-side event, please talk about how the server-side event occurs and explains its rationale? What is automatically returned? Why use automatic returns.
The event can be executed by implementing the Ipostback interface. Automatic callbacks are AutoPostBack, using auto-callbacks to monitor client changes and return this change to the server


118. Can Web controls and HTML server controls invoke client methods? If so, please explain how to call?
To be able, the server-side controls are represented in HTML or HTML tags, so you can perform client events in several ways: 1, control. attributes["onclick"]= "...;;";
2, <script for= "controlname" event= "onclick" ></script>

119, what is ViewState, can disable? Are the controls you use disabled?
Answer can be disabled all, ViewState is hidden input, but with the Microsoft encoding method to record the state of the control

120. What is likely to be the reason why you cannot read the input data on the page? How to Solve
The answer may be that the event is not associated, or there is no write-read code at all.
Fix check code, set breakpoint debugging

121. Please explain the order of code execution in a Web page.
See. CS knows the first to execute the OnInit (); Then to the Page_Load, and finally to the concrete execution event.

122. Please explain what the context object is, and under what circumstances the context object will be used
Answer HttpContext, you need to use HttpContext when calling in a class

123. Please explain the difference between forwarding and jumping.


Answer Transfer is to forward including HttpHandler object
Redirect is jumping
Server.Transfer (more than ASP 3.0) and Response.Redirect exist in the previous ASP, Page.navigate is the new feature that ASP. NET Beta 1 provides, the difference between them is:
1, Server.Transfer-Used to transfer the control of the processing from one page to another, in the process of transfer, did not leave the server, internal controls (such as: request, session, etc.) saved information is not changed, so you can jump from page A to page B The user submission information collected in page A is not lost. In addition, the URL bar of the browser does not change during the transfer process.
2, Response.Redirect-sends an HTTP response to the client, tells the client to jump to a new page, and the client sends a jump request to the server. When you use this method, you will not be able to save all the internal control data, page a jumps to page B, and page B will not be able to access the data submitted by Form in page A.
3, page.navigate-page.navigate implementation of the function and Response.Redirect almost, it actually includes three steps: First call Response.Redirect, followed by unloading all the controls, and finally call Response.End.

124, please explain the ASP. NET button LinkButton ImageButton and hyperlink between the four controls


A button ImageButton transfer data back to the server
HyperlinK Navigation between pages
LinkButton is primarily used to save data to the server or to access the data on the server

125, please explain. NET multi-tier applications the data is transmitted in several ways between the middle and the layer. And explain the way you do it in your own project.
The delivery method is variable, many of which are passed the dataset, XML can also

126. If ASP is present. NET events can not be triggered by what causes?
A loss of the event, especially when using VSS, is most likely to cause this situation, unexplained

127. What if you need to add a drop-down list box to a column in the Datagride control and bind the data?
A. Use template columns to add DropDownList, bind data using code pre-

128. Explain what is the difference between data binding in ASP and traditional data binding?
More flexible and more convenient

129. Please explain the difference between the event model implemented by the. NET and the event model implemented in Java using an interface.
The answer is explained graphically.

130. What is the meaning of the explicit implementation of the interface?
The provision of mandatory enforcement, consistent

131. What happens with HTML controls, what happens with Web controls, and compare the differences between the two
A client behaves with an HTML control, and if you want to interact with the server side, then add Runat=server, it becomes the server-side control, but it does not have many methods and properties of the Web control, if you need to use, then still use the Web controls

132, how to write design mode with singleton
Answer: The static property inside new, constructor private

133. What is Application Pool?
A: Web apps, like the thread Pool, improve concurrency performance.

134. What is virtual function? What is an abstract function?
A: virtual function: A function that is not implemented and can be inherited and overridden by a subclass. Abstract function: A function that specifies that its non-virtual subclasses must be implemented must be overridden.

135. What is XML?
Answer: XML expands Markup Language. Extensible Markup Language. Tags are information symbols that can be understood by computers, which can be used to process articles that contain various kinds of information between computers. How to define these tags, that is, you can choose International markup language, such as HTML, can also be used as XML, such as the freedom of the relevant people to decide the markup language, which is the extensibility of language. XML is simplified and modified from SGML. It mainly uses XML, XSL, XPath, and so on.

136. What is a Web Service? Uddi?
A: Web service is a network-based, distributed, modular component that performs specific tasks and adheres to specific technical specifications that enable the Web service to interoperate with other compatible components.
The purpose of UDDI is to establish standards for e-commerce; UDDI is a web-based, distributed, Web service-provided, information Registry Implementation Standard specification that also includes a set of Web service registrations that enable enterprises to provide themselves. To enable other enterprises to discover the implementation criteria for the Access Protocol.

137. What is a user control in ASP.
A: User controls are typically used in situations where the content is static or a little bit changed. The use of the relatively large. Similar to the Include in asp: But the features are much more powerful.

138, the difference between property and attribute in C #, what is their usefulness, and where is the benefit of this mechanism?
A: One is a property, a field for accessing a class, one is an attribute, an additional property used to identify a class, a method, etc.

139. The main difference between XML and HTML


Answer: 1. XML is case-sensitive, and HTML is not distinguished.
2. In HTML, if the context clearly shows where the paragraph or list key ends, you can omit the end tag such as </p> or </li>. In XML, you must never omit the end tag.
3. In XML, an element that has a single tag without a matching closing tag must end with A/character. This way the parser knows not to look for the end tag.
4. In XML, attribute values must be enclosed in quotation marks. In HTML, the quotation marks are available for use.
5. In HTML, you can have a property name without a value. In XML, all attributes must have corresponding values.

140. All custom user controls in ASP. NET must inherit from ________?
Answer: Control.

142. All serializable classes in. NET are marked as _____?
Answer: [Serializable]

143. When the class T only declares the private instance constructor, then the outside of the program text of T, ___ can derive a new class from T with ___ (or not), and can not create any instances of T directly from ____ (or not).
A: No, it's not possible.

144, the difference between property and attribute in C #, what is their usefulness, and where is the benefit of this mechanism?
A: attribute: The base class for custom attributes; property: Properties in a class

145. Can C # directly operate on memory?
A: Under. NET,. NET references the garbage collection (GC) feature, which replaces the programmer however, in C #, you cannot directly implement the Finalize method, but instead call the base class's Finalize () method in a destructor

146, the approximate description of the ASP. NET server control's life cycle


A: Initialize load view state processing postback data load send postback change notification handle postback event pre-render save state rendering disposition Uninstall
Anonymous Inner Class (anonymous inner Class) can extends (inherit) other classes, can implements (implement) interface (interface)?
Answer: No, interface can be implemented

147.Static Nested class and Inner class, the more you say the better
A: The static Nested class is an inner class that is declared static (static), and it can be instantiated without relying on an external class instance. The usual inner classes need to be instantiated after the external class is instanced.

the difference between 148.,& and &&.
& is a bitwise operator that represents the bitwise AND Operation,&& is a logical operator that represents the logical and (and).

the difference between 149.HashMap and Hashtable.
A: HashMap is a lightweight implementation of Hashtable (non-thread-safe implementation), they all complete the map interface, the main difference is that the HASHMAP allows null (NULL) key value (key), because of non-thread security, the efficiency may be higher than Hashtable.

150.short s1 = 1; s1 = s1 + 1; what's wrong? short S1 = 1; s1 + = 1; what's wrong?


Answer: short S1 = 1; S1 = s1 + 1; (S1+1 operation result is int type, need cast type)
Short S1 = 1; S1 + = 1; (can be compiled correctly)

151. Can the overloaded method change the type of the return value?
A: The overloaded method is to change the type of the return value.

152. What is the difference between error and exception?


A: Error indicates a serious problem in situations where recovery is not impossible but difficult. For example, memory overflow. It is impossible to expect the program to handle such situations.
Exception represents a design or implementation issue. That is, it means that if the program runs normally, it never happens.

153. What is the difference between <%#%> and <%%>?


A: <%#%> represents a bound data source
<%%> is a server-side code block

154. What do you think is the biggest difference between ASP. 2.0 (VS2005) and the development tools (. NET 1.0 or other) you used before? What development ideas (pattern/architecture) you used on the previous platform can be ported to ASP. NET 2.0 (or already embedded in ASP. NET 2.0)


A: 1 ASP. 2.0 has packaged some of the code, so it's a lot less code than 1.0 of the same functionality.
2 supports both code separation and page embedding server-side code in two modes, formerly 1.0 versions. NET hints help only in separating the code files, unable to get help tips in the page embedding server-side code,
3 when switching between code and design interface, 2.0 supports cursor positioning. I like it better.
4 in the binding data, make the table pagination. Update,delete, such as operation can be visualized operation, convenient for beginners
5 added more than 40 new controls in ASP, reducing workload

155. What is the difference between overloading and covering?


A: 1, the method's coverage is the relationship between the subclass and the parent class, is the vertical relationship, the overload of the method is the relationship between the methods in the same class, and is the horizontal relationship
2. Overrides can only be made by one method, or only by a pair of methods; an overload of a method is a relationship between multiple methods.
3. The override requires the same parameter list, and the overload requires the parameter list to be different.
4, in the coverage relationship, call that method body, is based on the object type (object corresponding to the storage space type) to determine, overload relationship, is based on the invocation of the argument table and formal parameter list to select the method body.

156, describe the implementation of the indexer in C #, whether it can only be indexed according to the number?


Answer: No. Any type can be used.
124.SQLSERVER server, the given table table1 has two field IDs, Lastupdatedate,id represents the updated transaction number, Lastupdatedate represents the server time when the update, use a SQL statement to obtain the last updated transaction number
Answer: Select ID from table1 Where lastupdatedate = (select MAX (lastupdatedate) from table1)

157. Analyze the following code.
public static void Test (String connectstring)

{

System.Data.OleDb.OleDbConnection conn = new System.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 ();
}
}
Excuse me
1) Can the above code use connection pooling correctly?


Answer: If the incoming connectionstring is identical, the connection pool can be used correctly. But the exact same meaning is that the number of spaces in the hyphen is exactly the same as the order.
2) The exception handling method used by the above code, whether all exceptions within the test method can be captured and displayed?
A: You can only catch exceptions in a database connection. (Finally, in catch, you should use Try,catch if there are other actions that might throw an exception.) So theoretically not all anomalies will be captured. )

158, the company requires the development of an inherited System.Windows.Forms.ListView class of components, requirements to achieve the following special features: When you click the ListView column header, you can rearrange all the rows in the view by clicking each row of columns ( Sort the same way as a DataGrid). Based on your knowledge, please briefly discuss your ideas:
A: Depending on the column header of the click, the ID of the package is taken out, sorted by that ID, in the binding to the ListView

159. What is the difference between abstract class and interface?


A: A class that declares the existence of a method and does not implement it is called an abstract class, which is used to create a class that embodies some basic behavior, declares a method for that class, but does not implement the class in that class. An instance of the abstract class cannot be created. However, you can create a variable whose type is an abstract class that points to an instance of a specific subclass. Cannot have abstract constructors or abstract static methods. The subclasses of the abstract class provide implementations for all abstract methods in their parent class, otherwise they are also abstract classes. Instead, implement the method in the subclass. Other classes that know their behavior can implement these methods in the class.
An interface (interface) is a variant of an abstract class. In an interface, all methods are abstract. Multiple inheritance can be obtained by implementing such an interface. All the methods in the interface are abstract, without a program body. An interface can only define static final member variables. The implementation of an interface is similar to a subclass, except that the implementation class cannot inherit the behavior from the interface definition. When a class implements a special interface, it defines the method (which is given by the program body) to all such interfaces. It can then invoke the interface's method on any object that implements the interface's class. Because of an abstract class, it allows you to use the interface name as the type of the reference variable. The usual dynamic binder will take effect. A reference can be converted to an interface type or converted from an interface type, and the instanceof operator can be used to determine whether an object's class implements an interface

160, the difference between property and attribute in C #, what is their usefulness, and where is the benefit of this mechanism?


Property and attribute Chinese are all called attributes. property, however, refers to the data region that the class provides outward. attribute is a description of the object at compile time or runtime property. There is an essential difference between the two.
What is the difference between 52.sleep () and wait ()?
A: The Sleep () method is the method that causes the thread to stop for a period of time. After the sleep interval expires, the thread does not necessarily resume execution immediately. This is because at that point, other threads may be running and not scheduled to abort execution unless (a) the "Wake Up" thread has a higher priority
(b) The running thread is blocked for other reasons.
When wait () is a thread interaction, if the thread makes a wait () call to a synchronization object x, the thread pauses execution, and the object goes into a wait state until it wakes up or waits until the time is up.

161, talk about final, finally, finalize the difference.


For:
final-modifier (keyword) If a class is declared final, it means that it can no longer derive a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared abstract and declared final. Declaring variables or methods as final ensures that they are not changed in use. A variable declared as final must be given an initial value at the time of declaration, and can only be read in subsequent references and cannot be modified. A method that is declared final can also be used only and cannot be overloaded
Finally-provides a finally block to perform any cleanup operations when the exception is processed. If an exception is thrown, the matching catch clause executes, and the control enters the finally block, if any.
The finalize-method name. Java technology allows the use of the Finalize () method to do the necessary cleanup before the garbage collector clears objects from memory. This method is called by the garbage collector to this object when it determines that the object is not referenced. It is defined in the Object class, so all classes inherit it. Subclasses override the Finalize () method to organize system resources or perform other cleanup work. The Finalize () method is called on the object before the object is deleted by the garbage collector.

162, how to deal with hundreds of thousands of concurrent data?
A: Use a stored procedure or transaction. Update at the same time when the maximum identity is obtained. Note that the primary key is not self-incrementing when this method is concurrent and there is no duplicate primary key. Get the maximum identity you want to have a stored procedure to get.

163, the session what is the major bug, Microsoft put forward what method to solve?
A: IIS because of the process recycling mechanism, the system is busy session will be lost, you can use Sate server or SQL Server database to store the session but this way is slower, and can not capture the end event of the session.

164. What is the difference between heap and stack?


For:
Stack: Automatically allocated and freed by the compiler. The variables defined in the function body are usually on the stack.
Heap: Typically freed by programmer allocations. Allocating memory functions such as new, malloc, and so on are allocated on the heap.

165, member variables and member functions before adding static function?
A: They are called constant member variables and constant member functions, also known as Class member variables and class member functions. To reflect the state of the class, respectively. For example, a class member variable can be used to count the number of instances of a class, and the class member function is responsible for this statistical action.

166. Start a thread with run () or start ()?
A: Starting a thread is calling the start () method so that the virtual processor represented by the thread is in a running state, which means it can be dispatched and executed by the JVM. This does not mean that the thread will run immediately. The run () method can produce a flag that must be exited to stop a thread.

167, interface can inherit interface? is an abstract class achievable (implements) interface? Does an abstract class inherit entity classes (concrete Class)?
A: An interface can inherit an interface. Abstract classes can implement (implements) interfaces, whether an abstract class can inherit an entity class, but only if the entity class must have an explicit constructor.

168. Can the constructor constructor be override?
A: The constructor constructor cannot be inherited, so overriding cannot be overridden, but it can be overloaded with overloading.

169. Can I inherit the String class?
A: The string class is the final class and cannot be inherited.

170. There is a return statement in try {}, then the code in the finally {} immediately after this try will not be executed, when executed, before or after the return?
A: It executes and executes before return.

171, two object values are the same (x.equals (y) = = true), but can have different hash code, this sentence right?
Answer: No, there is the same hash code.

172, whether the Swtich can function on a byte, whether it can function on a long, whether it can function on a string?
Answer: in switch (EXPR1), expr1 is an integer expression. So the arguments passed to the switch and case statements should be int, short, char, or byte. Long,string can not act on Swtich.

173. When a thread enters an synchronized method of an object, does the other thread have access to other methods of this object?
No, an synchronized method of an object can only be accessed by one thread.

174, the abstract method can be static at the same time, whether it can be native at the same time, whether it can be synchronized at the same time?
Answer: No.

175, List, Set, map inherit from collection interface?
A: List,set is map is not

176, set of elements can not be repeated, then what method to distinguish the repetition or not? Are you using = = or equals ()? What is the difference between them?


A: The elements in set cannot be duplicated, so use the iterator () method to distinguish between duplicates or not. Equals () is the interpretation of two sets for equality.
The Equals () and = = methods Determine whether the reference value points to the same object Equals () is overwritten in the class so that when the contents and types of the two detached objects match, the truth is returned.

177. Does the array have the length () method? Does string have the length () method?


A: The array does not have the length () method and has the length property. String has the length () method.
Ava.lang.StringBuffer A variable sequence of characters for thread safety. A string-like buffer, but cannot be modified. Although it contains a specific sequence of characters at any point in time, some method calls can change the length and content of the sequence.

178. What is the difference between String StringBuffer and StringBuilder?


To talk about their differences, first of all they are the same place between them, first of all they are the collection of characters stored, their maximum length is 2G, they are stored in string data structures are used a character array, that is, they have defined a character array, used to store the value of the string.
They differ in the following points:
1) The difference between a fixed length and a variable length for an array of character types:
The array defined internally by the string type is fixed-length, and once the user assigns a value to the string array object, the length of the character array inside it is fixed;
The internal array of the Stringbuff array is also fixed-length, but in a running state, it can dynamically expand the capacity of the character array.
2) difference in efficiency:
A string array is more efficient than stringbuff in all of its own operations. However, if you do a long string merge, Stringbuff is much more efficient than string.
The reason for this is that stirng each time it re-creates a new string object and then makes a full string copy. While Stringbuff does not reach his capacity limit, it does part of the string copy work afterwards.
Example: String str1= "1234";
str1=str1+ "5678";
The work it does is to recreate a str1 object, which is 8 in length, then copy "1234" to the new str1, and then copy "5678" to the new str1, which is very inefficient for large string operations, and there is a memory overflow situation. The original str1 garbage collector should be free of memory for a timely recovery.
Example: Stringbuff buff1
Buff1.append ("11111");
Its operation is to first determine whether the capacity of the internal character array object value can load the string to be merged, if you can directly copy the new string "11111", if you cannot also create a new character array object, This character array object is twice times the length of the original character array object, then copies the value contents and copies the new string, and finally assigns the expanded character array object to value.
This is much more efficient than string when working with a large array of strings.
3) thread-safe. In a multithreaded environment, operations on Stringbuff objects are thread-safe, meaning that only one thread at a time can handle Stringbuff objects.

179. What is the biggest difficulty you encounter when writing a complex web interface ?
In fact, the biggest difficulty of complex pages is not how to draw this interface, but how to make this interface clear and coherent. We do the page, not just display the data, but to accurately/clearly display the data, think about it, if users want to find a data on this page, but messy, difficult to view, you say users will be satisfied?


180, net inside the DataGrid most of the paging is the first to read all the data into the dataset, but encountered 10W data above, such a paging event overhead will be very large, the page execution reflects very slowly, what do you have a good way to solve?


When the volume of data is large, there are two solutions
1. Use stored procedures. And, not because the stored procedure is faster. Because of the stored procedures inside the database, it is possible to implement some special functions, for example, to take just a few of the required data directly according to the current sorting results, so that, regardless of the data, it takes only a few.
2. In the actual operation, take out the data, not you have 100,000, it will take 100,000 all out, but is limited to the server cache, in fact, a generally only 1000 records, no matter how much you data, it will only take so much out. So, with pagination control, and then mates. NET provides the method of loading n data, the data volume is large, it is not necessarily slow.
According to my test, the real slow is the number of data in the total amount of this step. This operation has no effect when the data is low, but when the millions records above, the total amount of data is increased. Therefore, in the case of large data volumes, it is not necessary to display a "total of several/current" information.

181, rights control aspects of the problem:
From an object-oriented perspective, if there are no roles and role groups in a program, then the program is not qualified. In general, permissions are combined by a combination of permissions and process roles, which is not flexible if there are only permissions and no roles, and this control is not detailed if only the role has no permissions.
Of course, the session is definitely required, but this session should only record the current user's personal information, such as his user name. When you need to judge, according to his user name (unique) to the database to fetch his permissions, or write permissions/roles in the class, Calculates whether the current user has permission to operate on the current page, based on the user's user number and current module number. However, if the user's permissions are also taken out of the session, this practice is generally used only in small sites, a slightly larger system, the basic is not allowed to do so, and can not do

Mo Xuan June Source: http://www.cnblogs.com/yuan-jun/p/6502795.html This article copyright belongs to the author and the blog Park is shared, welcome reprint, but without the author's consent must retain this paragraph of the statement, And in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.

. Net face Questions Summary (iii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.