C # + ASP. NET programmers interview Basic Questions and answers

Source: Internet
Author: User

C # in the program, interfaces are used to define the functions of a class. the interface defines the expected methods, attributes, and event information. to use interfaces, each specific function must complete the described functions strictly according to the interface definition.

If your resume says "familiar with/understand C #", you should be able to answer the following basic questions:

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.

How to Implement inheritance in C?
Add a colon after the class name and the name of the base class.

C # does it support multiple inheritance?
Not supported. It can be implemented through interfaces.

Where can I access the property/method modified by protected?
It can be accessed in the subclass that inherits or indirectly inherits from this class.

Will private members be inherited?
Yes, but cannot be accessed. So it seems that they cannot be inherited, but they are actually inherited.

Describe the modifier protected internal.
Properties/Methods Modified by protected internal can only be accessed in its subclass in the same Assembly.

C # provides a default non-parameter constructor. When I implement another constructor with a parameter, I want to retain this non-parameter constructor. How many constructors should I write?
Two. Once you implement a constructor, C # will no longer provide the default constructor. Therefore, you need to manually implement the non-parameter constructor.

C # What is the common base class for all objects?
System. Object.

What is the difference between heavy load and overwriting?
Overload provides the implementation of calling different parameters for a method signature. Overwriting provides the implementation of modifying the behavior of the parent class method in the subclass.

What does virtual mean in method definition?
The virtual method can be overwritten by the quilt class.

Can I override non-static methods into static methods?
No. The signature of the overwriting method must be consistent with that of the overwriting method, except for changing virtual to override.

Can I override a private virtual method?
No, or even the sub-classes cannot access the private methods in the parent class.

Can a class be prevented from being inherited by other classes?
Yes. Use the keyword sealed.

Can a class be inherited, but cannot a method be overwritten?
Yes. Mark this class as public and the method as sealed.

What is abstract class )?
A class that cannot be instantiated. Abstract classes generally contain abstract methods. Of course, they can also be implemented. An inherited class can be instantiated only when abstract methods of all abstract classes are implemented.

When must a class be declared as an abstract class?
When this class contains abstract methods, or the class does not fully implement the abstract methods of the parent class.

What is an interface?
Class that only contains a total of abstract methods. These methods must be implemented in the subclass.

Why cannot I specify a modifier for a method in an interface?
The methods in the interface are used to define the contract for communication between objects. It is meaningless to specify the methods in the interface as private or protected. They are public methods by default.

Can I inherit multiple interfaces?
Of course.

What if there are repeated method names in these interfaces?
In this case, you can decide how to implement it. Of course, you must be very careful. However, there is no problem in the compilation process.

What is the difference between an interface and an abstract class?
All methods in the interface must be abstract and the access modifier of the method cannot be specified. Abstract classes can be implemented by methods, or you can specify the access modifier of methods.

How do I distinguish between overload methods?
Different parameter types, different parameter numbers, and different parameter order.

What is the difference between const and readonly?
The const keyword is used to declare the compilation frequency, and readonly is used to declare the runtime frequency.

What is the difference between System. String and System. StringBuilder?
System. String is an unchangeable String. System. StringBuilder stores a variable string and provides some methods to modify the string.

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?

Overview of remoting and webservice in. NET and its practical application.
Remote logical call. The remoing interface can only be used in. net.

Overview reflection and serialization
Reflection: The Assembly contains modules, while the module contains types and types, including Members. Reflection provides encapsulated assembly, module, and type objects. You can use reflection to dynamically create instances of the type, bind the type to an existing object, or obtain the type from an existing object. Then, you can call a method of the type or access its fields and attributes.

 

Serialization: serialization is the process of converting an object into a format that is easy to transmit. For example, you can serialize an object and Use HTTP to transmit the object between the client and the server over the Internet. At the other end, deserialization reconstructs the object from the stream.

There are several usage methods for new

 

First: new Class ();
Method 2: overwrite public new XXXX (){}
Third: the new constraint specifies that any type parameter in the generic class declaration must have a common non-parameter constructor.

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.