Tencent .NET foundation

Answer requirements: marked * are mandatory part of the answer, multiple choice multiple-choice questions are not specified as both multiple choice.

 

A, .Net Framework part *

 

1. packing, unpacking operation occurs: (C)
between the object between the object and the A. B. object class
C. D. references between the reference and the type and value types between the reference type

 

2. To support the user class Foreach statements need to implement the interface is: (B)
A.IEnumerable B.IEnumerator
C.ICollection D.ICollectData

 

3. .Net Framework interoperate with COM components by what? (C)
A.Side By Side B.Web Service
C.Interop D.PInvoke

 

4. .Net depend on which of the following technologies to solve the existing COM Dll Hell problem? (A)
A.Side By Side B.Interop
C.PInvoke d.com +

 

5. Is boxing and unboxing operations are reciprocal operation? (A)
A. is B. No

 

6. Which of the following is variable length arrays? (D)
A.Array B.string []
C.string [N] D.ArrayList

 

7. User-defined exception classes from which the class needs to inherit C :()
A.Exception B.CustomException
C.ApplicationException D.BaseException

 

8. Can the following code snippet compiler? Give reasons.
the try
{
}
the catch (a FileNotFoundException E1)
{
}
the catch (Exception E2)
{
}
the catch (IOException E3)
{
}
the catch
{
}

  Not compile, because e3 is a subclass of e2, e3 all belong to the exception is captured e2.

 

 

9. For a implements IDisposable class interface, which of the following items to perform the tasks defined in the release or resetting unmanaged resources-related applications? (Multiple choice) (BD     )
A.Close B.Dispose C.Finalize
D.using E.Quit

 

10. .Net technology relies Which of the following cross-language interoperability? (C)
A.CLR B.CTS C.CLS D.CTT

 

11. ask: String class and StringBuilder classes What is the difference? Why these two classes exist in .Net class library? (Short answer)

And JAVA in similar StringBuffer, StringBuilder can improve performance when the connection string. Because String is read-only when connected to require the presence of temporary objects in memory, whereas a StringBuilder just only in memory.

 

12. Which of the following classes are int base class? (C)
A.Int32 B.Object C.ValueType D.Int16

 

     Two, C # section *

 

13. Which of the following can be used as an interface member? (Multiple) (ABDE)
A. Method B. D. event attribute field E. C. indexer
F. G. constructor destructor

 

14. The following description of the ref and out of which term is correct? (Multiple) (the ACD)
A. use ref parameter, the parameter passed to ref parameters must first be initialized.
B. out parameters, the parameters passed to the out parameters must first be initialized.
C. Use ref argument, which must be explicitly as a method argument passed to ref.
D. out parameters, as a method parameter must be explicitly transmitted to the out parameter.

 

15. "access limited to this type of assembly or those from the class to which it belongs derived" Which of the following is the correct description of the members of the accessibility of meaning? (D)
A.public B.protected C.internal D.protected Internal

Accessibility keywords may have the following five:

internal: concentrate can be accessed in their respective programs.

private: private members can be accessed in the current class.

protected: protected members can be accessed in the current class and its subclasses.

public: public members, full disclosure, no access restrictions.

internal protected: access to the assembly or sub-class belongs in the current class. (Not mentioned in the title)

[Extensions]

Modifier such as: abstract, sealed, static, unsafe 4 th.

abstract: class is abstract, you can not create an instance of the class

sealed: class is sealed and can not be inherited

static: class is static, only static members, no non-static member

unsafe: non-security type structure, such as pointer

 

16.   abstract class BaseClass
{
    public virtual void MethodA()
    {
    }
    public virtual void MethodB()
    {
    }
}
class Class1: BaseClass
{
    public void MethodA(string arg)
    {
    }
    public override void MethodB()
    {
    }
}
class Class2: Class1
{
    new public void MethodB()
    {
    }
}
class MainClass
{
    public static void Main(string[] args)
    {
        Class2 o = new Class2();
        Console.WriteLine(o.MethodA());
    }
}
Ask, o.MethodA call is: ()
A.BaseClass.MethodA B.Class2.MethodA
C.Class1.MethodA not D.

 

17. Please describe distinguishing property of the indexer.

Indexer property

             Identified by its name.              By signature logo.

             Access accessed through a simple name or member.      Access accessed through the elements.

             It can be static members or instance members.      It must be instance members.

             Get accessor property no parameters.      Indexer get access to the indexer having the same parameter list.

             Set accessor attribute contains the implicit value parameter. In addition to the parameter value, the indexer set accessor also has the same indexer parameter list.

    

 

18. Please describe the difference between const and readonly.
const must be assigned at the time of declaration, and readonly can be assigned in the constructor;

const will be optimizing compiler, compiled const constants will disappear, and the readonly value determined at runtime;

After the upgrade, modify const variables, all applications that call const variables need to be recompiled, and readonly without recompiling.



19. Please describe the difference between class and structure.

              1) different syntax (such as class default constructor with no arguments, the statement may be displayed; struct not show STATEMENT argument constructor).

              2) struct struct assignment of a copy, and the class is referenced.

              3) struct can not inherit exist, class can inherit a class

              4) struct defined properties can not be directly assigned to the constructor, but can class.

              5) struct destructor and no concept of what rewritable (because the absence of Inherited ah).

 

20. Expand the difference value and reference type
1, type typically assigned a value on the stack, which comprises a variable direct instance variables, relatively high efficiency.

2, reference types managed heap allocated, generally reference type contains a pointer instance variable pointer instance variable referenced by the pointer.

3, the value of the type inherited from ValueType (Note: The System.ValueType they inherited from System.Object); and reference types inherited from System.Object. 

4, the value of the type comprising a variable data examples, each variable holds its own data copy (copies), by default, the parameter value type is not passed

Parameters that affect itself; the reference type variable holds a reference to the address of its data, thus affecting the parameter itself when reference parameter passing, because the two variables refer to the same address of a memory. 

5, there are two types of values indicates: boxing and unboxing; reference type packing only one form. I will in the next section to specifically devoted to in-depth discussion of this topic. 

6, a typical value type: struct, enum, and a large number of built-in value type; and the like can be referred to as a reference type can be said. 

7, the value type of memory is not being GC (garbage collection, Gabage Collection) control, the end of the scope, value type release on their own, reducing the pressure of the managed heap,

It has a performance advantage. For example, struct usually more efficient than class; and reference types of garbage collection, done by the GC, Microsoft recommends that users even better not release the memory itself. 

8, the value type is sealed (Sealed), so the value types can not be used as any other type of base class, but can be a single or multiple inheritance Interface inheritance; reference types are generally inherited. 

9, the value of the type having no polymorphism; the reference type has the polymorphism. 

10, the value is not a null value variable type, value type itself are initialized to a zero value; the default reference type variable, create a null value, indicating no point

It refers to the address of any managed heap. Any operation is null reference types, will throw a NullReferenceException exception. 

11, the value type has two states: boxed and unboxed, the runtime provides all boxed value types form; reference types usually only one form: packing. 

21. Override and overload What is the difference?

  Override it comes to inheritance, overloading is the same method name, but different signatures

  Rewriting (override) refers to override keyword reimplement the virtual method in the base class, during operation, no matter which type by reference, the real object type method will be called.

  Overloads (overload) means a method of sharing a plurality of the same name and has a return value, but having different parameters.

  Hidden (new) refers to using new methods in the base class reimplemented in the process of running the type of method by which to determine the type of reference should be called.

 

 

22. How to understand the static variables?

  Static variables maintain only one class

  

  What in C # delegate is?

  A: A delegate is a type of method of reference. Once a delegate assignment method, the delegate behave exactly the method. Call the delegate method can be like

  Like any other method, with parameters and return values.

  A delegate is a function of the package, on behalf of a "class" function, they have to meet certain signature: have the same list of parameters, return type.

  Meanwhile, the commission can also be seen as an abstraction of the function, the "class" function. Examples of specific case represents a delegate function

 

     Three, ASP.NET & ADO.NET part *

 

23. You need to create an ASP.NET application, the company consider using Windows authentication.
All users AllWin exist in this field.
You want to use the following certification rules to configure the application:
? Anonymous users are not allowed to access the application.
? In addition to Tess and King all employees are allowed to access the application.
You should ask to configure the application to use which of the following code snippet? (B)
A. <Authorization>

<deny users=”allwin\tess, allwin\king”>

<allow users=”*”>

<deny users=”?”>

</authorization>

B.   <authorization>

<allow users=”*”>

<deny users=”allwin\tess, allwin\king”>

<deny users=”?”>

</authorization>

C.   <authorization>

<deny users=”allwin\tess, allwin\king”>

<deny users=”?”>

<allow users=”*”>

</authorization>

D.   <authorization>

<allow users=”allwin\tess, allwin\king”>

<allow users=”*”>

</authorization>

E.    <authorization>

<allow users=”*”>

<deny users=”allwin\tess, allwin\king”>

</authorization>

 

24. You want to create a display application list of employees of the company. You use a DataGrid control displays a list of employees. You intend to modify this control to display the total number of employees in the Footer of this Grid. May I ask how you should do? (C)
A. rewrite OnPreRender events show the total when the Footer Grid lines are created.
B. rewrite OnItemCreated events show the total when the Footer Grid lines are created.
C. rewrite OnItemDataBound events show the total when the Footer Grid lines are created.
D. rewrite OnLayout events show the total when the Footer Grid lines are created.

 

25. You want to create an ASP.NET application to run AllWin for internal company Web site, this application contains 50 pages. You want to configure the application so that it can display occurs when an HTTP error code for a custom error page to the user. You want to spend a minimum price accomplish these goals, how you should do? (Multiple choice) (AD)
A. In this process create a Application_Error Global.asax file of your application in ASP.NET code to handle errors.
B. Create a applicationError in this section Web.config file for the application in ASP.NET code to handle errors.
C. Create a CustomErrors event in the Global.asax file application to handle HTTP error.
D. Create a CustomErrors in this section Web.config file of the application to handle HTTP error.
E. Add a Page indicator of each page in the application's ASP.NET code to handle errors.
F. Add a Page indicator of each page in the application to handle the ASP.NET HTTP error.

 

26. Your company has a DB Server, called AllWin, which tops the MS SQLSERVER 2000. You now need to write a database connection string to connect AllWin SQL SERVER in a Test library named PubBase instance. I ask, should choose which one of the following string? (D)
A. "Server = AllWin; the Data = PubBase the Source; = the Initial Cataog the Test;
the Integrated Security = the SSPI"
B. "Server = AllWin; the Data = PubBase the Source; Database = the Test;
the Integrated Security = the SSPI"
C. "the Data = AllWin Source \ PubBase; Initial the Category = PubBase;
Integrated Security = SSPI "
D." AllWin the Data Source = \ PubBase; Database = the Test;
Integrated Security = SSPI "

 

27. You create an ASP.NET application to AllWin company. This application calls a
Xml Web Service. The Xml Web Service returns a DataSet object that contains a list of employees of the company. How would you use this program in the Xml Web Service? (B)

A. System.Web.Services.dll selected in the "reference" tag dialog .Net.
B. Enter the XML Web service address in the "Web Reference" dialog box.
C. Add a using statement in your Global.asax.cs and specify the XML Web service address.
D. write an event handler imports the Xml Web Service corresponding .wsdl and .disco files in your Global.asax.cs in.

 

28.    You want to create an ASP.NET application displays a sorted list of the DataGrid control. Product data is stored in a Microsoft SQL Server database named PubBase of. The primary key for each product is ProductID, Numeric product type and each letter has a description field called ProductName. You use a SqlDataAdapter object and a SqlCommand object to obtain product data from the database by calling a stored procedure. You will CommandType property SqlCommand object to CommandType.StoredProcedure, and set its CommandText property to procProductList. You successfully acquired a DataTable object, which is the product list is already sorted in descending order of ProductID. You want to show in reverse alphabetical order ProductName, how will this do? (B)
A. CommandType property SqlCommand object modify CommandType.Text, modify the CommandText property "SELECT * FROM procProductList ORDER BY ProductName DESC". Then the DataTable object bound to the DataGrid control.
B. Create a DataTable object based on the new DataView and set this property to the DataView Sort "ProductName DESC". The DataView object is then bound to the DataGrid control.
C. The AllowSorting property of the DataGrid control to True, and set the DataGridColumn SortExpression property to "ProductName DESC". To show ProductName. Then the DataTable object bound to the DataGrid control.
D. The DisplayExpression DataTable object property is "ORDER BY ProductName DESC" .. Then the DataTable object bound to the DataGrid control.

 

29. B system do with .net / S structure, with several layers of structure you are to develop the relationship between each layer and why this stratification?

  Multi-tier architecture question

 

Several ways to transfer values ​​between 30. ASP.NET pages?

    There querystring, cookie, session, server.transfer, application 5 ways

    [Extensions]

    1. Use QueryString way (or url by value, Response.Redirect by value), this is the easiest way, because the value passed in the url will be displayed in the browser, so the value is not used to convey safety requirements.

    Send page code:

    Response.Redirect("index.aspx?username="+txtUserName.Text.Trim());

    Receiving a page code:

     if(Request.QueryString["username"]!=null)

     {

         strUserName = Request.QueryString["username"];

     }

    2. Use cookie mode, cookie created by the server, but stored in the client

    Send page code:

     HttpCookie userName = new HttpCookie("username");

     userName.Value = this.txtUserName.Text.Trim();

     Response.Cookies.Add(userName);

     Response.Redirect("index.aspx");

    Receiving a page code:

     if (Request.Cookies["username"] != null)

     {

         strUserName = Request.Cookies["username"].Value;

     }

    3. Use Session variables, session when the issue was first created in the user request to the server, the server side, the termination (there are other session expiration) when the user closes the browser or an exception occurs.

    Send page code:

    Session["username"] = this.txtUserName.Text.trim();

    Response.Redirect("index.aspx");

    Receiving a page code:

     if (Session["username"] != null)

     {

         strUserName = Session["username"].ToString();

     }

    4. Application variables

    Send page code:

    Application["username"] = this.txtUserName.Text.trim();

    Response.Redirect("index.aspx");

    Receiving a page code:

    if (Application["username"] != null)

     {

         strUserName = Application["username"].ToString();

     }

    5. Use Server.Transfer mode (or mode HttpContext), variables to be transferred can be obtained by property or method, using attribute comparison easier.

    Send page to make a property:

     public string GetName

     {

        get { return this.txtUserName.Text.Trim(); }

    4 }

    Send page code:

    1 Server.Transfer("index.aspx");

    Receiving a page code:

    w = (WebForm4)Context.Handler;

    strUserName = w.GetName;

 

 

 

31. Microsoft launched a series of Application Block, please give what you know Application Block and explain its role?

   The more talk, the more clearly the better

 

 

 

32. Please name some of your excessive use of design patterns and the use of the model under what circumstances?

Singleton basis of comparison, the command mode, the factory pattern, strategy pattern should be clear

Guess you like

Origin www.cnblogs.com/gougou1981/p/12347048.html