. NET face question (II.)

Source: Internet
Author: User
Tags case statement closing tag finally block soap

1.. What is the difference between NET and C #

For:. NET generally refers to the. NET Framework framework, which is a platform, a technology.

C # is a programming language that can be based on. NET platform applications.

2. The rules for the number of columns are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ... The 30th digit is the number, which is realized by recursive algorithm.
Answer: public class MainClass
{
public static Voidmain ()
{
Console.WriteLine (Foo (30));
}
public static intfoo (int i)
{
if (i <= 0)
return 0;
else if (i > 0&& i <= 2)
return 1;
else return foo (i-1) + foo (i-2);
}
}

3. What is a delegate in C #? Is the event a delegate?
A: A delegate can substitute a method as a parameter into another method.
A delegate can be understood as a reference to a function.
Yes, it's a special kind of delegate.

4. Describe the access rights of private, protected, public, and internal modifiers.

A. Private: A private member that can be accessed within the class.

Protected: A protected member that can be accessed within the class and in the inheriting class.

Public: Common members, completely public, without access restrictions.

Internal: can be accessed within the same namespace.

5. The difference between override and overload

Answer: The difference between override and overload. Overloading is the same as the name of the method. parameter or parameter type is different, multiple

Secondary overloads to suit different needs

Override is an override of a function in a base class. In order to adapt to the need.

6. If you need to pass variable values in a B/s structure, but you cannot use session, Cookie, application, how many methods do you handle?
Answer: this. Server.Transfer

7. Please programmatically traverse all TextBox controls on the page and assign it a value of String.Empty?
For:
foreach (System.Windows.Forms.Control Control in this.) Controls)
{
If (Control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox TB = (System.Windows.Forms.TextBox) control;
Tb. Text = String.Empty;
}
}

8. Do you programmatically implement a bubbling sorting algorithm?
For:
int [] array = new int [*];
int temp = 0;
for (int i = 0; i < array. Length-1; i++)
{
for (int j = i + 1; j < Array. Length; J + +)
{
if (Array[j] < array[i])
{
temp = Array[i];
Array[i] = Array[j];
ARRAY[J] = temp;
}
}
}

9. Describe the implementation of indexers in C #, and can they only be indexed by numbers?
Answer: No. Any type can be used.

10. Ask for the value of the expression below and write down one or more of the implementations you think of: 1-2+3-4+......+m
For:
int Num = this. TextBox1.Text.ToString ();
int Sum = 0;
for (int i = 0; i < Num + 1; i++)
{
if ((i%2) = = 1)
{
Sum + = i;
}
Else
{
Sum = Sum-i;
}
}
System.Console.WriteLine (Sum.tostring ());
System.Console.ReadLine ();

11. In the following example
Using System;
Class A
{
Public A ()
{
Printfields ();
}
public virtual void Printfields () {}
}
Class B:a
{
int x=1;
int y;
Public B ()
{
Y=-1;
}
public override void Printfields ()
{
Console.WriteLine ("X={0},y={1}", X, y);
}
What output is generated when you use new B () to create an instance of B?
Answer: x=1,y=0;x= 1 Y = 1

What are the CTS, CLS, and CLR explanations for each?
A: CTS: a common language system. CLS: Common Language Specification. CLR: Common language runtime.

13. What are crates and unboxing?
A: Converting from a value type interface to a reference type boxing. Converting from a reference type to a value type unboxing.

14. What is a regulated code?
Answer: unsafe: Unmanaged code. Not run through the CLR.

15. What is a strongly typed system?

Answer: RTTI: type identification System.

What classes are needed to read and write databases in 16.NET? Their role?

Answer: DataSet: Data memory.

DataCommand: Executes the statement command.

DataAdapter: The collection of data, the term padding.

17. Lists several ways to pass values between ASP.
A. 1). Use querystring, such as ...? id=1; Response. Redirect () ....
2). Use the session variable
3). Use Server.Transfer

18. What is Code-behind technology?

A: Code after planting.

19. In. NET, what does the accessory mean?

Answer: Assembly. (intermediate language, source data, resources, assembly list)

20. What are the common methods of calling WebService?

Answer: 1. Use the WSDL.exe command-line tool.

2. Use the Add Web Reference menu option in Vs.net

How does 21..netRemoting work?

A: The server sends a process number to the client, a program field number to determine the location of the object.

22. In C #, string str = null with string str = "" Try to use text or diagrams as much as possible

As a description of the difference.

A: Stringstr = null is not to allocate memory space to him, while stringstr = "" Assigns it

The length is an empty string of memory space.

23. Please describe the similarities and differences between classes (class) and structure (struct) in dotnet.

A: Class can be instantiated, belongs to a reference type, is allocated on the heap of memory, struct belongs to the value class

is allocated on the stack of memory.

24. Complete the blanks by analyzing the following code

stringstrtmp = "ABCDEFG xxx";

Inti=system.text.encoding.default.getbytes (strtmp). Length;

Intj= strtmp.length;

After executing the above code, i= j=

Answer: i=13,j=10

In a 25.SQLSERVER server, there are two field IDs, Lastupdatedate, in a given table table1,

The ID represents the updated transaction number, and Lastupdatedate represents the server time when the update occurs, using one sentence

The SQL statement obtains the last updated transaction number

Answer: Selectid from table1 Where lastupdatedate = (Select MAX

(lastupdatedate) FROMTABLE1)

26. Briefly talk about your Microsoft. NET architecture, remoting and webservice two technologies

Applications in practice.

A: WS is primarily available with HTTP, penetrating firewalls. and remoting can use TCP/IP, binary

Increase efficiency.

27. The company requires the development of a component that inherits the System.Windows.Forms.ListView class, requiring

The following special features: When you click the column header of a ListView, you can rearrange the values by clicking on each row of columns

All rows in the diagram (in the same way as the DataGrid). Based on your knowledge, please briefly discuss your

Ideas

A: Depending on the column header of the click, the ID of the package is taken out, sorted by that ID, and then bound to the ListView.

28. Write an SQL statement: Take out the 31st to 40th record in table A (SQL Server to automatically grow the ID

As a primary key, note: The ID may not be contiguous.

Answer: Solution 1:select top * from A where ID not in (select Top ID froma)

Solution 2:select Top * from a Where ID > (select MAX (ID) from (SELECTTOP30 ID from a) as a)

29. Object-oriented language has ________, _________, ________

Answer: encapsulation, inheritance, polymorphism.

30. Objects that can be accessed with a foreach traversal need to implement the ________________ interface or declare the type of the ________________ method.

Answer: IEnumerable, GetEnumerator.

What is 31.GC? Why do you have a GC?

A: The GC is a garbage collector. Programmers do not have to worry about memory management, because the garbage collector automatically manages

Acting To request garbage collection, you can call one of the following methods:

System.GC ()

Runtime.getruntime (). GC ()

32.Strings = newstring ("xyz"), how many string Object has been created?

A: Two objects, one is "XyX", the other is a reference object pointing to "XyX" s.

33. Start a thread with run () or start ()?

A: Starting a thread is calling the start () method so that the virtual processor represented by the thread is in a running

This means that it can be dispatched and executed by the JVM. This does not mean that the thread will run immediately. Run ()

Method can produce a flag that must be exited to stop a thread.

34. Can interfaces be inherited by an interface? is an abstract class achievable (implements) interface? Whether an abstract class can

Inherit entity class (concrete Class)?

A: An interface can inherit an interface. Abstract classes can implement (implements) interfaces, whether abstract classes can inherit

Entity class, but only if the entity class must have an explicit constructor.

35. Can the constructor constructor be override?

A: The constructor constructor cannot be inherited, so overriding cannot be overridden, but can be overloaded

Overloading.

36. Can I inherit the String class?

A: The string class is the final class and cannot be inherited.

37.try{} has a return statement, the code in the finally {} immediately following the try

is not executed, when is it executed, before or after the return?

A: It executes and executes before return.

38. Two object values are the same (x.equals (y) = = true), but can have different hash code, this sentence

Words, right?

Answer: No, there is the same hash code.

Does 39.swtich work on a byte, can it function on a long, or does it work on a string?

Answer: in switch (EXPR1), expr1 is an integer expression. So pass to switch and

The arguments for the case statement should be int, short, char, or byte. Long,string are not

Can be used for Swtich.

40. When a thread enters a synchronized method on an object, does the other thread enter the

Other methods of the object?

No, an synchronized method of an object can only be accessed by one thread.

Whether the 41.abstract method can be static at the same time, whether it can be native at the same time, whether it can be

Synchronized?

Answer: No.

42.list,set, does the map inherit from the collection interface?

A: List,set is map is not

The elements in 43.Set cannot be duplicated, so what is the way to distinguish between duplicates or not? Is it used = = or

Equals ()? What is the difference between them?

A: The elements in set cannot be duplicated, so use the iterator () method to distinguish between duplicates or not.

Equals () is the interpretation of two sets for equality.

The Equals () and = = methods Determine whether the reference value points to the same object equals () is overridden in the class to

Returns the true value when the contents and type of the two detached objects match.

44. Does the array have the length () method? Does string have the length () method?

A: The array does not have the length () method and has the length property. String has length () This Side

Method.

What is the difference between 45.sleep () and wait ()?

A: The Sleep () method is the method that causes the thread to stop for a period of time. After the sleep time interval expires, the thread

Does not necessarily resume immediately. This is because at that point, other threads may be running and not being

Dispatched to abort execution unless (a) the "Wake Up" thread has a higher priority

(b) The running thread is blocked for other reasons.

When wait () is a thread interaction, if the thread issues a wait () call to a synchronization object x, the thread

Pauses execution, the object is moved into a wait state until it wakes up or waits.

46.shorts1 = 1; S1 =S1 + 1; what's wrong? Short S1 = 1; S1 + = 1; what's wrong?

?

Answer: shorts1 = 1; S1 = s1 + 1; error, S1 is short, s1+1 is int type, cannot be explicitly

into a short type. Can be modified to S1 = (short) (S1 + 1). Short S1 = 1; S1 + = 1 positive

Indeed

47. Talk about the difference between final,finally,finalize.

For:

final-modifier (keyword) If a class is declared final, it means that it can no longer derive a new

Subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared abstract and

The statement is final. Declaring variables or methods as final ensures that they are not changed in use.

A variable declared as final must be given an initial value at the time of declaration, and can only be read in a later reference, not

Modify. A method that is declared final can also be used only and cannot be overloaded

Finally-provides a finally block to perform any cleanup operations when the exception is processed. If you throw a different

Normally, the matching catch clause executes, and then the control enters the finally block (if

If any).

The finalize-method name. Java technology allows the use of the Finalize () method to object in the garbage collector

Do the necessary cleanup work before removing it from memory. This method is determined by the garbage collector in determining this

This object is called when the object is not referenced. It is defined in the Object class, so all

Class has inherited it. Subclass overrides the Finalize () method to organize system resources or perform other cleanup work

For The Finalize () method is called on the object before the object is deleted by the garbage collector.

48. How to handle hundreds of thousands of concurrent data?

A: Use a stored procedure or transaction. Update at the same time when the maximum identity is obtained. Note that the primary key is not a self-increment party

This method does not have duplicate primary keys when it is in parallel. Get the maximum identity a stored procedure is needed to

Get.

49.Session What are the major bugs that Microsoft has proposed to solve?

A: IIS because of the process recycling mechanism, the system is busy, the session will be lost, you can use Sate

server or SQL Server database storage session This is slow and cannot be

Captures the end event of the session.

50. What is the difference between a process and a thread?

A: The process is the system for resource allocation and scheduling units, the thread is the CPU scheduling and dispatch units, a

A process can have multiple threads that share the resources of this process.

51. What is the difference between heap and stack?

A: Stack: Automatically allocated and freed by the compiler. The variables defined in the function body are usually on the stack.

Heap: Typically freed by programmer allocations. Allocating memory functions such as new, malloc, and so on are

On

52. member variables and member functions before adding static function?

A: They are called constant member variables and constant member functions, also known as Class member variables and class member functions. Score of

Not to reflect the state of the class. For example, class member variables can be used to count the number of class instances, class member functions

Take charge of this statistic action.

53.ASP. NET compared with ASP, what is the main progress?

A: ASP interpretation form, aspx compiler type, performance improvement, is conducive to protect the source code.

54. Describe the methods used to pass parameters between pages in. NET and say their pros and cons.

Answer: Session (ViewState) simple, but easy to lose

Application Global

Cookies are simple, but may not be supported, may be forged

Inputttype= "hidden" is simple and may be forged

URL parameter is simple, display in the address bar, the length is limited

The database is stable and secure, but the performance is relatively weak

55. Please indicate what the GAC means?

Answer: The global assembly cache.

56. How many ways are there to send requests to the server?

Answer: Get,post. Get is generally linked, post is usually button mode.

What is the difference between 57.DataReader and dataset?

A: One is a forward-only read-only cursor, and one is a virtual database in memory.

58. How many stages does the software development process typically have? The role of each stage?

Answer: Requirements analysis, architecture design, code writing, QA, deployment

59. What is the meaning of the two keywords using and new in C #, please write the meaning you know? Using

Directive and statement new Create instance new hides the base class method.

A: Using introduces namespaces or uses unmanaged resources

New instance or hide parent method

60. You need to implement the processing of a string, first of all the string is removed, if the string

With contiguous spaces, only one space is allowed, that is, there are multiple spaces in the middle of the string, but a continuous empty

The number of cells cannot exceed one.

Answer: stringinputstr= "xx xx";

Inputstr=regex.replace (Inputstr.trim (), "*", "");

61. What is SQL injection and how do I prevent it? Please illustrate.

A: Use the SQL keyword to attack your site. Filter keywords ' etc

62. What is reflection?

Answer: Dynamically Get assembly information

63. How to write design patterns with Singleton

Answer: The static property inside new, constructor private

64. What is ApplicationPool?

A: Web apps, like the thread Pool, improve concurrency performance.

65. What is a virtual function? What is an abstract function?

A: virtual function: A function that is not implemented and can be inherited and overridden by a subclass. Abstract function: Specify its non-virtual

A subclass must implement a function that must be overridden.

66. What is XML?

Answer: XML expands Markup Language. Extensible Markup Language. Marks refer to what the computer can

Understanding of the information symbols, through this kind of marking, the computer can be processed with a variety of information, such as articles.

How to define these tags, that is, you can choose International markup language, such as HTML, you can also use the image

XML is a markup language that is freely determined by the relevant person, and that is the extensibility of the language. XML is from SGML

Simplify the changes. It mainly uses XML, XSL, XPath, and so on.

67. What is WebService? Uddi?

A: WebService is a network-based, distributed, modular component that performs specific tasks,

Compliance with specific technical specifications that enable Web service to interoperate with other compatible components.

The purpose of UDDI is to establish standards for e-commerce; UDDI is a web-based, distributed,

WebService provides a standard specification for the implementation of information registries, and also includes a set of standards that enable enterprises to

Self-provided Web service registrations to enable other enterprises to discover the implementation criteria of the Access Protocol.

68. What is a user control in ASP.

A: User controls are typically used in situations where the content is static or a little bit changed. The use of the relatively large. Class

Like include in ASP. But the features are much more powerful.

69. List the XML technologies you know and their applications

A: XML is used for configuration to hold static data types. The most exposed XML is Web Services. And

Config

What are the objects commonly used in 70.ado.net? Describe it separately.

Answer: Connection database Connection object

Command Database commands

DataReader Data reader

DataSet Data Set

71. What is Code-behind technology?

A: Aspx,resx and cs Three suffix files, this is code separation. Implements HTML code and services

Code separation. Facilitates code writing and collation.

72. What is soap and what are the applications?

A: Simpleobject access protocal, Simple Object Acceptance protocol. XML as the basic encoding structure

, based on existing communication protocols, such as HTTP, but it is said that MS is doing the lowest-level architecture on TCP/IP

SOAP) is a specification for the protocol used by WebService:

The difference between property and attribute in 73.c#, what are their uses, the benefits of this mechanism

Where is it?

A: A property, a field for accessing a class, an attribute that identifies a class, a method, etc., an additional

Properties

The main difference between 74.XML and HTML

Answer: 1. XML is case-sensitive, and HTML is not distinguished.

2. In HTML, if the context clearly shows where the paragraph or list key ends, you can

Omit end tags such as </p> or </li>. In XML, you must never omit the end tag.

3. In XML, an element that has a single tag without a matching closing tag must use one/character as the

End. This way the parser knows not to look for the end tag.

4. In XML, attribute values must be enclosed in quotation marks. In HTML, the quotation marks are available for use.

5. In HTML, you can have a property name without a value. In XML, all attributes must have a corresponding

The value.

What is the ternary operator in 75.c#?

For:? :。

76. When integer A is assigned to an object, the integer a will be

Answer: Boxing.

77. Does the class member have an accessible form of _____?

Answer: this.; Newclass (). Method;

78.publicstaticconst int a=1; Is this code wrong? What is it?

A: const cannot be modified with static.

The value of 79.floatf=-123.567f;int i= (int) f;i is now _____?

Answer:-123.

80. What is the keyword of the delegate declaration?

Answer: Delegate.

81. What are the characteristics of sealed-modified classes?

Answer: Sealed, cannot inherit.

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

Answer: Control.

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

Answer: [Serializable]

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

Answer: GC.

85. When the class T only declares a private instance constructor, it is outside the program text of T, ___ can be

The new class is derived from T with or not, and can not be created directly by ____ (or not).

Any instance.

A: No, it's not possible.

86. Is there an error in the following code?

switch (i) {

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

Casezero ();

Break

CASE1:

Caseone ();

Break

CASE2:

Dufault; A://wrong, the format is not correct

Casetwo ();

Break

}

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

Answer: Yes.

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

A: the. NET error handling mechanism uses the try->catch->finally structure, and when errors occur, the layers are thrown

Until a matching catch is found.

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

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

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

Answer: privatevoid form1_closing (object sender,

SYSTEM.COMPONENTMODEL.CANCELEVENTARGSE)

{

E.cancel=true;

}

91. In. NET (C # or vb.net), appplication.exit or form.close has what

Different?

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

92. A password using only K, L, M, N, o a total of 5 letters, the words in the password are arranged from left to right, dense

Code words 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

What's the total?

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

93.62-63=1 equation does not hold, move a number (you can not move the minus sign and equals sign), make

form, how to move?

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

The difference between property and attribute in 94.c#, what is their use, this mechanism is good

Where is it?

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

95. In C #, string str = null with string str = "" Try to use text or diagrams as much as possible

As a description of the difference.

A: null is not a spatial reference;

"" is a string with a space of 0;

What is the difference between 96.abstract class and interface?

A: A class that declares the existence of a method and does not implement it is called the extraction class (abstract class), which is used to create a class that embodies some basic behavior, declares a method for that class, but does not implement the class in that class. An instance of the abstract class cannot be created. However, you can create a variable whose type is a drawing class and point it to an instance of a specific subclass. You cannot have a smoke-like constructor or a static method of pumping. The subclasses of the Abstract class provide implementations for all the extraction methods in their parent class, otherwise they are also smoke-like classes. Instead, implement the method in the subclass. Other classes that know their behavior can implement these methods in the class.

Interface (interface) is a variant of the extraction class. In an interface, all methods are drawn. Multiple inheritance can be obtained by implementing such an interface. All the methods in the interface are drawn, none of them have a program body. An interface can only define static final member variables. The implementation of an interface is similar to a subclass, except that the implementation class cannot inherit the behavior from the interface definition. When a class implements a special interface, it defines the method (which is given by the program body) to all such interfaces. It can then invoke the interface on any image of the class that implements the interface. Because of the extraction class, it allows you to use the interface name as the type of the reference variable. The usual dynamic binder will take effect. A reference can be converted to an interface type or converted from an interface type, and the instanceof operator can be used to determine whether the class of an object implements an interface.

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

Answer:<%#%> represents the data source of the binding

<%%> is a server-side code block

98. 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 same

The relationship between methods in a class is a horizontal relationship

2, coverage can only be a method, or only a pair of methods to produce a relationship; the overload of a method is a method of multiple

The relationship between the two.

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

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

100.c# can the memory be directly manipulated?

A: Under. NET,. NET references the garbage collection (GC) feature, which replaces the programmer but in C #.

. NET face question (II.)

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.