Apply for. NET Development Engineer Common face question (iv)

Source: Internet
Author: User
Tags bitwise

1. All custom user controls that are in ASP. NET must inherit from ________?

Answer: Control.

2. All serializable classes in. NET are marked as _____?

Answer: [Serializable]

3. We don't have to worry about memory leaks in. NET managed code, because we have ___?

Answer: GC.

4. Are there any errors in the following code? _______

Using System;

Class A

{

public virtual void F () {

Console.WriteLine ("A.F");

}

}

Abstract class B:a

{

Public abstract override void F (); A: Abstract override is not to be modified together.

}//new public abstract void F ();

5. When the class T only declares the private instance constructor, then outside of the program text of T, ___ can derive a new class from T, either ___ (or not), and no instance of T can be created directly by ____ (or not).

A: No, it's not possible.

6. Is there an error in the following code?

switch (i) {

Case (): Answer://case () condition cannot be empty

Casezero ();

Break

Case 1:

Caseone ();

Break

Case 2:

Dufault; Answer://wrong, format is not correct

Casetwo ();

Break

}

7. In. NET, can a class System.Web.UI.Page be inherited?

Answer: Yes.

What is the error handling mechanism of 8..net?

A: the. NET error handling mechanism uses the try->catch->finally structure, and when an error occurs, it is thrown on the layer until a matching catch is found.

9. What is wrong with operator statement and only declaring = =?

A: Do you want to modify both Equale and Gethash ()? "=" must be overloaded with "! =" overloaded

10. In. NET (C # or vb.net), how the user customizes the message and processes the messages in the form.

Answer: Overload the Defwndproc function in the form to process the message:

protected override void Defwndproc (ref System.WinForms.Message m)

{

Switch (m.msg)

{

Case Wm_lbutton:

String differs from the use of the format function of CString in MFC

String message = String. Format ("Message received!" parameter: {0},{1} ", M.wparam,m.lparam);

MessageBox.Show (message);///Display a message box

Break

Case USER:

Code to process

Default

Base. Defwndproc (ref m);///Call the base class function to process a non-custom message.

Break

}

}

11. How to cancel the closing of a form in. NET (C # or vb.net).

Answer: private void Form1_Closing (object sender, System.ComponentModel.CancelEventArgs e)

{

E.cancel=true;

}

12. is appplication.exit or form.close different in. NET (C # or vb.net)? (WinForm topic Non-ASP.)

A: One is to exit the entire application and one is to close one of the form.

13. There is a double variable in C #, such as 10321.5, such as 122235401.21644, which is exported as the value of the currency according to the habits of the various countries. For example, the United States with $10,321.50 and $122,235,401.22 in the United Kingdom is £10 321.50 and £122 235 401.22

Answer: System.Globalization.CultureInfo myculture = new System.Globalization.CultureInfo ("en-us");

System.Globalization.CultureInfo myculture = new System.Globalization.CultureInfo ("EN-GB"), for UK currency type

Decimal y = 9999999999999999999999999999m;

String str = String.Format (myculture, "My amount = {0:c}", y);

14. A password uses only K, L, M, N, o a total of 5 letters, the words in the password are arranged from left to right, the password Word must follow the following rules:

(1) The minimum length of a password word is two letters, can be the same, can also be different

(2) K cannot be the first letter of a word

(3) If L appears, the number of occurrences occurs more than once

(4) m cannot make the last one or the second-lowest letter

(5) k appears, then n must appear

(6) O if it is the last letter, L must appear

Question one: Which of the following letters can be placed behind O in the Lo to form a 3-letter password word?

A) K B) L C) M D) N

Answer: B

Question two: If you can get the letter is K, L, M, then can form a two-letter long password word number of how many?

A) 1 B) 3 C) 6 D) 9

Answer: A

Question three: Which of the following is the word password?

A) Klln B) loml C) Mllo D) Nmko

Answer: C

8.62-63=1 equation does not hold, please move a number (can not move minus and equal sign), so that the equation is set up, how to move?

Answer: 62 moved to 2 of the 6-time Square

15. For one of these enumeration types:

Enum Color:byte

{

Red,

Green,

Blue,

Orange

}

Answer: string[] Ss=enum.getnames (typeof (Color));

Byte[] Bb=enum.getvalues (typeof (Color));

What is the difference between property and attribute in C #, and what are the benefits of such a mechanism?

A: attribute: The base class for custom attributes; property: Properties in a class

17.c# can the memory be directly manipulated?

A: Under. NET,. NET references the garbage collection (GC) feature, which replaces the programmer however, in C #, you cannot directly implement the Finalize method, but instead call the base class's Finalize () method in a destructor

18.ADO. What are some of the major improvements in net versus ADO?

A: 1:ado.net does not rely on OLE DB providers, but instead uses. NET managed programs, 2: Do not use COM3: Do not support dynamic cursors and server-side Tour 4:, you can disconnect connection and keep the current dataset available 5: Strongly type conversion 6:xml support

19. Write an HTML page, to achieve the following functions, left click on the page to display "Hello", right click on the display "No right button." and automatically closes the page after 2 minutes.

Answer: <script language=javascript>

SetTimeout (' Window.close (); ', 3000);

Function Show ()

{

if (Window.event.button = = 1)

{

Alert ("left");

}

else if (Window.event.button = = 2)

{

Alert ("right");

}

}

</script>

20. Probably describe the ASP. NET server control's life cycle

A: Initialize load view state processing postback data load send postback change notification handle postback event pre-render save state rendering disposition Uninstall

21.Anonymous Inner Class (anonymous inner Class) can extends (inherit) other classes, is it possible to implements (implement) interface (interface)?

Answer: No, interface can be implemented

22.Static Nested class and Inner class, the more you say the better

A: The static Nested class is an inner class that is declared static (static), and it can be instantiated without relying on an external class instance. The usual inner classes need to be instantiated after the external class is instanced.

The difference between 23.,& and &&.

& is a bitwise operator that represents the bitwise AND Operation,&& is a logical operator that represents the logical and (and).

The difference between 24.HashMap and Hashtable.

A: HashMap is a lightweight implementation of Hashtable (non-thread-safe implementation), they all complete the map interface, the main difference is that the HASHMAP allows null (NULL) key value (key), because of non-thread security, the efficiency may be higher than Hashtable.

25.short S1 = 1; S1 = s1 + 1; what's wrong? Short S1 = 1; S1 + = 1; what's wrong?

Answer: short S1 = 1; S1 = s1 + 1; (S1+1 operation result is int type, need cast type)

Short S1 = 1; S1 + = 1; (can be compiled correctly)

Can the 26.Overloaded method change the type of the return value?

A: The overloaded method is to change the type of the return value.

What is the difference between 27.error and exception?

A: Error indicates a serious problem in situations where recovery is not impossible but difficult. For example, memory overflow. It is impossible to expect the program to handle such situations.

Exception represents a design or implementation issue. That is, it means that if the program runs normally, it never happens.

What is the difference between 28.<%#%> and <%%>?

A: <%#%> represents a bound data source

<%%> is a server-side code block

29. What do you think is the biggest difference between ASP. 2.0 (VS2005) and the development tools (. NET 1.0 or other) you used before? What development ideas (pattern/architecture) you used on the previous platform can be ported to ASP. NET 2.0 (or already embedded in ASP. NET 2.0)

A: 1 ASP. 2.0 has packaged some of the code, so it's a lot less code than 1.0 of the same functionality.

2 supports both code separation and page embedding server-side code in two modes, formerly 1.0 versions. NET hints help only in separating the code files, unable to get help tips in the page embedding server-side code,

3 when switching between code and design interface, 2.0 supports cursor positioning. I like it better.

4 in the binding data, make the table pagination. Update,delete, such as operation can be visualized operation, convenient for beginners

5 added more than 40 new controls in ASP, reducing workload

30. What is the difference between overloading and overwriting?

A: 1, the method's coverage is the relationship between the subclass and the parent class, is the vertical relationship, the overload of the method is the relationship between the methods in the same class, and is the horizontal relationship

2. Overrides can only be made by one method, or only by a pair of methods; an overload of a method is a relationship between multiple methods.

3. The override requires the same parameter list, and the overload requires the parameter list to be different.

4, in the coverage relationship, call that method body, is based on the object type (object corresponding to the storage space type) to determine, overload relationship, is based on the invocation of the argument table and formal parameter list to select the method body.

Apply for. NET Development Engineer Common face question (iv)

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.