.net interview Questions – Part -1
Can the interface inherit the interface? Can an abstract class implement an interface? Can an abstract class inherit an entity class?
A: Interfaces can inherit interfaces. Abstract classes can implement interfaces. Abstract classes can inherit entity classes, but there are conditions. The condition is that the entity class must have an explicit constructor.
Can the constructor Constructor be inherited? Can it be Override?
A: Constructor can’t be inherited, so it can’t be overridden, but it can be overloaded.
When a thread enters an object’s method, can other threads access the object’s methods?
A: No, an object method can only be accessed by one thread.
C# can operate directly on the memory?
A: This question is more difficult to answer and is also a big problem. But you can ask questions like this.
C# can directly operate on memory. Although pointers are rarely used, C# can use pointers. When used, you need to add unsafe at the front, and use the garbage collection mechanism (GC) function in .net. It replaces the programmer, but in C# it is not possible to use the finalize method directly, which is to call the base class’s finalize() method in the destructor.
Error and Exception are the difference?
A: Error means that recovery is not impossible, but it is very difficult. Exception indicates an actual or implementation problem, which means that the program does not work properly.
talk about the difference between final, finally, finallize?
A: final is used to declare attributes, methods and classes, indicating that the attribute is immutable, the method cannot be overridden, and the class cannot be inherited.
Finally is the part of the exception handling statement structure that indicates that it is always executed.
Finallize indicates that the object class is a method that is called when the garbage collection mechanism is executed.
the difference between HashMap and Hashtable?
A: HashMap is a lightweight implementation of Hashtable. The non-thread-safe implementation implements the map interface. The main difference is that the HashMap key can be null and the efficiency can be higher than Hashtable.
the difference between Collection and Collections?
A: Collection is the superior interface of the collection class. Collections is a helper class for the collection class. It provides a series of static methods to implement search, sorting, and thread-safe operations on various collections.
What is the commission in C#? Is the incident a kind of commission?
A: A delegate is a safe similarity to a function pointer, but she is much safer than a pointer. It can pass a method as a parameter to another method, which can be understood as a reference to a function. An event is a message mechanism. It is a kind of delegation. The delegate does not have a method body.
Override, Overload, the difference?
A: Override means rewriting. It means to override the base class method, and the method name, return type, parameter type, and number of parameters should be the same as the base class.
Overload is overloaded, it also means to override the base class, but as long as the method name is the same, anything else can be different.
in a BS structure need to pass variable values, you can not use session, coolke, application, how many methods do you have?
A: this.server.Transfer, Querystring.
C# indexer implementation process, can only be based on digital index?
A: No, it can be of any type.
New has several uses?
A: There are 3 kinds, the first one is, instantiating such as: NewClass()
The second is that public new hides the base class method.
The third is that any type parameter in a generic class declaration must have a public no-argument constructor.
Any copy of an Array to an Arraylist?
A: Foreach (object o in Array), ArrayList.Add (0), etc. There are many methods. Think for yourself.
Overview of reflection and serialization?
A: Reflection: It is still difficult to give the next definition of launch. Let me talk about my understanding here. Reflection provides a wrapper assembly, module and type object that can be used to dynamically create an instance of a type, bind a type to an existing object, or get a type from an existing object type, then call the type’s method or access the field and Attributes.
Serialization: A format process that converts an object into another medium. For example, serializing an object, passing the object between the client and the server over the internet using Http, and retrieving the object from the stream using deserialization at the other end.
Const and ReadOnly?
A: Const is used to declare a constant when programming, and ReadOnly is used to declare a runtime constant.
UDP and TCP connections have similarities and differences?
A: TCP is a transport control protocol that provides connection-oriented, reliable, byte-streaming services. When users and servers interact with each other, they must make a TCP connection before their data interaction to transmit data. TCP provides timeout redialing and checking data functions.
UDP is a user datagram protocol, a simple datagram-oriented transport protocol that is an unreliable connection.
how to understand the process and the thread separately?
A: A process is a program running unit larger than a thread. It is a system running unit that is understood by the operating system. There must be at least one process in a program. There is one process.
There must be at least one thread. The dividing scale of the thread is smaller than the process. The process has independent memory units, and the thread is shared memory, which greatly improves the running efficiency of the program.
Multiple threads in the same process can execute concurrently.
How many ways to pass values between ASP.NET pages?
A: QueryString, session, cookies, application, server.Transfer, respose.redictor.
What is an application domain? What is managed code? What is a strong type system? What is boxing and unboxing? What is overloading?
What are CTS, CLS and CLR?
Explanation? A: Application domain: is the isolation boundary provided for security, reliability, isolation, and version control, and uninstaller. It is usually created by the runtime host, the application
The program domain provides a safer and more versatile processing unit. Managed code: Code written using the CLR Compilation Language Editor is called managed code. Boxing and Unboxing: The process of converting a value type to a reference type is implicit. The reverse process is unboxing and is explicit. CTS
Is a public type system, CLS is a common language specification, CLR common language runtime. Strongly typed systems: Each variable and object must have a declared type.
What is the difference between a value type and a reference type?
A: The value of the value type is stored in the stack, the value is changed, the original value of the variable is not changed, and the value of the reference type is stored in the stack, and the referenced address is stored in the stack, and the change is made. The value also changes the original value of the variable. Value types are not allowed to contain null values, whereas nullable types can assign null to value type l.
What are the authentication methods for ASP.net?
A: windows, forms, passport
Explain the meaning of UDDI, WSDL and its role?
A: UDDI is a unified description integration protocol. It is a set of Web-based, distributed, standard implementation standards for information registration for Web services. It is also a Web service registration for the enterprise itself to enable other companies to discover. And access to the protocol standards. A standards-based specification is provided for describing and discovering services, and a set of Internet-based implementations is also provided. WSDL This is an XML-based interface for describing WEB services.
What is SOAP?
A: It is a simple access agreement. It is a protocol that exchanges information and implements remote calls in a distributed environment. Is an XML-based protocol. With SOAP, you can ignore any transport protocol, but usually the HTTP protocol, allowing any type of object or code to communicate with each other on any platform, in any language. It is a lightweight protocol.
How to deploy one ASP.net page?
A: vs2003, vs2005 has a publishing mechanism inside, vs2003 can be released and then deployed in replication. Vs2005 can be deployed directly to the corresponding location.
How to understand the garbage collection mechanism in .net?
A: The garbage collection mechanism in .NET is the recycling and release of memory by the reference program. Whenever an object is created with the new keyword, the runtime allocates memory from the managed heap, because the space is limited, and eventually the garbage collection mechanism is to reclaim unused memory. Memory has been freed and reused.
Three basic principles of object orientation?
A: Encapsulation, inheritance, polymorphism.
What are the base classes for all classes in .NET?
Can you use foreach to traverse the accessed objects that need to be implemented?
A: You need to implement the IEnumerable interface and the GetEnumerator() method.
What is the difference between Heap and stack?
A: Heap is a heap, space is allocated and released by manual operation, and its storage area is large free storage area.
Stack is a stack that is automatically allocated and released by the operating system. The space on the stack is limited. The variable and function allocation memory of the program is performed on the stack during compilation, and the transfer of parameters at runtime runtime is also performed on the stack.