Asp. NET common face questions and answers
1. Describe the access rights of private, protected, public, and internal modifiers.
For. Private: A privately owned member that can be accessed within a class.
Protected: A protected member that can be accessed within the class and in the inheriting class.
Public: Common members, completely public, without access restrictions.
Internal: can be accessed within the same namespace.
2. Lists several ways to pass values between ASP.
A. 1. Use QueryString, such as ...? id=1; Response. Redirect () ....
2. Use the session variable
3. Using Server.Transfer
What are the delegates in 4.c#? Is the event a delegate?
A: A delegate can substitute a method as a parameter into another method.
A delegate can be understood as a reference to a function.
Yes, it's a special kind of delegate.
The difference between 5.override and overloading
Answer: The difference between override and overload. Overloading is the same as the name of the method. parameter or parameter type is different, multiple
Secondary overloads to suit different needs
Override is an override of a function in a base class. In order to adapt to the need.
6. If you need to pass the value of a variable in a B/s structure, you cannot use the session,
How many ways do you handle cookies, application?
Answer: this. Server.Transfer
Response. Redirect ()---QueryString
9. Describe the implementation of indexers in C #, and can they only be indexed by numbers?
Answer: No. Any type can be used.
11. Using. NET to do b/s structure of the system, you are using a few layers of structure to develop, the relationship between each layer and for
What is this layering?
A: Generally 3 floor
The data access layer, the business layer, the presentation layer.
The data access layer makes additions and deletions to the database.
The business layer is generally divided into two layers, the business table layer realizes the communication with the presentation layer, the business rule layer realizes the user secret
Security of the code.
The presentation layer adds a form in order to interact with the user such as a user.
Advantages: Clear division of labor, clear, easy to debug, but also scalable.
Cons: Increased costs.
13. What is an application domain?
A: An application domain can be understood as a lightweight process. Play a safe role. Small resource footprint.
What are the 14.CTS, CLS, and CLR explanations for each?
A: CTS: a common language system. CLS: Common Language Specification. CLR: Common language runtime.
15. What are crates and unboxing?
A: Converting from a value type interface to a reference type boxing. Converting from a reference type to a value type unboxing.
16. What is a regulated code?
Answer: unsafe: Unmanaged code. Not run through the CLR.
17. What is a strongly typed system?
Answer: RTTI: type identification System.
What classes are needed to read and write databases in 18.net? Their role?
Answer: DataSet: Data memory.
DataCommand: Executes the statement command.
DataAdapter: The collection of data, the term padding.
What are the authentication methods for 19.asp.net? What is the principle of the distinction?
Answer: 10. Windwos (default) with IIS ... From (form) with account .... Passport (Key)
20. What is Code-behind technology?
A: Code after planting.
21. In. NET, what does the accessory mean?
Answer: Assembly. (intermediate language, source data, resources, assembly list)
22. What are the common methods of calling WebService?
Answer: 1. Use the WSDL.exe command-line tool.
2. Use the Add webreference menu option in Vs.net
What is the working principle of 23..net Remoting?
A: The server sends a process number to the client, a program field number to determine the location of the object
。
24. In C #, string str =null with string str = "" Try to use text or graphs as much as possible
As a description of the difference.
A: string str =null does not allocate memory space to him, while string str = "" Assigns it
The length is an empty string of memory space.
25. Please describe the similarities and differences between classes (class) and structure (struct) in dotnet.
A: Class can be instantiated, belongs to a reference type, is allocated on the heap of memory, struct belongs to the value class
is allocated on the stack of memory.
27. Complete the blanks by analyzing the following code
String strtmp = "ABCDEFG xxx";
int I=system.text.encoding.default.getbytes (STRTMP). Length;
int j= strtmp.length;
After executing the above code, i= j=
Answer: i=13,j=10
In a 28.SQLSERVER server, there are two field IDs, Lastupdatedate, in a given table table1,
The ID represents the updated transaction number, and Lastupdatedate represents the server time when the update occurs, using one sentence
The SQL statement obtains the last updated transaction number
Answer: Select Idfrom table1 Where lastupdatedate = (select MAX
(lastupdatedate) From table1)
30. Briefly describe your understanding of the two technologies of remoting and webservice under the Microsoft. NET Framework and
Applications in practice.
A: WS is primarily available with HTTP, penetrating firewalls. and remoting can use TCP/IP, binary
Increase efficiency.
31. The company requires the development of a component that inherits the System.Windows.Forms.ListView class, requiring
The following special features: When you click the column header of a ListView, you can rearrange the values by clicking on each row of columns
All rows in the diagram (in the same way as the 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, and then bound to the ListView.
33. Write an SQL statement: Take out the 31st to 40th record in table A (SQL Server to automatically grow the ID
As a primary key, note: The ID may not be contiguous.
Answer: 1:selecttop * from A where ID not in (select Top ID
From A)
Solution 2:select Top10 * from A where ID > (select MAX (ID) from (select
Top ID from a) as a)
34. Object-oriented language has ________, _________, ________
Answer: encapsulation, inheritance, polymorphism.
35. Objects that can be accessed with a foreach traversal need to implement the ________________ interface or declaration
The type of the ________________ method.
Answer: IEnumerable, GetEnumerator.
What is 36.GC? Why do you have a GC?
A: The GC is a garbage collector. Programmers do not have to worry about memory management, because the garbage collector automatically manages
Acting To request garbage collection, you can call one of the following methods:
System.GC ()
Runtime.getruntime (). GC ()
37.String s = new string ("XYZ"); several string Object created?
A: Two objects, one is "XyX", the other is a reference object pointing to "XyX" s.
39. 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
This means that it can be dispatched and executed by the JVM. This does not mean that the thread will run immediately. Run ()
Method can produce a flag that must be exited to stop a thread.
40. Can interfaces be inherited by an interface? is an abstract class achievable (implements) interface? Whether an abstract class can
Inherit entity class (Concreteclass)?
A: An interface can inherit an interface. Abstract classes can implement (implements) interfaces, whether abstract classes can inherit
Entity class, but only if the entity class must have an explicit constructor.
41. Can the constructor constructor be override?
A: The constructor constructor cannot be inherited, so overriding cannot be overridden, but can be overloaded
Overloading.
42. Can I inherit the String class?
A: The string class is the final class and cannot be inherited.
43.try {} has a return statement, then the code in the finally {} immediately following the try
is not executed, when is it executed, before or after the return?
A: It executes and executes before return.
44. Two object values are the same (x.equals (y) = = true), but can have different hash code, this sentence
Words, right?
Answer: No, there is the same hashcode.
Does 45.swtich work on a byte, can it function on a long, or does it work on a string?
Answer: in switch (EXPR1), expr1 is an integer expression. So pass to switch and
The arguments for the case statement should be int, short, char, or byte. Long,string are not
Can be used for Swtich.
47. When a thread enters a synchronized method on an object, does the other thread enter the
Other methods of the object?
No, an synchronized method of an object can only be accessed by one thread.
Whether the 48.abstract method can be static at the same time, whether it can be native at the same time, whether it can be
Synchronized?
Answer: No.
49.List, Set, does the map inherit from the collection interface?
A: List,set is map is not
The elements in 50.Set cannot be duplicated, so what is the way to distinguish between duplicates or not? Is it used = = 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 overridden in the class to
Returns the true value when the contents and type of the two detached 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 and has the length property. String has length () This Side
Method.
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 time interval expires, the thread
Does not necessarily resume immediately. This is because at that point, other threads may be running and not being
Dispatched 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 issues a wait () call to a synchronization object x, the thread
Pauses execution, the object is moved into a wait state until it wakes up or waits.
53.short S1 = 1; S1 = s1 + 1; what's wrong? Short S1 = 1; S1 + = 1; what's wrong?
?
Answer: short S1 = 1; S1 = s1 + 1; error, S1 is short, s1+1 is int type, cannot be explicitly
into a short type. Can be modified to S1 = (short) (S1 + 1). Short S1 = 1; S1 + = 1 positive
Indeed
54. 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
The statement is 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 a later reference, not
Modify. 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 you throw a different
Normally, the matching catch clause executes, and then the control enters the finally block (if
If any).
The finalize-method name. Java technology allows the use of the Finalize () method to object in the garbage collector
Do the necessary cleanup work before removing it from memory. This method is determined by the garbage collector in determining this
This object is called when the object is not referenced. It is defined in the Object class, so all
Class has inherited it. Subclass overrides the Finalize () method to organize system resources or perform other cleanup work
For The Finalize () method is called on the object before the object is deleted by the garbage collector.
55. How to handle 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 a self-increment party
This method does not have duplicate primary keys when it is in parallel. Get the maximum identity a stored procedure is needed to
Get.
56.Session What are the major bugs that Microsoft has proposed to solve?
A: IIS because of the process recycling mechanism, the system is busy, the session will be lost, you can use Sate
server or SQL Server database storage session This is slow and cannot be
Captures the end event of the session.
57. What is the difference between a process and a thread?
A: The process is the system for resource allocation and scheduling units, the thread is the CPU scheduling and dispatch units, a
A process can have multiple threads that share the resources of this process.
58. What is the difference between heap and stack?
A: 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
On
59. 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. Score of
Not to reflect the state of the class. For example, class member variables can be used to count the number of class instances, class member functions
Take charge of this statistic action.
60.ASP. NET compared with ASP, what is the main progress?
A: ASP interpretation form, aspx compiler type, performance improvement, is conducive to protect the source code.
62. Describe the methods used to pass parameters between pages in. NET and say their pros and cons.
Answer: Session (ViewState) simple, but easy to lose
Application Global
Cookies are simple, but may not be supported, may be forged
Input ttype= "hidden" is simple and may be forged
URL parameter is simple, display in the address bar, the length is limited
The database is stable and secure, but the performance is relatively weak
63. Please indicate what the GAC means?
Answer: The global assembly cache.
64. How many ways are there to send requests to the server?
Answer: Get,post. Get is generally linked, post is usually button mode.
What is the difference between 65.DataReader and dataset?
A: One is a forward-only read-only cursor, and one is a virtual database in memory.
66. How many stages does the software development process typically have? The role of each stage?
Answer: Requirements analysis, architecture design, code writing, QA, deployment
67. What is the meaning of the two keywords using and new in C #, please write the meaning you know? Using
Directive and statement new Create instance new hides the base class method.
A: Using introduces namespaces or uses unmanaged resources
New instance or hide parent method
68. You need to implement the processing of a string, first of all the string is removed, if the string
With contiguous spaces, only one space is allowed, that is, there are multiple spaces in the middle of the string, but a continuous empty
The number of cells cannot exceed one.
Answer: stringinputstr= "xx xx";
Inputstr=regex.replace (Inputstr.trim (), "*", "");
70. What is SQL injection and how do I prevent it? Please illustrate.
A: Use the SQL keyword to attack your site. Filter keywords ' etc
71. What is reflection?
Answer: Dynamically Get assembly information
72. How to write design patterns with Singleton
Answer: The static property inside new, constructor private
73. What is Application Pool?
A: Web apps, like the thread Pool, improve concurrency performance.
74. What is a 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: Specify its non-virtual
A subclass must implement a function that must be overridden.
75. What is XML?
Answer: XML expands Markup Language. Extensible Markup Language. Marks refer to what the computer can
Understanding of the information symbols, through this kind of marking, the computer can be processed with a variety of information, such as articles.
How to define these tags, that is, you can choose International markup language, such as HTML, you can also use the image
XML is a markup language that is freely determined by the relevant person, and that is the extensibility of the language. XML is from SGML
Simplify the changes. It mainly uses XML, XSL, XPath, and so on.
76. What is a Web Service? Uddi?
A: Web service is a network-based, distributed, modular component that performs specific tasks,
Compliance with specific technical specifications that enable 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 provides a standard specification for the implementation of information registries, and also includes a set of standards that enable enterprises to
Self-provided WebService registration to enable other enterprises to discover the implementation criteria of the Access Protocol.
77. 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. Class
Like include in ASP. But the features are much more powerful.
78. List the XML technologies you know and their applications
A: XML is used for configuration to hold static data types. The most exposed XML is Web Services. And
Config
What are the objects commonly used in 79.ado.net? Describe it separately.
Answer: Connection Database Connection object
Command Database commands
DataReader Data reader
DataSet Data Set
80. What is Code-behind technology?
A: Aspx,resx and cs Three suffix files, this is code separation. Implements HTML code and services
Code separation. Facilitates code writing and collation.
81. What is soap and what are the applications?
A: Simple objectaccess protocal, easy object accept the agreement. XML as the basic coding structure
, based on existing communication protocols, such as HTTP, but it is said that MS is doing the lowest-level architecture on TCP/IP
SOAP) is a specification of a protocol used by Web service:
The difference between property and attribute in 82.c#, what are their uses, the benefits of this mechanism
Where is it?
A: A property, a field for accessing a class, an attribute that identifies a class, a method, etc., an additional
Properties
The main difference between 83.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 end tags 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 use one/character as the
End. 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 a corresponding
The value.
What is the ternary operator in 84.c#?
For:? :。
85. When integer A is assigned to an object, the integer a will be
Answer: Boxing.
86. Does the class member have an accessible form of _____?
Answer: this.; Newclass (). Method;
87.public static const int a=1; Is this code wrong? What is it?
A: const cannot be modified with static.
88.float f=-123.567f; The value of int i= (int) f;i is now _____?
Answer:-123.
89. What is the keyword of the delegate declaration?
Answer: Delegate.
90. What are the characteristics of sealed-modified classes?
Answer: Sealed, cannot inherit.
91. All custom user controls that are in ASP. NET must inherit from ________?
Answer: Control.
92. All serializable classes in. NET are marked as _____?
Answer: [Serializable]
93. We don't have to worry about memory leaks in. NET managed code, because we have ___?
Answer: GC.
95. When the class T only declares a private instance constructor, it is outside the program text of T, ___ can be
The new class is derived from T with or not, and can not be created directly by ____ (or not).
Any instance.
A: No, it's not possible.
96. Is there an error in the following code?
switch (i) {
Case (): Answer://case () condition cannot be empty
Casezero ();
Break
Case 1:
Caseone ();
Break
Case 2:
Dufault; Answer://wrong, format is not correct
Casetwo ();
Break
}
97. In. NET, can a class System.Web.UI.Page be inherited?
Answer: Yes.
What is the error handling mechanism of 98..net?
A: the. NET error handling mechanism uses the try->catch->finally structure, and when errors occur, the layers are thrown
Until a matching catch is found.
99. What is wrong with operator statement and only declaring = =?
A: Do you want to modify both Equale and Gethash ()? "=" must be overloaded with "! =" overloaded
101. How to cancel the closing of a form in. NET (C # or vb.net).
Answer: Private Voidform1_closing (object sender,
System.ComponentModel.CancelEventArgs e)
{
E.cancel=true;
}
102. In. NET (C # or vb.net), appplication.exit or form.close has what
Different?
A: One is to exit the entire application and one is to close one of the form.
104. A password using only K, L, M, N, o a total of 5 letters, the words in the password are arranged from left to right, dense
Code words must follow the following rules:
(1) The minimum length of a password word is two letters, can be the same, can also be different
(2) K cannot be the first letter of a word
(3) If L appears, the number of occurrences occurs more than once
(4) m cannot make the last one or the second-lowest letter
(5) k appears, then n must appear
(6) O if it is the last letter, L must appear
Question one: Which of the following letters can be placed behind O in the Lo to form a 3-letter password word?
A) K B) L C) M D) N
Answer: B
Question two: If you can get the letter is K, L, M, then can form a two-letter long password word
What's the total?
A) 1 B) 3 C) 6 D) 9
Answer: A
Question three: Which of the following is the word password?
A) Klln B) loml C) Mllo D) Nmko
Answer: C
8.62-63=1 equation does not hold, please move a number (you can not move the minus sign and the equals sign), so that
form, how to move?
Answer: 62 moved to 2 of the 6-time Square
106. The difference between property and attribute in C #, what they are useful for, this mechanism is good
Where is it?
A: attribute: The base class for custom attributes; property: Properties in a class
107.c# can the memory be directly manipulated?
A: Under. NET,. NET references the garbage collection (GC) feature, which replaces the programmer but in C #,
You cannot implement a Finalize method directly, but instead call the base class's Finalize () method in a destructor
108.ADO. What are some of the major improvements in net versus ADO?
A: 1:ado.net does not rely on the OLE DB provider, but instead uses the program provided by. NET Hosting, 2: Do not make
With COM3: Do not support dynamic cursors and server-side Tour 4:, you can disconnect connection and keep the current number
Data set available 5: Strongly-typed conversion 6:xml support
109. Write an HTML page, to achieve the following functions, left click on the page to display "Hello", right click
"Disable Right button" is displayed. and automatically closes the page after 2 minutes.
Answer:<scriptlanguage=javascript>
SetTimeout (' Window.close (); ', 3000);
Function Show ()
{
if (Window.event.button = = 1)
{
Alert ("left");
}
else if (Window.event.button = = 2)
{
Alert ("right");
}
}
</script>
110. Probably describe 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 Offload
111.Anonymous Inner Class (anonymous inner Class) can extends (inherit) other classes,
Is it possible to implements (implement) interface (interface)?
Answer: No, interface can be implemented
112.Static Nested class and Inner class, the more you say the better
A: The Staticnested class is an inner class declared static, which can be independent of
To an instance of an external class is instantiated. The usual inner classes need to be instantiated after the external class is instanced.
The difference between 113.,& and &&.
& is a bitwise operator that represents the bitwise AND Operation,&& is a logical operator that represents the logical and (and).
The difference between 114.HashMap and Hashtable.
A: HashMap is a lightweight implementation of Hashtable (non-thread-safe implementation), and they have all completed
Map interface, the main difference is that HASHMAP allows null (NULL) key value (key), due to non-thread-safe,
may be more efficient than Hashtable.
Can the 116.Overloaded method change the type of the return value?
A: The overloaded method is to change the type of the return value.
What is the difference between 117.error and exception?
A: Error indicates a serious problem in situations where recovery is not impossible but difficult. such as memory
Overflow. It is impossible to expect the program to handle such situations.
Exception represents a design or implementation issue. In other words, it means that if the program is running normally,
Not happen.
What is the difference between 118.<%#%> and <%%>?
A: <%#%> represents a bound data source
<%%> is a server-side code block
119. What do you think of ASP. 2.0 (VS2005) and the development tools (. Net1.0 or other) you used previously
What is the biggest difference? What development ideas have you used on the previous platform (pattern/
Architecture) can be ported to ASP. NET 2.0 (or already embedded in asp.net2.0)
A: 1 asp.net2.0 package some code, so compared to 1.0 the same function reduces the
Multiple code.
2 supports both code separation and page embedding server-side code in two modes, formerly 1.0 versions. NET Tips Help
Help tips are available only in separate code files that cannot be embedded in the page of the 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, to facilitate the initial
Scholars
5 added more than 40 new controls in ASP, reducing workload
120. What is the difference between overloading and overwriting?
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 same
The relationship between methods in a class is a horizontal relationship
2, coverage can only be a method, or only a pair of methods to produce a relationship; the overload of a method is a method of multiple
The relationship between the two.
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 type of object (object corresponding to the storage space type)
To decide, the overloaded relationship is based on the invocation of the argument table and the formal parameter list to select the method body.
121. Describe the implementation of indexers in C #, and can they only be indexed by numbers?
Answer: No. Any type can be used.
122. In C #, String str= null with string str = "" Try to use text or diagrams as much as possible
As a description of the difference.
A: null is not a spatial 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, requiring up to
To the following special features: When you click the column header of the ListView column, you can rearrange the values of each row by clicking on the column
All rows in the view are sorted in a similar way as the DataGrid. Based on your knowledge, please briefly discuss your
The idea:
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
127. What is WSE? What is the current version?
A: WSE (WebService Extension) package to provide the latest Web Services security assurance, currently the most
New version 2.0.
What is the difference between 130.abstract class and interface?
A: The class that declares the existence of a method and does not implement it is called an abstract class, which uses
To create a class that embodies some basic behavior, and declares a method for that class, but cannot implement it in the class
The case of the class. An instance of the abstract class cannot be created. However, you can create a variable whose type is a
An abstract class and point it to an instance of a specific subclass. Cannot have abstract constructors or abstract static parties
Method. Subclasses of the abstract class provide implementations for all abstract methods in their parent class, or they are also drawn
Like class for. Instead, implement the method in the subclass. Other classes that know their behavior can be implemented in a class
These methods.
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, none of them have a program
Body. An interface can only define Staticfinal member variables. The implementation of an interface is similar to a subclass, except that the actual
The present class cannot inherit behavior from the interface definition. When a class implements a special interface, it is defined (the program body will give
Method for all such interfaces. It can then be called on any object that implements the interface's class.
The method of the interface. Because of an abstract class, it allows you to use the interface name as the type of the reference variable. The usual motion
The form of the binder will take effect. A reference can be converted to an interface type or converted from an interface type, the instanceof operator
Can be used to determine whether the class of an object implements an interface.
1: How do I submit a form without using the Submit button?
Answer: If we do not want to submit the form with the Submit button, we can use the hyperlink to submit it, such as using JavaScript code as follows: <a href= "Javascript:document.myform.submit ();" >submit me</a>
NET Interview Cookbook