. Net programmer interview question 1

Source: Internet
Author: User

1. New Keyword usage

(1) NewOperator

Used to create objects and call constructors.

(2) NewModifier

Used to hide an inherited member from a base class member.

(3) NewConstraints

It is used to restrict the types of parameters that may be used as type parameters in a generic declaration.

2. How Array Copy Arraylist Li

(1)Implementation1

String [] S = {"111", "22222 "};

Arraylist list = new arraylist ();

List. addrange (s );

(2)Implementation2

String [] S = {"111", "22222 "};

Arraylist list = new arraylist (s );

3. DataGrid Of Datasouse What data sources can be connected

LDatatable

LDataview

LDataset

LDataviewmanager

LAny implementationIlistsourceInterface components

LAny implementationIlistInterface components

4. Overview reflection and serialization

Reflection

Common Language Runtime Library loader management applicationProgramDomain. Such management includes loading each assembly to the corresponding application domain and controlling the memory layout of the type hierarchy of each set.

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 methods of the type or access its fields and attributes.

Serialization

Serialization is the process of converting the object state to a format that can be maintained or transmitted. In contrast to serialization, deserialization converts a stream into an object. These two processes can be combined to easily store and transmit data.

5. Overview O/R Mapping Principle

Use reflection to configure ing between objects and database tables.

6. What are the accessibility levels?

LPublicAccess is unrestricted.

LProtectedAccess is limited to include classes or types derived from include classes.

LInternalAccess is limited to the current Assembly.

LProtected internalAccess is limited to the current Assembly or type derived from the include class.

LPrivateAccess is limited to the include type.

7. Sealed What are the characteristics of modifiers?

SealedModifiers can be applied to classes, instance methods, and attributes. The sealed class cannot be inherited. The sealing method will override the methods in the base class, but it cannot be further rewritten in any derived class. When applied to methods or attributes,SealedThe modifier must always beOverride.

8. List Ado. net Shared classes and database-specific classes in

Shared class

Dataset

Datatable

Datarow

Datacolumn

Datarelation

Constraint

Datacolumnmapping

Datatablemapping

Specific Class

(X) Connection

(X) command

(X) commandbuilder

(X) dataadapter

(X) datareader

(X) parameter

(X) Transaction

9. Run the following command:CodeAfter:

String strtemp = "abcdefgMoumou";

Int I = system. Text. encoding. Default. getbytes (strtemp). length;

Int J = strtemp. length;

Q:

I =?

J =?

 

I = (14);J = (11)Two Chinese bytes

10. C # Medium, String STR = NULL And String STR = "" , Please try to use text to describe the difference.

String STR = ""Initialize object allocation space

WhileString STR = NULLInitialization object

11. Details . Net Li Class And Struct Similarities and Differences

The structure shares almost all the same syntaxes with the class, but the structure is more restricted than the class:

Although the static fields of the structure can be initialized, the structure instance field declaration still cannot use the Initial Value Setting item.

The default constructor (constructor without parameters) or destructor cannot be declared in the structure.

The structure copy is automatically created and destroyed by the compiler, so the default constructor and destructor are not required. In fact, the compiler assigns default values to all fields (see the default table) to implement the default constructor. The structure cannot be inherited from a class or other structure.

Structure is Value Type--If an object is created from the structure and assigned to a variable, the variable contains all the values of the structure. When copying a variable that contains a structure, all data will be copied, and any modifications made to the new copy will not change the data of the old copy. Because the structure does not use references, the structure is not identified--Instances of the same value type cannot be distinguished.C #All value types in are inherited fromValuetypeThe latter inherits fromObject.

The compiler can convert the value type to the reference type in a process called packing.

The structure has the following features:

LThe structure is the value type, and the class is the reference type.

LWhen a structure is passed to a method, the structure is passed by passing values, rather than being passed as a reference.

LUnlike classes, the instantiation of structures can be left empty.NewOperator.

LThe structure can declare constructors, but they must contain parameters.

LA structure cannot inherit from another structure or class, and cannot be the base of a class. All structures are directly inherited fromSystem. valuetypeThe latter inherits fromSystem. Object.

LStructure can implement interfaces.

LIt is incorrect to initialize the instance field in the structure.

12. What is an application domain? What is managed code? What is a strong system? What is packing and unpacking? What is overload? CTS , CLS And CLR What are their explanations?

Application domain

Application domains provide isolation boundaries for security, reliability, version control, and uninstallation of an assembly. The application domain is often created by the runtime host, which directs the Common Language Runtime Library before running the application. The application domain provides a safer and more useful processing unit, which can be used by the Common Language Runtime Library to provide isolation between applications.

Managed code

Code developed using a language compiler based on the Common Language Runtime Library is called managed code. managed code has many advantages, such: cross-language integration, cross-language Exception Handling, enhanced security, version control and deployment support, simplified component interaction model, debugging and analysis services, etc.

Packing and unpacking

Binning and unboxing enable value types to be considered objects. Bind the value typeObjectAn instance of the reference type. This allows the value type to be stored in the garbage collection heap. The value type is extracted from the object.

Heavy Load

Each type of member has a unique signature. A Method signature consists of a method name and a list of parameters (the order and type of parameters. As long as the signature is different, you can define multiple methods with the same name in one type. When two or more methods with the same name are defined, they are called overload.

CTSGeneral Type System(Common Type System)

A specification that determines how the Runtime Library of a common language defines, uses, and manages the types.

CLRPublic Language Runtime Library

. NET FrameworkProvides a runtime environment called a Common Language Runtime Library, which runs code and provides services that make the development process easier.

CLSCommon Language specifications

To fully interact with other objects, regardless of the language in which these objects are implemented, objects must only disclose the common functions of all languages they must interact. Therefore, the public language specification is defined.(CLS)It is a set of basic language functions required by many applications.

Strong type

C #Is a strongly typed language. Therefore, each variable and object must have a declaration type.

13. What is the difference between the value type and the reference type?

A value-type variable directly contains values. When a value type variable is assigned to another value type variable, the included values are copied. This is different from the value assignment of the referenced type variable. The value assignment of the referenced type variable only copies the reference of the object, rather than the object itself.

All value types are implicitly derived fromSystem. valuetype.

Different from the reference type, the new type cannot be derived from the value type. But what is the same as the reference type is that the structure can also implement interfaces.

Different from the reference type, the value type cannot containNullValue. However, the void type function allowsNullValue Type.

Each value type has an implicit default constructor to initialize the default value of this type.

The value type consists of two types: Structure and enumeration.

The structure is divided into the following types:Numeric(Value) type, integer, floating point type,Decimal,BoolUser-defined structure.

Variables of the reference type, also known as objects, can store references to actual data. Declare the keyword of the reference type:Class,Interface,DelegateBuilt-in reference type: Object,String

14. How to Understand Delegation

Delegation is similarC ++Function pointer, but it is type-safe.

The delegate allows passing methods as parameters.

A delegate can be used to define a callback method.

The delegate can be linked together. For example, multiple methods can be called for an event.

The method does not need to be exactly matched with the delegate signature. For more information, see covariant and inverter.

C #2.0The version introduces the concept of anonymous methods, which allow passing code blocks as parameters instead of Individually Defined methods.

15. C # What are the similarities and differences between interfaces and classes.

Differences:

The interface cannot be instantiated directly.

The interface does not contain the implementation of methods.

Interfaces, classes, and structures can be inherited from multiple interfaces. HoweverC #Only single inheritance is supported: A class can only be inherited from one base class.

Class definition can be split between different source files.

Same:

Interfaces, classes, and structures can be inherited from multiple interfaces.

An interface is similar to an abstract base class: any non-Abstract type that inherits an interface must implement all the members of the interface.

Interfaces can contain events, indexers, methods, and attributes.

A class can implement multiple interfaces.

16.asp.net Which authentication methods are available?

WindowsAuthentication provider

Provides information about howWindowsIdentity Authentication andMicrosoft InternetInformation Service(IIS)Identity Authentication is used in combination to ensureASP. NETApplication security information.

FormsAuthentication provider

Provides information about how to use your own code to create an application-specific logon form and perform authentication. UseFormsAn easy way to authenticate is to useASP. NETMembership andASP. NETThe logon controls provide a way to collect, verify, and manage user creden。 with little or no code.

PassportAuthentication provider

Provide relatedMicrosoftInformation of the centralized Identity Authentication Service, which provides single logon and core configuration for member sites

17. Role of the Active Directory

Active DirectoryIt stores information about network objects and allows administrators and users to easily find and use the information.Active DirectoryA structured data storage method is used as the basis for logical hierarchical organization of directory information.

18. Explain UDDI , WSDL Significance and Functions

UDDI

Unified description, discovery, and integration protocols(UDDI, Universal Description, discovery and integration)Is a setWeb, DistributedWebThe implementation standards and specifications of the Information Registration Center provided by the Service also include a groupWebService Registration to enable other enterprises to discover the implementation standards of access protocols.UDDIA set of standards-based specifications are provided for describing and discovering services, and a set of Internet-based implementations are also provided.

WSDL

WSDLDescriptionWebThe public interface of the service. This is based onXMLAbout howWebService Description for service communication and use;

LServiceURLAnd namespace

LNetwork service type (may also includeSoapAs I have said,WSDLCan be used freely to describe the wide range of network services)

LValid function list

LParameters of each function

LType of each parameter

LReturn values and Data Types of each function

19. What is Soap

Soap(Simple Object Access ProtocolSimple Object Access Protocol is a protocol used to exchange information and execute remote process calls in a distributed or distributed environment.XML. UseSoap, Do not consider any specific transmission protocol (the most commonly used isHTTPProtocol), which allows any type of objects or code to communicate with each other in any language on any platform.

SoapIt is a lightweight protocol used to exchange structured information in a distributed and distributed environment.SoapExploitationXMLTechnology defines an extensible message processing framework that provides a message structure that can be exchanged through multiple underlying protocols. The design idea of this framework is to be independent from any specific programming model and the semantics of other specific implementations.

SoapDefines a methodXMLMessage fromAPointBPoint. Therefore, it providesXMLMessage Processing framework with the following features:1)Scalable,2)It can be used through multiple underlying network protocols,3)Independent from the programming model.

20. How to deploy Asp.net Page

VS 2005AndVs 2003There is a publishing mechanism.2003You can publish it and then copy and deploy it.

Vs2005It can be directly deployed to the corresponding location.

21. How to understand . Net Garbage collection mechanism in

. NET FrameworkThe garbage collector manages the memory allocation and release of applications. Each time you useNewWhen the operator creates an object, the runtime database allocates memory for the object from the managed heap. As long as the address space in the managed heap is available, the runtime will continue to allocate space for new objects. However, the memory is not infinitely large. Eventually, the garbage collector must recycle to release some memory. The garbage collector Optimization engine determines the best time to recycle based on the ongoing allocation. When the Garbage Collector executes the recycle action, it checks the objects in the managed heap that are no longer used by applications and performs necessary operations to recycle the memory they occupy.

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.