. Net question set (III)

Source: Internet
Author: User
Tags default ftp port how to avoid sql injection

1. What is the name of the implicit parameter for the set method that passes in an attribute?

Value. Its type is the same as that of its attribute.

 

2. Does C # support multi-inheritance?

Not supported between classes, but between interfaces. Class is called an implementation interface, not an inheritance interface.

 

3. What is the common base class for all objects in C?

System. Object

 

4. How do I pass Chinese parameters through hyperlinks?

A: Use URL encoding, pass through querystring, and use urlencode encoding to decode urldecode.

 

5. Differences between string, string; int, int32; Boolean and bool

String, int32, and Boolean all belong to the classes defined in. net, while string, Int, and bool are equivalent to the aliases defined in C. CTS.

 

6. What is the difference between server. Transfer and response. Redirect?

A: server. transfer is only the redirection of control in the server. The redirection address is not displayed in the address bar of the client browser; response. redirect is a complete jump. the browser will get the jump address and resend the request link. In this way, the link address after the jump is displayed in the address bar of the browser.

Server. TransferThe server requests resources. The server directly accesses the URL of the target address, reads the response content of the URL, and then sends the content to the browser, the browser does not know where the content sent by the server comes from, so its address bar is still the original address. In this process, the browser interacts with the Web server.

Response. RedirectThe server sends a status code based on the logic to tell the browser to request the address again. Generally, the browser will re-request the address with all the parameters just requested. In this process, the browser interacts with the Web server twice.

 

7. Isn't the string variable? String S = "ABC"; S = "123" Doesn't it change?

String is immutable in this sectionCodeIn, s originally points to a string object, the content is "ABC", and then we point S to "123". Does the object s points to change? The answer is no. At this time, s does not point to the original object, but points to another string object with the content of "123". The original object still exists in the memory, but the reference variable s no longer points to it.

 

8. Can I call non-static methods from inside a static method?

No. Because a non-static method is associated with an object, you must create an object before you can call the method on the object. When a static method is called, you do not need to create an object, can be called directly. That is to say, when a static method is called, no instance object may be created. If a non-static method is called from a static method, which object is associated with the non-static method? This logic cannot be established. Therefore, a static method cannot call non-static methods internally.

 

9. Is there any memory leakage in. Net? Please briefly describe it.

Memory leakage means thatProgramThe used object or variable is always occupied in the memory .. Net has a garbage collection mechanism, which can ensure that when an object is no longer referenced, that is, when the object becomes an orphan, the object will be automatically removed from the memory by the garbage collector. Although. Net can recycle useless objects,. Net still has memory leakage problems caused by improper use .. Memory leakage in. Net: Memory leakage is likely to occur when a long-lived object holds a reference to a short-lived object. Although the short-lived object is no longer needed, however, the object cannot be recycled because it is referenced by a long life cycle object. the scenario of Memory leakage in. net, in other words, is that the programmer may have created an object and will never use it again, but this object has been referenced, this object is useless but cannot be recycled by the garbage collector.. Net Memory leakage may occur. For example, in the cache system, we load an object and put it in the cache (for example, in a global dictionary object), and then never use it again, this object is always referenced by the cache but is no longer used. Extension: weak references can be recycled even if referenced.

 

10. You can name five common classes and interfaces.

Common classes:Streamreader, WebClient, Dictionary <K, V>, stringbuilder, sqlconnection, filestream, file, RegEx, list <t>

Common interfaces:Idisposable, ienumerable, idbconnection, icomparable, icollection, ilist, idictionary

 

11. Relationship and difference between Bs and CS.

C/SIs the abbreviation of Client/Server. The client must install dedicated client software.

B/SIs the abbreviation of Brower/server. You only need to install a browser on the client. In this structure, the user interface is fully implemented through the WWW browser. Some transaction logic is implemented at the front end, but the main logic is implemented at the server end. The browser interacts with the database through the Web server.

Differences between C/S and B/S:

1 ).Different hardware environments:

C/s is generally built on a dedicated network. In a small network environment, the LAN provides connection and data exchange services through dedicated servers.

B/S is built on a wide area network. It does not need to be a dedicated network hardware environment, such as accessing the Internet over the phone and renting equipment. information management. it has a stronger adaptability than C/S. Generally, only the operating system and browser are available.

2 ).Different security requirements

C/s is generally oriented to relatively fixed user groups and has strong information security control capabilities. generally, the C/S structure is suitable for highly confidential information systems. some public information can be published through B/S.

B/S is built on a wide area network, which has relatively weak security control capabilities and may be intended for unknown users.

3 ).Different handling problems

The c/s program can fix the user surface and meet high security requirements in the same region. It should be the same as the operating system. Because the C/S client is a local program, it is highly interactive with local hardware and programs. For example, it can control other programs on the local machine, read and write local disk files, and interact with hardware.

B/S is built on the Wide Area Network. It targets different user groups and is scattered across regions, which cannot be implemented by C/S. the relationship with the operating system platform is minimal, so it is difficult for B/S to interact with local hardware, programs, and files, for example, it is difficult to control other programs on the local machine, it is difficult to read and write local disk files, and it is difficult to interact with hardware. Of course, ActiveX technology can be used to solve the problem, such as online banking, this problem may be rejected by the customer and is limited to the Windows operating system.

 

C/s is also divided into two layers of architecture and three layers of architecture. Two-tier architecture: client programs directly connect to the database; three-tier architecture: the client accesses the service on the server, and the main logic code is written in the service on the server, and then the service on the server accesses the database again. The Oracle distributed call center, WCF.

 

12. Compile a singleton class.

PublicFilemanager {PrivateFilemanager (){}Public StaticFilemanager instance =NewFilemanager ();}

 

13. What is SQL injection? How to Avoid SQL injection?

The user constructs invalid parameters according to the system program, causing program execution to be not the malicious SQL statement that the programmer expects. SQL injection can be avoided by using parameterized SQL statements. Use parameterized paramter

1' or 1 = 1

 

14. Some database optimization experience?

Internal indexing principle: As a dictionary, the speed of insertion, deletion, and update is slow. In addition, the index occupies more space and the query speed is faster. After the index is added, the speed increases significantly.

(1)You can use the index on frequently retrieved fields (select * From person where name = @ name) to increase the query speed.

(2)Only necessary fields are listed in select, rather *.

(3)To avoid full table scanning caused by implicit type conversion, using a function on the index will also cause full table scanning (because the index is only created for the field, once an expression or function is used, then the index is invalid. Of course, you can use "Function Index" and "expression Index" to solve this problem). Using indexes may not increase the query speed.

(4)Avoid using computation on index columns (where name + 'A' = @ myname)

 

15. Talk about viewstate. Let's talk about ASP. NET principles. About ASP. NET lifecycle.

Label and textbox display different auto-increment features when viewstate is disabled

HTTP is stateless. to simplify the development of webform Based on HTTP, viewstate is used to maintain the status between two requests. Before the page is returned, serialize the interface status to viewstate, and save the status in the browser. The next time the page is submitted, the viewstate will be submitted to the server by the way, in this way, the server restores the status according to viewstate, so that webform development is like stateful development. Let's talk about the custom autoinc control.

 

16. Differences between post and get

Get parameters are displayed in the browser address bar, while post parameters are not displayed in the browser address bar;

When you click the refresh button on the post submission page, the browser will usually prompt "whether to submit again", but get will not;

Pages with get can be crawled by search engines, but those with post cannot;

The amount of data that can be submitted using post is very large, while the amount of data that can be submitted using get is very small (2 k), limited by the length of the webpage address.

You can use post to submit files, but not get.

 

17. The default http port is (80), the default FTP port is (21), and the default sqlserver port is (1433)

 

18. Operator ++ A (add A_1 first, then the expression value is the value after A_1), a ++ (the expression value is, then add ).

 

19. What is the execution result of the following program?

 
IntI =10; Console. writeline (I++); Console. writeline (++I); console. writeline (I=20);

Answer:

10

12

20

 

20. If Visual Studio is not used, which command line is used to compile the C # program?

A: csc.exe.

 

21. Which of the following terms is not directly related to WebService? (B)

A. UDDI

B. guid

C. WSDL

D. Soap

Relationship between soap and http: soap is based on the HTTP protocol. Unlike normal Web pages, the webpage returns HTML, and the soap is XML data that conforms to the SOAP protocol.

 

22. Is the class in. NET Framework dedicated for C # Call?

A: Yes. Both VB. NET and other languages can call classes in. NET Framework. CTS and Cls.

 

23. Open Question: Speak as many. NET Framework-based languages as possible.

Reference: C #, VB. NET, F #, powershell, ironpython, J #, Ruby. net

 

24. What are the relationships between. net, ASP. NET, C #, and Visual Studio?

A:. Net generally refers to. NET Framework, which provides basic. Net classes. These classes can be used by any. Net class.Programming Language. NET Framework also provides basic functions such as CLR, JIT, and GC.

ASP. net is. net is a technology used for web development, Asp.. NET page is written in the aspx file. The logic Code usually uses C #, VB. net.. NET language.

C # is the most widely used programming language that supports. net. Besides C #, VB. NET, ironpython, and so on.

Prepare and other command lines for program compilation, and Visual Studio provides functions such as automatic Code Completion and code highlighting for convenient development. In addition to Visual Studio, there are free and open-source ides such as sharpdevelop and monodevelop, and the free version of Visual Studio Express.

 

25. What problems does Ajax solve? How to Use Ajax? What are the issues with Ajax? Where is Ajax used in the project?

A: Ajax solves the problem of "refreshing new pages". When pages are updated in the traditional HTML form mode, requests must be submitted to the server each time, after the server returns the result, the UI is re-painted. In this way, the page goes through: Submit → white → re-display. The user experience is very poor. Using ajax will not cause the page to be re-submitted or refreshed.

The most essential implementation of AJAX is to use XMLHttpRequest in Javascript for HTTP requests. In development, updatepanel and jquery are usually used to simplify Ajax development. The updatepanel method is the easiest to implement Ajax, however, the data communication volume is large, because the entire viewstate needs to be passed back and forth, and it is not flexible. For complex requirements, you can use the Ajax function provided by jquery.

The internal principle of updatepanel.

The most important problem with Ajax is that cross-origin requests (www.rupeng.com → so.rupeng.com) cannot be sent, that is, requests cannot be sent from pages in the page that are different from those of the current domain name, you can use the server in the domain where the current page is located as a proxy page.

 

26. Net implements object interoperability on heterogeneous platforms by first compiling each language into (IL) and then using (JIT) to compile the platform code at the cost.

 

27. What are the differences between application, cookie, and session?

A: application is used to access the global information of the entire website, and session is used to access the information associated with a specific visitor.

 

28. open question: what kind of technical websites do you often visit?

Blog site (www.cnblogs.com), csdn, codeplex, codeproject, msdn documentation, and msdn Forum

 

29. Your understanding of. Net GC

GC is A. Net Garbage Collector that can recycle memory resources. programmers do not need to care about resource collection. When an object has no reference, it can be recycled. An object that can be recycled does not mean it will be immediately recycled, and GC will choose the time to recycle it. You can call GC. Collect () to recycle the GC immediately. GC cannot recycle unmanaged resources. Generally, the idisposable interface is implemented for all unmanaged resources, and then the resource is recycled using the using keyword.

 

30. Write an SQL statement to retrieve all records whose start character in the name column is "Beijing" from the user table.

Select * from [user] wherer name like 'Beijing %'

 

Author: forevernome
Source: http://www.cnblogs.com/ForEvErNoME/
You are welcome to repost or share it, but be sure to declare it Article Source. If the article is helpful to you, I hope you can Recommendation Or Follow

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.