. Net required-. Net Interview Questions and answers

Source: Internet
Author: User

1) What is the difference between a thread and a process? Both threads and processes define some boundary. The difference is that processes define the boundary between applications, different processes cannot share code and data space, while threads define the boundary of code execution stack and execution context. A process can contain several threads and create multiple threads to complete a task at the same time, that is, multithreading. Different threads in the same process share code and data space. In a metaphor, if a family represents a process, each member in the family is a thread, and every member in the family is obligated to accumulate wealth in the family, at the same time, the family has the right to consume family wealth. when facing a task, the family can also send several members to complete the work together, people outside the family cannot directly consume the property of their own families.
2) What is a Windows service? What is its lifecycle different from that of a standard exe program?
Windows Service is an application running under the specified user (default system) in the Windows background. It does not have a standard UI interface and is similar to a standard exe program, A Windows service is created at the beginning of the service and destroyed at the end of the service. You can also set whether the service is started with the operating system and disabled together. It supports three methods: 1) automatic mode 2) manual mode 3) disabled. When the automatic mode is enabled, the Windows service starts automatically after the OS is started, and the manual mode must start the service manually. If the disabled mode is disabled, the service cannot be started. In addition, standard EXE uses the currently logged-on user by default, while Windows uses the System user by default, which requires special attention when accessing system resources.
3) What is the maximum memory size that a single windows process can access? Is it the same as the maximum virtual memory of the system? What is the impact on system design?
For the hardware platform, the formula is as follows: the maximum memory size that a single process can access = 2 to the power of the number of processor digits/2. For example, under a 32-bit processor, the maximum memory size that a single process can access is 232/2 = 2G. The maximum amount of memory that a single process can access is 1/2 of the maximum virtual memory, because half of the virtual memory is allocated to the operating system.
4) What is a strong type and a weak type? Which one is better? Why?
A strong type determines the type of data during compilation. The type cannot be changed during execution, but the weak type determines the type during execution. No, either of them has its own advantages. Strong type security, because it has been determined in advance, and the efficiency is high. It is generally used in compiled programming languages, such as C ++, Java, C #, Pascal, etc. The weak type is not safe compared to other programming languages. It is prone to errors during running, but it is flexible, it is mostly used in interpreted programming languages, such as JavaScript and VB.
5) What is PID? How to use the system in troubleshooting?
PID is the process number. When the system discovers a fault, you can find the specific process of the fault based on it, you can also use visual studio.net and other ides to attach the faulty process to the process for debugging (Debug)
6) How many processes can listen on a single TCP/IP Port?
Multiple containers can be used and multiple containers can be used for port multiplexing (thanks for the frog pond Reminder)
See the following code:

Port multiplexing
Socket socket1 = new socket (addressfamily. InterNetwork, sockettype. Stream, protocoltype. TCP );
Socket socket2 = new socket (addressfamily. InterNetwork, sockettype. Stream, protocoltype. TCP );
Socket1.bind (New ipendpoint (IPaddress. parse ("127.0.0.1"), 8235 ));
Socket1.listen (10 );
Socket2.setsocketoption (socketoptionlevel. socket, socketoptionname. reuseaddress, true );
Socket2.bind (New ipendpoint (IPaddress. parse ("127.0.0.1"), 8235 ));
Socket2.listen (10 );
Console. Read ();
7) What is GAC? What problems does it solve?
Gloal Assembly Cache: global application Assembly cache. It solves the problem that several programs share an assembly. You no longer need to copy the shared assembly to the application directory. In fact, this principle is very simple ,. when a. NET application is loaded, it first checks the global application Assembly Cache. If yes, it can be used directly without searching in the application directory.

Intermediate. NET developers
1) explain the differences between interface-oriented, object-oriented, and Aspect-Oriented Programming
APIs are more concerned with concepts. The principle is to define the behavior norms first, and then create and implement them according to the behavior norms. Strictly speaking, interfaces should be part of the object-oriented model, because object-oriented also emphasizes the Dependency inversion principle, that is, implementation depends on abstraction, while abstraction does not depend on specific implementation. What's more, it should be interface-oriented and abstract-oriented, in my experience, the interface-oriented approach is more flexible, but there is a little bit of code redundancy in implementation. Abstract-oriented approach can be combined with interface-oriented approach, first defining interfaces, then defining abstract classes, process some public logic in the abstract class, and then implement the specific implementation class. Object-oriented is the decomposition of complex problems. Aspect-oriented programming is a new concept that solves many problems that object-oriented cannot solve. For example, object-oriented technology can only modularize business-related code, however, it is impossible to modularize the code unrelated to the business. Aspect-oriented is the solution to this problem. Its key idea is to "separate the business logic in the application from the general service that provides support for it ".
2) What is interface? What is the difference between it and abstract class?
Interfaces are used to define behavioral norms without specific implementations. abstract classes can be partially implemented in addition to defining behavioral norms, but a class can implement multiple interfaces, but only one parent class can be inherited.
3) What is reflection?
An Assembly contains a module, and a module includes a type. There are members under the type. Reflection is the management assembly, module, and type object. It can dynamically create instances of the type, set the existing object type or obtain the existing object type. You can call the method of the type and the field attribute of the access type. It is created and used at runtime.
4) What is the difference between the XML Web Service using asmx and the. NET remoting service using soap?
The message mechanism used by the web service, while the rpc. Web Service used by remoting can be used on different platforms and languages. remoting is only applicable to. net. Remoting is more efficient than XML Web Service.
5) is the type system represented by XMLSCHEMA? Is CLS represented by XMLSCHEMA?
Not clear
6) What is the difference between early-binding and late-binding?
This is similar to the strong and weak types. The pre-binding determines the data to be bound during compilation, and the post-binding completes data filling during running. Therefore, if binding fails in the early stage, a compilation error will be reported during compilation, and later binding fails only at runtime.
7) Call assembly. Load to calculate static reference or dynamic reference?
Dynamic
8) When to use assembly. loadfrom? When to use assembly. LoadFile?
Haha, this is quite interesting. Compared with LoadFile, loadfrom is not authentic, because when it takes a daughter-in-law, it is to let people wear dowry, sit in the carriage, and have to take their sister, :) It is used to load the assembly, which requires that the Assembly on which this Assembly depends be loaded at the same time. While LoadFile is a lot more authentic. It loads the content of the Assembly file, and only loads the file of the input parameter, regardless of the Assembly dependency, but if there is the same implementation, however, loadfrom cannot be used to load files with different locations, but LoadFile can. Because LoadFile loads a file, after calling it, it may be unable to be executed due to the lack of necessary dependencies.
9) What is Assembly qualified name? Is it a file name? What's the difference?
It is not a file name. Compared with the file name, Assembly qualified name (Assembly qualified name) can better determine an assembly. It contains the file name, but also contains the version, public key, and region. The file with the same name may have different versions and regions. In this case, the file name alone may cause the correctness of the assembly to be uncertain.
10) Assembly. Load ("foo. dll"); is this statement correct?
Error. The correct one should be assembly. Load ("foo"); or assembly. loadfrom ("foo. dll"); (thanks to Tristan (guozhijian) for prompt correction)
11) What is the difference between an assembly with strong signatures and an assembly without strong signatures?
A strongly signed assembly can be made into com without strong signature. A strongly signed assembly can be installed in GAC without strong signature.
12) can datetime be null?
No, because it is of the struct type, and the structure belongs to the value type. The value type cannot be null. Only the reference type can be assigned null.
13) What is JIT? What is ngen? What are their limitations and benefits?
Just in time is compiled in a timely manner. It is compiled when the program is run for the first time. ngen is called pre-jit, which means that the native image of the Assembly will be generated before running, and save it to the global cache. ngen can accelerate assembly loading and execution because it can restore the code and data structure from the local image, instead of generating them dynamically as JIT does. The reason for caching is similar.
14) What is the difference between finalize () and dispose?
Finalize () is used to implicitly release resources, and dispose () is used to display the release resources (finalize () is indeed equivalent to the destructor in C ++ (thanks to Jeffrey Zhao for prompting correction)
15) is the using () syntax useful? What is idisposable? How it achieves the final certainty.
Is used to create an idisposiable class in using. After using is completed, the dispose method of the object is called to release resources. I don't understand what is the end of certainty
16) What is the tasklist/M "mscor *" command?
Lists all processes and modules that use a DLL or EXE starting with "mscor ".
17) differences between in-Proc and out-of-Proc
In-Proc is the process, where code and data blocks can be shared within the process, out-of-Proc is the process, and inter-process interoperability needs to be achieved through inter-process communication.
18) which technology in. Net can implement out-of-Proc communication?
. Net remoting technology or WCF Technology
19) which process does ASP. NET run on Windows XP, Windows 2000, and Windows 2003 respectively?
XP: aspnet_wp.exe
Windows 2000: aspnet_wp.exe (thanks for the Tristan prompt for correction)
Windows 2003: w3wp.exe

 

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.