Analysis of ASP. NET pen questions

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

ASP. NET pen questions will examine all aspects of programmers, so what kind of questions will arise during the interview?

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

2. Describe the similarities and differences between classes and struct in dotnet: (10 points)

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.

3. Based on the delegate knowledge, complete the following code snippets in the user control: (10)

 
 
  1. NamespaceTest
  2. {
  3. Public DelegateVoidonDBOperate ();
  4. Public ClassUserControlBase: System. Windows. Forms. UserControl
  5. {
  6. PublicEventonDBOperateonNew;
  7. PrivatevoidtoolBar_ButtonClick (objectsender, System. Windows. Forms. ToolBarButtonClickEventArgs e)
  8. {
  9. If(E. Button. Equals (BtnNew ))
  10. {
  11. // Complete the following code to call the OnNew event of the OnDBOperate delegate signature. 
  12. }
  13. }
  14. }
  15. }
  16. __________________________________________
  17. If(OnNew! =Null)
  18. OnNew (This, E );

4. Analyze the following code to complete the blanks (10 points)

 
 
  1. String strTmp ="Abcdefg moumou";
  2. IntI = System. Text. Encoding. Default. GetBytes (strTmp). Length;
  3. IntJ = strTmp. Length;

After the above code is executed, I = j = I still do not know, j = 10

5. in the SQLSERVER server, the given table table1 contains two field IDs and LastUpdateDate. ID indicates the updated transaction number, and LastUpdateDate indicates the server time when the update is performed, use an SQL statement to obtain the last updated transaction number. (10)

Select top ID from table1 order by LastUpdateData desc

6. Briefly discuss your understanding of the remoting and webservice technologies under the Microsoft. NET architecture and their practical applications. (10)

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.

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

Attackers can exploit SQL keywords to attack websites. Filter keywords ?? And so on

The so-called SQL Injection) is to use programmers to check the legitimacy of user input data is lax or not detected, deliberately submit special code from the client, so as to collect information about programs and servers, to obtain the 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)

[Microsoft] [odbc SQL Server Driver] [SQL Server]

Set the nvarchar value ?? Sonybb ?? A syntax error occurs when you convert a column to an int type.

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

 
 
  1. int[] intArr=new int[100];   
  2. ArrayList myList=new ArrayList();   
  3. Random rnd=new Random();   
  4. while(myList.Count<100)   
  5. {   
  6. int num=rnd.Next(1,101);   
  7. if(!myList.Contains(num))   
  8. myList.Add(num);   
  9. }   
  10. for(int i=0;i<100;i++)   
  11. intArr=(int)myList;  

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

An ASP. NET pages generally correspond to a hidden class, which is usually stored in ASP.. NET page declaration specifies a hidden class such as a page Tst1.aspx page declaration as follows: Codebehind = "Tst1.aspx. cs "indicates which code file to use when compiling this page

Inherits = "T1.Tst1" indicates the hidden class used when the table is running.

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

11. What is the possible cause 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.

12. Please explain what is a context object and under what circumstances it should 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.

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

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

1) use protocols and network addresses 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) applications and remote devices start to communicate. In the communication process, applications will be suspended until the communication ends)

6) The communication ends. Close the Socket of the application and remote device to recycle resources.

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

I will introduce you to the situation of ASP. NET pen questions, and hope to help you prepare ASP. NET pen questions.

  1. Analysis of ASP. NET database programming technology
  2. Miscellaneous on the learning path of ASP. NET programmers
  3. Development Analysis of ASP. NET Custom Controls
  4. Analysis on the lifecycle of ASP. NET Server controls
  5. Summary of ASP. NET pen questions

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.