. Net interview question Summary (2),. net interview question Summary

Source: Internet
Author: User
Tags sql server driver odbc sql server driver

. Net interview question Summary (2),. net interview question Summary

51. In. net, which namespaces do classes for reading and writing XML belong?


A: System. Xml

 


52. Explain the significance and functions of UDDI and WSDL.


A: UDDI is a unified description, discovery, and integration protocol. Purpose: Describe some information types of a Web service to help the service requestor determine the following problems: WHO, WHAT, WHERE, HOW. How: the quality of service provided. The abbreviation of WSDL Web Services Description Language is an XML Language used to describe Web Services and describe how to communicate with Web Services. WSDL is used to provide a description of the service. It consists of five main elements: 1) Types: defines the data Types used in the WSDL definition, that is, XML Schema Types 2) Message: definitions of input and output parameters for a group of messages 3) portType: defines Web service operations 4) Binding: Describes the protocol, data format, security, and other attributes of a specific service interface. 5) Services: Specify the URL of a specific service and the provided call interface, which contains a set of port elements.

 

53. What is SOAP and what applications are there.


A: Simple Object Access Protocol (SOAP) is a Protocol used to exchange information and execute remote process calls in a distributed or distributed environment. It is an XML-based Protocol. When using SOAP, you do not need to consider any specific transmission protocol (the most commonly used HTTP protocol). You can allow any type of objects or code to communicate with each other in any language on any platform. This type of communication uses the XML format of the message, see: http://playist.blogchina.com/2521621.html

 

54. What are common webservice call methods?


A:
WEB services can be accessed using a HTTP-GET HTTP-POST from a browser, ASP page, or other WEB service calls, or from an ASP page or other WEB Service, SOAP requests to other WEB services HTTP-GET HTTP-POST SOAP uses WEB Services proxy

 

55. What is the difference between private assembly and shared assembly?


A private assembly is usually used by a single application and stored in the directory where the application is located, or in a subdirectory under this directory. Shared Assembly is usually stored in the Global Assembly Cache, which is an Assembly repository maintained by. NET runtime. Shared assembly is usually a code library that is useful to many applications, such as. NET Framework classes.

 

56. What is the difference between a process and a thread? What is the difference between a process and a program?


Generally, an application corresponds to one or more processes, which can be seen as the identity of the application in the * system. A process usually consists of multiple threads, the thread is the minimum unit for * the system to allocate processing time for the application.

 

57. What are the meanings of CLR and IL?


CLR: when running in a common language, it is similar to the JVM in Java and the Java Virtual Machine. in the. Net environment, various programming languages use a common basic resource environment, which is CLR. CLR will directly communicate with the * Operating System, while programming languages such as C #. NET will try to avoid direct communication with * as a system and enhance the execution security of program code. You can see that CLR is a specific programming language such as C #. NET and *. It also provides many resources for specific programming languages:
IL, an intermediate language, also known as MSIL, a Microsoft intermediate language, or cel, is a general intermediate language. All. NET source code (no matter which language is used) is compiled into IL during compilation. The machine code is interpreted and executed by the Just-In-Time (JIT) compiler when the application is running.

 

58. Please explain ASP. . NET


Aps.net has five controls: non-empty verification, comparison verification, value range verification, regular expression verification, and custom verification. In addition, it also has a centralized information processing control.
11. WEB controls can trigger server events. How does a server event occur and how it works? What is automatic transmission? Why use automatic transmission.
When a web control event occurs, the client submits the data back to the server. The server first calls the Page_Load event, then, server events are automatically called Based on the returned status information. When we click the client control, data is directly transmitted back to the service end in the form of a submission form.
The server event mechanism can be realized only through automatic return. If there is no automatic return mechanism, only client events can be called, but server events cannot be called.

 

59. Can WEB controls and HTML server controls call client methods? If yes, how can I call it?


Yes
Example: <asp: TextBox id = "TextBox1" onclick = "clientfunction ();" runat = "server">
</Asp: TextBox>
<INPUT id = "Button2" value = "Button" name = "Button2"
Runat = "server" onclick = "clientfunction ();">

 

60. Please explain the important nodes in the web. config file


AppSettings includes custom application settings.
System. web system Configuration
Compilation dynamic debugging and compilation settings
CustomErrors custom error information settings
Authentication. This section sets the authentication policy for the application.
Authorization. This section sets the application authorization Policy.

 

61. Please explain ASP. What is the relationship between web pages and hidden classes in. NET?


An ASP. NET page generally corresponds to a hidden class. Generally, a hidden class is specified in the ASP. NET page declaration. For example, the declaration of a page Tst1.aspx is as follows:
<% @ Page language = "c #" Codebehind = "Tst1.aspx. cs" AutoEventWireup = "false" Inherits = "T1.Tst1" %>
Codebehind = "Tst1.aspx. cs" indicates which code file is used when the page is compiled
Inherits = "T1.Tst1" indicates the hidden class used when the table is running.

 

62. What is viewstate? Can I disable it? Can all controls be disabled?


Viewstate is a mechanism for saving the state. You can disable the EnableViewState attribute when it is set to false.

 

63. What are the possible causes when I find that I cannot read the input data on the page? Solution


It is likely that the IsPostBack attribute of the Page is not judged during data processing in Page_Load.

 

64. What is a context object and under what circumstances should it be used


Context object refers to the Current attribute of the HttpContext class. This object is used when we want to access built-in objects (Response, Request, Session, Server, Appliction, etc.) in a common class.

 

65. What is the difference between forwarding and redirection?


Forwarding means that the server jumps to page A and submits data to page B. Page B is processed and the server jumps to other pages.
Jump refers to the client jump

 

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


Session (viewstate) is simple, but it is easy to lose the global cookie of the application. However, it may not be supported and may be forged.
The input ttype = "hidden" is simple and may be forged. The url parameters are simple and displayed in the address bar. The length is limited, the database is stable and secure, but the performance is relatively weak.

 

67. Similarities and Differences between DataReader and DataSet


The biggest difference between DataReader and DataSet is that DataReader always occupies SqlConnection and operates databases online .. any operation on SqlConnection will cause DataReader exceptions .. because DataReader only loads one piece of data in the memory each time, the occupied memory is very small .. because of the special nature and high performance of DataReader. so DataReader is only in .. after reading the first article, you cannot read the first article again ..
DataSet loads data in memory at one time. abandon database connection .. the database connection is abandoned after reading .. because DataSet loads all data in the memory. therefore, memory consumption is relatively high... but it is more flexible than DataReader .. you can dynamically Add rows, columns, and data. perform a back-to-back update operation on the database...

 

68. What are the differences between classes and structures?


One of the biggest differences is the reference type, and the other is that the default value type access is public.

 

69. What is a context object and under what circumstances should it be used?


Context object refers to the Current attribute of the HttpContext class. This object is used when we want to access built-in objects (Response, Request, Session, Server, Appliction, etc.) in a common class.

 

70. Briefly describe the detailed steps for synchronous communication programming using Socket


1. Use protocol and network address in applications and remote devices to initialize sockets
2. Create a listener by specifying the port and address in the Application
3. remote devices send connection requests
4. Applications accept connections to generate scoket communications
5. Communication starts between applications and remote devices (in communications, applications will be suspended until communication ends)
6. After the communication ends, close the Socket of the application and remote device to recycle resources.

 

71. In C #, use text or images to describe the differences between string str = null and string str =.


String str = null indicates that no memory space is allocated to him, while string str = "" assigns it a memory space with a length of null characters.

 


72. Describe the similarities and differences between classes and struct in dotnet:


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

 

73. In the SQLSERVER server, there are two field IDs and LastUpdateDate in the given table 1. The ID indicates the updated transaction number, and the LastUpdateDate indicates the server time during the update, use an SQL statement to obtain the last updated transaction number.


Select top ID from table1 order by LastUpdateData desc

 

74. A brief introduction to your understanding of remoting and webservice in the Microsoft. NET architecture and your practical application.


Remoting is. net is used to call methods across machine, process, and appdomain. For a three-structure program, remoting technology can be used to construct the program. it is the basic technology for distributed applications. similar to the previous DCOM Web Service, it is a common model for building applications and can be implemented on all operating systems that support internet communication. Web Service enables the combination of component-based development and web to achieve the best, component-based object model

 

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


Attackers can exploit SQL keywords to attack websites. Filter keywords, etc.
The so-called SQL Injection is a feature that uses the programmer's lax or non-detection of the legality of user input data and deliberately submits special code from the client, collect information about programs and servers to obtain desired information.
Http: // localhost/lawjia/show. asp? ID = 444 and user> 0. Then, the server runs the Select * from table name where field = 444 and user> 0 query. Of course, this statement cannot run, the error message is as follows:
• Error Type:
Microsoft ole db Provider for ODBC Drivers (0x80040E07)
A syntax error occurs when [Microsoft] [odbc SQL Server Driver] [SQL Server] converts the nvarchar value 'sonybb' to a column whose data type is int.

 

76. generate an int array with a length of 100 and insert 1-100 randomly into it, which cannot be repeated.


Int [] intArr = new int [100];
ArrayList myList = new ArrayList ();
Random rnd = new Random ();
While (myList. Count <100)
{
Int num = rnd. Next (1,101 );
If (! MyList. Contains (num ))
MyList. Add (num );
}
For (int I = 0; I <100; I ++)
IntArr [I] = (int) myList [I];

 


77. Describe the differences between classes and structures.


1) The structure is a value type;
2) structure does not support inheritance;
3) The structure cannot define the default constructor;
4) The structure cannot define the destructor;
5) The structure cannot use the initial value to set the Domain value.

 

78. Maintain database integrity and consistency. Do you like to use triggers or write business logic? Why?


A: Use constraints (including CHECK, primary key, unique key, foreign key, and non-empty fields) as much as possible. This approach is most efficient. Use triggers, this method ensures that no matter which business system accesses the database, the database integrity and consistency can be maintained. Finally, the self-writing business logic can be used for implementation. However, this method is the least efficient and the most complex in programming, this is the next strategy

 

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


Answer: ADO data is stored in the form of Recordset. ADO. NET is stored in the form of DataSet.
The Recordset allows you to access ADO. NET through continuous database connection and disconnect the database.
Compared with ADO, ADO. NET provides data sets and data adapters to facilitate distributed processing and reduce resource consumption on database servers.

 

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


A: asp.net can use a strong language.
The page is compiled, and the execution speed is fast, increasing security and reliability.
The Inheritance mechanism is used to support code reuse and the declarative server control is provided to reduce the number of lines of code.
Asp needs to be explained, the execution speed is slow, the code reuse is not convenient, there is no debugging Mechanism

 

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


A delegate is essentially a "method interface", which is equivalent to a function pointer in C/C ++. Of course, it is safer than a function pointer and is usually used for event processing in C. Compared with JAVA, you can avoid using a large number of small-granularity anonymous classes. (However, Microsoft may use an anonymous class similar to JAVA to implement delegation, but not literally. Who knows ?)
The event is not a delegate, but the nature of the event determines the parameters that can be accessed by the program logic that processes it. Therefore, the event processing logic in C # is encapsulated as delegate (a "method interface "). In fact, if you are dealing with custom events, it is also possible to use interfaces as in JAVA, but doing so in C # is generally not particularly beneficial.

 

82. What data sources can the datagrid. datasouse connect?


Answer: [dataset, datatable, dataview] dataset, datatable, dataview, IList

 

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


Answer: The sealed modifier is used to prevent other classes from being derived from the modified class. If a sealed class is specified as the base class of another class, a compile-time error occurs. The sealed class cannot be an abstract class at the same time.
The sealed modifier is mainly used to prevent unintentional derivation, but it can also promote some runtime optimization. Specifically, because the sealed class will never have any derived class, the call to the virtual function Member of the sealed class instance can be converted to a non-virtual call for processing.

 

84. If. net is used as a B/S structure system, how many layers of structure are used for development? What is the relationship between each layer and why is this hierarchy required?


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 password 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.

 

85. What is an application domain? What is regulated code? What is a strong system? What is packing and unpacking? What is overload? What are the explanations of CTS, CLS, and CLR?


A: The application domain can be understood as a lightweight process. Security. Small resource occupation
Regulated code: unsafe: unmanaged code. Does not run through CLR.
Strong type system RTTI: Type Recognition System.
Packing is to convert the value type to the reference type.
Unpacking is the conversion from the reference type to the value type.
Specify parameters with the same number of unique methods or different parameter types
CTS: general language system. CLS: general language specification. CLR: Common Language Runtime Library.

 

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


A: The Connection object is used for Connection between applications and databases.
Command can retrieve and manipulate data in the database
The DataAdapter object acts as a bridge between DataSet and the data source for retrieving and storing data
The data retrieved from the database by the DataSet object can be stored in XML format.
DataReader is a type of only-in query result. Read-Only views do not have any complex functions of DataSet.
Therefore, you can speed up data access and viewing without providing disconnected access.

 

87. How do I understand delegation?


A: It is said to be equivalent to a function pointer. If a delegate is defined, the method can be called without calling the original method name.
Msdn2005 explains this as follows:
Delegate has the following features: delegate is similar to a C ++ function pointer, but it is type-safe.
The delegate allows passing methods as parameters. The delegate can be used to define the callback method.
The delegate can be linked together. For example, multiple methods can be called for an event.
The method does not need to be exactly matched with the delegate signature.

 

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


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 is a special delegate

 

89. How do processes and threads understand each other?


A: The process is Lao Tzu, The thread is the son, and there is no son without Lao Tzu. A Lao Tzu can have multiple sons. A son can be another son, and a son can also be another son.

 

90. Explain the significance and functions of UDDI and WSDL


A: UDDI is used to register services provided by various service providers so that they can be shared. It also helps WEB service customers or web users find the Web service.
Wsdl is a web Service Description Language)

 

91. What is SOAP and what applications are there.


A: Simple Object Access Protocol (SOAP) is a Protocol used to exchange information and execute remote process calls in a distributed or distributed environment. It is an XML-based Protocol. When using SOAP, you do not need to consider any specific transmission protocol (the most commonly used HTTP protocol). You can allow any type of objects or code to communicate with each other in any language on any platform. This type of communication uses messages in XML format. For details, see

 

92. Overview of remoting and webservice in. NET and its practical application.


Answer: for remote logical calls, The remoing interface can only be used in. net.

 

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


A: 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.

 

94. list several methods for passing values between ASP. NET pages.


Answer. 1. Use QueryString,
Source Page
String url;
Url = "anotherwebform. aspx? Name = "+ TextBox1.Text
Response. Redirect (url );
Target page
Label1.Text = Request. QueryString ["name"];
2. Use Session Variables
Source Page
Session ["name"] = TextBox1.Text;
Session ["email"] = TextBox2.Text;
Server. Transfer ("anotherwebform. aspx ");
Target page
Label1.Text = Session ["name"]. ToString ();
Label2.Text = Session ["email"]. ToString ();
Session. Remove ("name ");
Session. Remove ("email ");
3. Use Server. Transfer
Source Page code:
Public string Name
{
Get {
Return TextBox1.Text ;}
}
// Call the Server. Transfer Method
Private void button#click
(Object sender, System. EventArgs e)
{
Server. Transfer ("anotherwebform. aspx ");
}
Target Page code:
Private void Page_Load
(Object sender, System. EventArgs e)
{
WebForm1 wf1;
Wf1 = (WebForm1) Context. Handler;
Label1.Text = wf1.Name;
}

 

95. The rules for columns are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ...... calculate the number of 30th digits and use a recursive algorithm.


A: public class MainClass
{
Public static void Main ()
{
Console. WriteLine (Foo (30 ));
}
Public static int Foo (int I)
{
If (I <= 0)
Return 0;
Else if (I> 0 & I <= 2)
Return 1;
Else return Foo (I-1) + Foo (I-2 );
}
}

 

96. Differences between override and overload


A:
The difference between override and overload. Overload means that the method name is the same. The parameters or parameter types are different and are reloaded multiple times to meet different needs.
Override is used to Override functions in the base class. To meet your needs.

 

97. traverse all TextBox controls on the page programmatically and assign it a string. Empty?
A:
Foreach (System. Windows. Forms. Control control in this. Controls)
{
If (control is System. Windows. Forms. TextBox)
{
System. Windows. Forms. TextBox tb = (System. Windows. Forms. TextBox) control;
Tb. Text = String. Empty;
}
}

 

98. How can I program a Bubble sorting algorithm?


A:
Int [] array = new int [*];
Int temp = 0;
For (int I = 0; I <array. Length-1; I ++)
{
For (int j = I + 1; j <array. Length; j ++)
{
If (array [j] <array [I])
{
Temp = array [I];
Array [I] = array [j];
Array [j] = temp;
}
}
}

 

99. Describe the implementation process of the indexer in C #. Can I index data only by numbers?


A: No. Any type can be used.

 

100. What classes do I need to read and write databases in net? What are their roles?


Answer: DataSet: data storage.
DataCommand: Execute the statement command.
DataAdapter: a collection of data for filling.

 

Author:Mo XuejunSource: Beijing.

 

Related Article

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.