130 common ASP. NET Interview Questions and Answers recommended by Microsoft, and 130 asp.net

Source: Internet
Author: User

130 common ASP. NET Interview Questions and Answers recommended by Microsoft, and 130 asp.net

1. Briefly describe the access permissions of private, protected, public, and internal modifiers.

A. private: private Members can be accessed within the class.

Protected: protects members, which can be accessed within the class and in the inheritance class.

Public: A public member. It is completely public and has no access restrictions.

Internal: accessible within the same namespace.

2. List several methods for passing values between ASP. NET pages.

Answer. 1. Use QueryString, such ....? Id = 1; response. Redirect ()....

2. Use Session Variables

3. Use Server. Transfer

 

4. What is the delegate in C? Is an event a delegate?

A: A delegate can substitute a method as a parameter to another method.

A delegate can be understood as a reference to a function.

Yes, it is a special delegate

5. Differences between override and overload

A: What is the difference between override and overload. Overload means that the method name is the same. Multiple

Secondary overload to meet different needs

Override is used to Override functions in the base class. To meet your needs.

6. If the variable value needs to be passed in a B/S system, but the Session,

Cookie and Application. How do you handle them?

A: this. Server. Transfer

Response. Redirect () --- QueryString

 

9. To describe the implementation process of the indexer in C #, can it be indexed only by numbers?

A: No. Any type can be used.

11. Use. net as the B/S structure system. You are using several layers of structure for development. The relationship between each layer and

What do we need to layer it like this?

A: Generally, it is three layers.

Data access layer, business layer, and presentation layer.

The data access layer adds, queries, and modifies databases.

The business layer is generally divided into two layers. The business apparent layer communicates with the presentation layer, and the business rule layer Implements user authentication.

Code security.

The presentation layer adds a form to interact with users, for example, users.

Advantages: clear division of labor, clear organization, easy debugging, and scalability.

Disadvantage: increase costs.

13. What is an application domain?

A: The application domain can be considered as a lightweight process. Security. Small resource occupation.

14. What are the explanations of CTS, CLS, and CLR?

A: CTS: a general-purpose language system. CLS: general language specification. CLR: Common Language Runtime Library.

15. What is packing and unpacking?

A: From the value type interface to the Reference Type Packing. Converts a reference type to a value type Unbox.

16. What is regulated code?

A: unsafe: unmanaged code. Does not run through CLR.

17. What is a strong system?

A: RTTI: The type recognition system.

Which classes are required for reading and writing databases in 18.net? What are their roles?

Answer: DataSet: data storage.

DataCommand: Execute the statement command.

DataAdapter: a collection of data.

What are the authentication methods for 19.ASP.net? What are their principles?

Answer: 10. Windwos (default) IIS... From (form) account... Passport (key)

20. What is Code-Behind technology?

A: Code post-planting.

21. In. net, what does the accessory mean?

A: assembly. (Intermediate language, source data, resources, assembly list)

22. What are common WebService call methods?

A: 1.use the wsdl.exe command line tool.

2. Use the Add Web Reference menu option in VS. NET

What is the working principle of 23..net Remoting?

A: the server sends a process number and a program domain number to the client to determine the object location.

.

24. In C #, string str = null and string str = "". Use text or graphs whenever possible.

The difference.

A: string str = null does not allocate memory space to it, while string str = "" assigns it

Memory space with a null string.

25. What are the similarities and differences between classes and struct in dotnet?

A: The Class can be instantiated. It belongs to the reference type and is allocated to the memory stack. Struct is a value Class.

Is allocated to the memory stack.

27. Analyze the following code to complete filling

String strTmp = "abcdefg ";

Int I = System. Text. Encoding. Default. GetBytes (strTmp). Length;

Int j = strTmp. Length;

After the above code is executed, I = j =

Answer: I = 13, j = 10

28. In the SQLSERVER server, the given table table1 contains two field IDs, LastUpdateDate,

ID indicates the updated transaction number, and LastUpdateDate indicates the server time during the update.

Obtain the last updated transaction number for the SQL statement.

A: Select id from table1 Where LastUpdateDate = (Select MAX

(LastUpdateDate) FROM table1)

30. Briefly discuss your understanding of the remoting and webservice technologies under the Microsoft. NET architecture and

The actual application.

A: WS uses HTTP to penetrate the firewall. Remoting can use TCP/IP to transmit binary data.

Improve efficiency.

31. The company requires the development of a component that inherits the System. Windows. Forms. ListView class.

The following special functions: When you click the header of each column in The ListView, You can rearrange the values of each row in the clicked column.

All rows in the figure (the sorting method is similar to the DataGrid ). Based on your knowledge, please briefly discuss your

Ideas

A: Based on the column header that you click, the ID of this column is taken out, sorted by this ID, and bound to ListView.

 

33. Write an SQL statement: extract the 31st to 40th records in Table A (SQLServer, with an automatically increasing ID

As the primary key. Note: IDS may not be consecutive.

Answer: solution 1: select top 10 * from A where id not in (select top 30 id

From)

Solution 2: select top 10 * from A where id> (select max (id) from (select

Top 30 id from A) as)

34. object-oriented languages include ________, _________, and ________.

A: encapsulation, inheritance, and polymorphism.

35. Which of the following interfaces or declarations must be implemented for objects that can be accessed through foreach?

________________ Method type.

A: IEnumerable and GetEnumerator.

36. What is GC? Why does GC exist?

A: GC is a garbage collector. Programmers do not have to worry about memory management, because the Garbage Collector automatically manages

. To request garbage collection, you can call one of the following methods:

System. gc ()

Runtime. getRuntime (). gc ()

37. String s = new String ("xyz"); how many String objects are created?

A: There are two objects, one being "xyx" and the other being the reference object s pointing to "xyx.

 

39. Do I use run () or start () to start a thread ()?

A: To start a thread, call the start () method so that the virtual processor represented by the thread is in a runable state.

This means that it can be scheduled and executed by JVM. This does not mean that the thread will run immediately. Run ()

To stop a thread.

40. Can an interface inherit the interface? Can an abstract class implement the (implements) interface? Can an abstract class be used?

Concrete class )?

A: The interface can inherit the interface. Abstract classes can be implemented (implements) interfaces. can abstract classes be inherited?

Entity class, but the premise is that the entity class must have a clear constructor.

41. Can Constructor be overwritten?

A: Constructor cannot be inherited, so Overriding cannot be overwritten, but it can be overloaded.

Overloading.

42. Can I inherit the String class?

A: The String class is a final class, so it cannot be inherited.

43. There is a return statement in try {}, so the code in finally {} following this try will

Will not be executed. When will it be executed? Before or after return?

A: Yes. It will be executed before return.

44. The two objects have the same value (x. equals (y) = true), but different hash codes are available.

Right?

A: No. It has the same hash code.

45. Does swtich work on byte, long, and String?

A: In switch (expr1), expr1 is an integer expression. Therefore

The case statement parameter should be int, short, char, or byte. Long or string

It can act on swtich.

47. When a thread enters a synchronized method of an object, can other threads enter this

Other methods of the object?

No. One synchronized Method of an object can only be accessed by one thread.

48. can abstract methods be both static, native, and native?

Synchronized?

A: No.

49. Does List, Set, and Map inherit from the Collection interface?

A: List, Set is Map, not

50. The elements in the Set cannot be repeated. How can we identify whether the elements are repeated or not? Use = or

Equals ()? What are their differences?

A: The elements in the Set cannot be repeated. Use the iterator () method to identify whether the elements are repeated or not.

Equals () is used to determine whether two sets are equal.

The equals () and = Methods Determine whether the reference value points to the same object equals () is overwritten in the class.

Returns the true value when the content and type of the two separated objects match.

51. Does the array have the length () method? Does String have the length () method?

A: The array does not have the length () method. It has the length attribute. String has length ().

Method.

52. What is the difference between sleep () and wait?

A: The sleep () method is used to stop a thread for a period of time. After the sleep interval expires, the thread

The execution may not be resumed immediately. This is because at that time, other threads may be running and not

Scheduling is to discard 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 sends a wait () call to a synchronization object x, the thread

The execution is paused, and the called object enters the waiting state until it is awakened or the waiting time is reached.

53. short s1 = 1; s1 = s1 + 1; what is the error? Short s1 = 1; s1 + = 1; what is the error?

?

Answer: short s1 = 1; s1 = s1 + 1; incorrect. s1 is short type, s1 + 1 is int type, and cannot be explicitly

Convert to short type. It can be changed to s1 = (short) (s1 + 1 ). Short s1 = 1; s1 + = 1 positive

Yes.

54. Let's talk about the differences between final, finally and finalize.

A:

Final-modifier (keyword) If a class is declared as final, it means it cannot generate new

And cannot be inherited as the parent class. Therefore, a class cannot be both abstract and abstract.

Declared as final. Declare variables or methods as final to ensure that they are not changed during use.

Variables declared as final must be declared with an initial value, and can only be read in future references.

Modify. Methods declared as final can only be used and cannot be reloaded.

Finally-The finally block is provided for troubleshooting. If an exception is thrown

Normally, the matched catch clause will be executed, and the control will enter the finally block (if

If yes ).

Finalize-method name. Java technology allows the use of the finalize () method in the garbage collector

Perform necessary cleanup before removing data from the memory. This method is determined by the Garbage Collector

The object is called when it is not referenced. It is defined in the Object class, so all

Class inherits it. Subclass overwrites the finalize () method to sort system resources or execute other cleaner

. The finalize () method is called before the Garbage Collector deletes an object.

55. How to handle hundreds of thousands of concurrent data records?

A: use stored procedures or transactions. When getting the maximum ID, update it at the same time. Note that the primary key is not the auto-incremental side.

This method does not have duplicate primary keys during concurrency .. a stored procedure is required to obtain the maximum identifier.

Obtain.

56. What are the major bugs in Session? What methods does Microsoft propose to solve them?

A: The process is recycled in iis. if the system is busy, the Session will be lost. You can use Sate.

Server or SQL Server database to store sessions. However, this method is slow and cannot be used.

Capture the END event of the Session.

57. What is the difference between a process and a thread?

A: A process is the unit of resource allocation and scheduling by the system. A thread is the unit of CPU scheduling and scheduling.

A process can have multiple threads that share the resources of the process.

58. What is the difference between stack and stack?

A: Stack: the stack is automatically allocated and released by the compiler. Variables defined in the function body are usually on the stack.

Heap: usually assigned and released by programmers. With new, malloc, and other memory allocation functions

.

59. What is the role of adding static before member variables and member functions?

A: They are called common member variables and common member functions, also known as class member variables and class member functions. Minute

It is not used to reflect the status of the class. For example, a class member variable can be used to count the number of class instances and class member functions.

Responsible for this statistical action.

60. ASP. NET compared with ASP, what are the main advances?

A: asp interpretation form and aspx compilation form help improve the performance and protect the source code.

62. Please describe several common methods for passing parameters between pages in. net and describe their advantages and disadvantages.

A: session (viewstate) is simple but easy to lose.

Application global

Cookies are simple but may not be supported and may be forged.

Input ttype = "hidden" is simple and may be forged

The url parameter is simple and displayed in the address bar with a limited length.

The database is stable and secure, but its performance is relatively weak.

63. What does GAC mean?

A: Global Assembly cache.

64. How many requests can be sent to the server?

A: get and post. Get is generally the link mode, and post is generally the button mode.

65. What is the difference between DataReader and Dataset?

A: One is a read-only cursor and the other is a virtual database in the memory.

66. How many stages are there in the software development process? What is the role of each stage?

Answer: requirement analysis, architecture design, code writing, QA, and deployment

67. What are the meanings of using and new keywords in c? Using

Command and statement new create instance new hide methods in the base class.

A: using introduces namespaces or uses unmanaged resources.

New create an instance or hide the parent class Method

68. to process a string, remove the spaces at the beginning and end of the string.

If there are consecutive spaces, only one space is reserved. That is, multiple spaces are allowed in the string, but consecutive spaces are left blank.

The number of cells cannot exceed one.

A: string inputStr = "xx ";

InputStr = Regex. Replace (inputStr. Trim (),"*","");

 

70. What is SQL injection and how to prevent it? For example.

A: attackers use SQL keywords to attack websites. Filter keywords, etc.

71. What is reflection?

A: Dynamically Retrieve assembly information

72. How to Write Design Patterns with Singleton

A: In the static property, the new constructor is private.

73. What is Application Pool?

A: Web applications, similar to Thread pools, improve concurrency performance.

74. What is a virtual function? What is an abstract function?

A: virtual functions: functions that are not implemented can be inherited and overwritten by sub-classes. Abstract function: specifies its non-virtual

Function that must be implemented by sub-classes and must be overwritten.

75. What is XML?

A: The markup language can be expanded using XML. EXtensible Markup Language. Tag refers to what a computer can do

Understanding Information symbols, through which computers can process articles containing various information.

To define these tags, you can select an international markup language, such as HTML or

XML is a markup language that is freely determined by relevant people. This is the scalability of the language. XML is from SGML

. It mainly uses XML, XSL, and XPath.

76. What is Web Service? UDDI?

A: Web Service is a network-based, distributed modular component that executes specific tasks and complies

Adhere to specific technical specifications that enable Web Services to interoperate with other compatible components.

The purpose of UDDI is to establish standards for e-commerce. UDDI is a Web-based, distributed

The implementation standards and specifications of the Information Registration Center provided by Web Service also include a group

Web Service Registration provided by Alibaba Cloud to enable other enterprises to discover the implementation standards of access protocols.

77. What is a user control in ASP.net?

A: The user control is generally used when the content is mostly static or slightly changed. The usage of this control is relatively large.

Like include... in ASP, but it has more powerful functions.

78. List the XML technologies you know and their applications.

A: xml is used for configuration and saving static data types. web Services and

Config

What are common objects in 79.ADO.net? Describe them separately.

Answer: Connection database Connection object

Command database commands

DataReader data reader

DataSet

80. What is code-Behind technology.

Answer: ASPX, RESX, and CS files are separated by code. HTML code and services are implemented.

Code separation to facilitate code writing and sorting.

81. What is SOAP and what applications are there.

A: simple object access protocal: simple object accept protocol. The xml is the basic encoding structure.

Is built on existing communication protocols (such as http, But it is said that ms is working on the underlying architecture on TCP/IP

A protocol that standardizes the use of Web services ..

82. C # What are the differences between property and attribute? the benefits of this Mechanism

Where?

A: attributes are used to access fields of a class, and features are used to identify additional attributes such as classes and methods.

Nature

83. Main differences between XML and HTML

Answer: 1. XML is case-sensitive and HTML is not.

2. In HTML, if the context clearly shows where the section or list key ends, you can

End tags such as </p> or </li> are omitted. In XML, the end mark cannot be omitted.

3. In XML, an element with a single tag but no matching ending tag must use one/character

End. In this way, the analyzer does not need to find the end mark.

4. in XML, attribute values must be placed in quotation marks. Quotation marks are usable in HTML.

5. In HTML, You can have attribute names without values. In XML, all attributes must have the corresponding

.

What is the ternary operator in 84. c?

A :? :.

85. When integer a is assigned to an object, integer a will be?

Answer: packing.

86. Which of the following types of Class Members are accessible?

A: this.; new Class (). Method;

87. public static const int A = 1; is there an error in this code? What is it?

A: The const cannot be modified using static.

88. float f =-123.567F; int I = (int) f; what is the I value now _____?

A:-123.

89. What is the keyword of the delegate statement ______?

A: delegate.

90. What are the characteristics of classes modified with sealed?

A: It is sealed and cannot be inherited.

91. All Custom User Controls in Asp.net must inherit from ________?

A: Control.

92. In. Net, all serializable classes are marked _____?

A: [serializable]

93. In. Net hosting code, we don't have to worry about memory vulnerabilities. This is because ______?

A: GC.

95. When class T only declares the private instance constructor, ___ can ___ (can

Or is not allowed.) A new class is derived from T. It cannot be ____ (or not ).

Any instance.

A: No. No.

96. Is there an error in the following code?

Switch (I ){

Case (): A: // The case () condition cannot be blank.

CaseZero ();

Break;

Case 1:

CaseOne ();

Break;

Case 2:

Dufault; A: // wrong. The format is incorrect.

CaseTwo ();

Break;

}

97. Can System. Web. UI. Page be inherited in. Net?

A: Yes.

What is the error handling mechanism of 98..net?

A: the. net error handling mechanism adopts the try-> catch-> finally structure. When an error occurs, it is thrown layer by layer.

Until the matching Catch is found.

99. The operator statement is used and only = is declared. Is there any error?

A: Do you want to modify Equale and GetHash () at the same time ()? If "=" is reloaded, it must be reloaded "! ="

101. How to disable a form in. net (C # or vb.net.

A: private void Form1_Closing (object sender,

System. ComponentModel. CancelEventArgs e)

{

E. Cancel = true;

}

102. In. net (C # or vb.net), what are Appplication. Exit or Form. Close?

Different?

A: one is to exit the entire application, and the other is to close one of the forms.

 

104. A password only uses five letters (K, L, M, N, and O), and the words in the password are arranged from left to right.

The following rules must be followed:

(1) the minimum length of a password word is two letters, which can be the same or different.

(2) K cannot be the first letter of a word.

(3) If L appears, more than once

(4) M cannot make the last or second-to-last letter

(5) If K appears, N must appear.

(6) If O is the last letter, L must appear

Question 1: Which of the following letters can be placed behind O in LO to form a three-letter password word?

A) k B) L C) M D) N

Answer: B

Question 2: If the obtained letters are K, L, and M, the two letter-long password words can be formed.

What is the total number?

A) 1 B) 3 C) 6 D) 9

Answer:

Question 3: Which of the following is the word password?

A) klln B) LOML C) MLLO D) NMKO

Answer: C

8. 62-63 = 1 the equation is not true. Please move a number (the minus sign and the equal sign cannot be moved) so that

And how to move it?

Answer: 62 is moved to the power 6 of 2.

What are the differences between property and attribute in 106. C #? What are their advantages?

Where is it?

A: attribute: The base class of the custom attribute. property: the attribute in the class.

107. C # Can I perform direct operations on the memory?

A: In. net,. net references the garbage collection (GC) function, which replaces programmers. However, in C,

You cannot directly implement the Finalize method, but call the Finalize () method of the base class in the destructor.

108. ADO. What are the main improvements to NET over ADO?

A: 1. ado.net does not rely on the ole db provider, but uses. net to host the provided program. 2: Do not

Use com3: does not support dynamic cursors and server-side Games 4:, You can disconnect the connection and retain the current number

Data Set availability 5: strong type conversion 6: xml support

109. Write an HTML page to implement the following functions: "Hello" is displayed when you left-click the page, right-click

"Prohibit right-click" is displayed ". The page is automatically closed in 2 minutes.

A: <script language = javascript>

SetTimeout ('window. close (); ', 3000 );

Function show ()

{

If (window. event. button = 1)

{

Alert ("Left ");

}

Else if (window. event. button = 2)

{

Alert ("right ");

}

}

</Script>

110. Briefly describe ASP. NET Server Control Lifecycle

Answer: Initialize loading view status processing sending and returning data loading sending and returning change notification processing sending and returning events

Pre-rendering, save status, rendering, disposal, uninstallation

111. Does Anonymous Inner Class (Anonymous internal Class) support extends (inherited) other classes,

Can implements (implemented) interface (interface) be implemented )?

A: No. The interface can be implemented.

112. Differences between Static Nested Class and Inner Class: the more you say, the better.

A: Static Nested Class is an internal Class declared as static. It does not depend on

The external class instance is instantiated. In general, internal classes must be instantiated before they can be instantiated.

113., & and.

& Is a bitwise operator that represents bitwise and OPERATION, & is a logical operator that represents logic and (and ).

114. Differences between HashMap and Hashtable.

A: HashMap is a lightweight Implementation of Hashtable (non-thread-safe implementation ).

The main difference between the Map interface and the HashMap interface is that HashMap allows null key values (KEYS). Due to non-thread security,

The efficiency may be higher than that of Hashtable.

116. Can the Overloaded method change the type of the returned value?

A: The Overloaded method can change the type of the returned value.

117. What is the difference between error and exception?

A: error indicates that the restoration is not an impossible but difficult case. For example, memory

Overflow. It is impossible to expect the program to handle such a situation.

Exception indicates a design or implementation problem. That is, it indicates that if the program runs normally

No.

118. What are the differences between <% # %> and <%>?

A: <% # %> indicates the bound data source.

<%> Is a server-side code block.

119. You think ASP. NET 2.0 (VS2005) and the development tools you used earlier (. Net 1.0 or other

) What is the biggest difference? Which development ideas (pattern/

Architecture) can be transplanted to ASP. NET 2.0 (or has been embedded in ASP. NET 2.0)

Answer: 1 ASP. NET 2.0 encapsulates and packages some code, so the same functions are greatly reduced compared with 1.0.

Multiple code.

2. Both the code separation and page embedding server-side code modes are supported. In previous versions 1.0,. NET prompts help

This helps you embed server-side code on the page only when code files are separated,

3. When switching code and design interfaces, 2.0 supports cursor positioning.

4. When binding data, you can perform operations such as paging, Update, and Delete operations on the table in a visualized manner, facilitating initial operations.

Scholar

5. More than 40 new controls are added to ASP. NET, reducing the workload.

120. What is the difference between heavy load and coverage?

Answer: 1. The method overwrites the relationship between the subclass and the parent class, which is a vertical relationship. The method overload is the same.

The relationship between methods in the class, which is a horizontal relationship.

2. Override can only be composed of one method, or can only be associated with one method. Method Overloading is one of multiple methods.

Relationship.

3. The overwrite request parameter list is the same; the reload request parameter list is different.

4. In the overwriting relationship, the method body called is based on the object type (the object corresponds to the bucket type)

The method body is selected based on the real parameter table and the form parameter table during the call.

121. To describe the implementation process of the indexer in C #, can I index data only by numbers?

A: No. Any type can be used.

122. in C #, string str = null and string str = "" use text or graphs whenever possible.

The difference.

A: null has no space reference;

"" Is a string with a space of 0;

 

126. The company requires the development of a component that inherits the System. Windows. Forms. ListView class.

To the following special features: When you click the header of each column in The ListView, You can rearrange the values of each row in the clicked column.

All rows in the view (the sorting method is similar to the DataGrid ). Based on your knowledge, please briefly talk about you

Idea:

A: Based on the column header clicked, the ID of this column is taken out, sorted by the ID, and bound to the ListView

127. What is WSE? What is the latest version?

A: The WSE (Web Service Extension) package provides the latest WEB Service security assurance. Currently, the most

The latest version is 2.0.

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

A: The class that declares the existence of a method instead of implementing it is called abstract class. It uses

To create a class that reflects some basic behaviors and declare methods for this class, but it cannot be implemented in this class.

This class. You cannot create an abstract instance. However, you can create a variable whose type is 1.

Abstract class and point it to an instance of a specific subclass. No abstract constructor or abstract static party

Method. The subclasses of Abstract classes provide implementation for all Abstract methods in their parent classes, otherwise they are also extracted

The image class is. Instead, implement this method in the subclass. Other classes that know their behavior can be implemented in the class

These methods.

An interface is a variant of an abstract class. All methods in the interface are abstract. Multi-Inheritance

You can obtain it by implementing such an interface. All methods in the interface are abstract, and no program exists.

Body. The interface can only define static final member variables. The implementation of the interface is similar to that of the subclass.

The current class cannot inherit behaviors from the interface definition. When a class implements a special interface, it defines

All methods for this interface. Then, it can be called on any object of the class that implements this interface.

Interface Method. Because there is an abstract class, it allows the interface name as the type of the referenced variable. Normally

The status association takes effect. The reference can be converted to the interface type or from the interface type conversion, instanceof Operator

It can be used to determine whether an object's class implements an interface.

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.