1. Briefly describe the access rights of private, protected, public and internal modifiers.
A:
Private: Private member, which can only be accessed inside the class.
Protected: protects members that can be accessed within a class and in inherited classes.
Public: a member of the public, completely open and without access restrictions.
Internal: Accessible within the same namespace.
2. List several ways to pass values between ASP.NET pages.
A:
(1) use QueryString, for example ...? id = 1; Response. Redirect () ....
(2) Using session variables
(3) Use the server. transfer
3. The numbering rules of a column are as follows: 1, 1, 2, 3, 5, 8, 13, 2 1, 34 ... Find the 30th place and use recursive algorithm to realize it.
A:
Common class MainClass
{
Public static void Main ()
{
Console. WriteLine(Foo(30));
}
Public static int Foo(int i)
{
If (I < = 0)
Returns 0;
else if(I & gt; 0&I<= 2)
Returns1;
Otherwise, return foo (I-1)+foo (I-2);
}
}
4. What is the delegation in 4.C #? Is an event a delegation?
A: Delegates can substitute one method as a parameter into another. A delegate can be understood as a reference to a function. An event is a special kind of delegation.
5. The difference between rewriting and overloading
A:
The difference between overriding and overloading is that methods have the same name. Parameters or parameter types are different, and they are overloaded many times to meet different requirements.
Rewriting is rewriting a function in a base class. In order to meet the needs.
6. If you need to pass variable values in a system with B/S structure, but you can't use Session, Cookie and Application, how can you handle it?
A: This. Server. Transmission
7. Please programmatically traverse all TextBox controls on the page and assign them as strings. Empty?
A:
Foreach (system. Windows.Forms.Control control. Control)
{
If (control is the system. Windows.Forms.TextBox)
{
System. windows . forms . textbox TB =(System。 Windows.Forms.TextBox) control;
Tuberculosis. Text = string. Empty;
}
}
8. Please program and implement a bubble sorting algorithm?
A:
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]& lt; Array [i])
{
temp = array[I];
array[I]= array[j];
array[j]= temp;
}
}
}
9. Describe the implementation process of indexer in C#. Is it possible to index only by numbers?
No. Any type will do.
10. Find the value of the following expression and write one or more realization methods you think of:1-2+3-4+...+m.
A:
Int Num = this text box 1. text . ToString();
int Sum = 0;
for(int I = 0; I< num+1; i++)
{
if ((i % 2) == 1)
{
sum+= I;
}
other
{
Sum = Sum-I;
}
}
System. Console.WriteLine(Sum。 ToString());
System. console . ReadLine();
1 1. Net as a B/S structure system, how many layers are you developing? What does each layer have to do with it? Why should it be layered like this?
A: Generally, it is the third floor. Data access layer, business layer and presentation layer. The data access layer adds, deletes, checks and modifies databases. The business layer is generally divided into two layers, the business appearance layer realizes the communication with the presentation layer, and the business rule layer realizes the security of user passwords. In order to interact with users, such as users adding forms, presentation layer.
Advantages: clear division of labor, clear organization, easy debugging and strong expansibility.
Disadvantages: Increased cost.
12. In the following example
Use the system;
Level a
{
Public a ()
{
print field();
}
Public virtual void PrintFields ()
{
}
}
Class B: Class A.
{
int x = 1;
int y;
Public b ()
{
y =- 1;
}
Public overlay void PrintFields ()
{
Console. WriteLine("x={0},y={ 1} ",x,y);
}
}
What is the output when creating an instance of b using new B ()?
A: X= 1, Y = 0;; x= 1 y=- 1
What is an application domain?
A: The application field can be understood as a lightweight process. Play a safe role. And occupies less resources.
What are the explanations of 14? Are China Travel Service, CLS and CLR?
A: CTS: Universal Language System. CLS: common language specification. Common language runtime.
15. What is packaging and unpacking?
A: Packing from value type interface to reference type. Unbox from reference type to value type.
What is controlled code?
A: Unsafe: unmanaged code. Run without CLR.
17. What is a strongly typed system?
A: RTTI: Model identification system.
18 What classes are needed to read and write the database? . Net? What are their roles?
A: Data set: data storage.
DataCommand: execute the statement command.
DataAdapter: a collection of data full of terms.
What are the authentication methods of 19.ASP.net? What is the principle?
A: 10. Windwos (default) uses IIS ... from (form) account ... passport (key).
20. What is code hiding technology?
A: The code is embedded.
2 1. inch net, what do you mean by accessories?
A: Assembly. (Intermediate language, source data, resources, assembly list)
22. 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.
What is the working principle of 23.23? . net Remoting?
A: The server sends a process number and a program domain number to the client to determine the location of the object.
24. In c #, string str = null and string str = ""Please try to use words or images to illustrate the difference.
Answer: string str = null means that he is not allocated memory space, string str = ""allocates memory space, and the string length is empty.
25. Please elaborate on the similarities and differences between classes and structures in dotnet?
Answer: Class can be instantiated, belonging to reference type and allocated on the memory heap, while Structure belongs to value type and allocated on the memory heap.
(1), the structure is a value type;
(2) The structure does not support inheritance;
(3) A structure cannot define a default constructor;
(4) Structures cannot define destructors;
(5) The structure cannot use the initial value to set the domain value.
26. According to delegate's knowledge, please fill in the following code snippet in the user control:
Namespace test
{
Public delegate void ondboperate ();
Public class UserControlBase: System. Windows. forms.usercontrol
{
OnDBOperate OnNew public activities;
privatevidtoolbar _ button click(object sender,System。 windows . forms . toolbar button click eventargs e)
{
if(e.Button.Equals(BtnNew))
{
//Please complete the OnNew event that the code uses to call the following OnDBOperate delegate signature.
}
}
}
}
A: If (OnNew! = null ) OnNew(this,e);
27. Analyze the following code and complete the blanks.
String strTmp = " abcdefg XXX
Int i= system. text . encoding . default . getbytes(strTmp)。 Length;
int j= strTmp。 Length;
After the above code is executed, I = _ _ _ _ _ _ _ j = _ _ _ _ _ _ _ _
A: i= 13 and j= 10.
28. In the SQL Server server, there are two fields ID and LastUpdateDate in the given table table 1, where ID represents the updated transaction number and LastUpdateDate represents the server time at the time of update. Please use SQL statement to get the latest transaction number.
Answer: Select the id from the table 1, where the last update date = (select max from the table 1).
29. According to the knowledge of thread safety, analyze the following code. When calling the test method, I >;; Will 10 cause a deadlock? And briefly explain the reasons.
Public invalidation test (int i)
{
Lock (this)
{
If (i> 10)
{
I-;
Test (1);
}
}
}
A: There will be no deadlock, (but one thing is that int is a value-passing, so only one copy is changed at a time, so there will be no deadlock. But if you replace int with an object, there will be a deadlock)
30. briefly talk about your understanding of remoting and webservice under the framework of Microsoft. NET and its practical application.
A: WS can mainly use HTTP to penetrate the firewall. Remote processing can use TCP/IP and binary transmission to improve efficiency.
3 1. The company needs to develop a component of the inheritance system. Windows.Forms.ListView, which requires the following special functions: when clicking the column header of ListView, all rows in the view can be rearranged according to the value of each row of the clicked column (the sorting method is similar to DataGrid). According to your knowledge, please briefly talk about your ideas.
A: According to the clicked column title, take out the column ID, sort it by ID, and then bind it to ListView.
32. Given the following XML file, complete the algorithm flow chart.
& lt file system & gt
& ltDriverC & gt
& ltDir DirName="MSDOS622 " >
& ltFile FileName = " Command.com " & gt& lt/File & gt;
& lt/Dir & gt;
& ltFile FileName ="MSDOS。 SYS " & gt& lt/File & gt;
& ltFile FileName ="IO。 SYS " & gt& lt/File & gt;
& lt/DriverC & gt;
& lt/file system & gt;
Please draw a flowchart to traverse all file names (please use recursive algorithm).
A:
Void FindFile (directory d)
{
FileOrFolders = d . GetFileOrFolders();
Foreach (file folder fof in file folder)
{
If (fof is a file)
You found a file;
Else if (fof is a directory)
FindFile(fof);
}
}
33. Write an Sql statement: take out 3 1 to 40 records in Table A (SQLServer, with the automatically growing ID as the primary key, note: the ID is not necessarily continuous.
A: Solution 1: Select top 10 * from A with no id (select top 30 id from A).
Solution 2: select top10 * from a where id >; (Select the largest id from (choose the top 30 IDs from A) as A)
34. The object-oriented language is _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _.
A: encapsulation, inheritance and polymorphism.
35.foreach traversal of accessible objects needs to implement the _ _ _ _ _ _ _ interface or declare the type of _ _ _ _ _ _.
A: IEnumerable, GetEnumerator.
36. What is GC? Why is there GC?
A: GC is a garbage collector. Programmers don't have to worry about memory management because the garbage collector will manage it automatically. To request garbage collection, you can call one of the following methods: system.gc () runtime.getruntime (). gc()。
37.String s = new string ("XYZ"); How many stringobjects have been created?
A: There are two objects, one is "xyx" and the other is the reference object S pointing to "xyx".
38. What's the difference between abstract classes and interfaces?
A:
A class that declares the existence of a method without implementing it is called an abstract class. It is used when you want to create a class that embodies some basic behaviors and declare a method for this class, but you can't implement this class in this class. You cannot create an instance of an abstract class. However, you can create a variable of abstract class and point it to an instance of a concrete subclass. You cannot have abstract constructors or abstract static methods. Subclasses of abstract classes provide implementations for all abstract methods in their parent classes, otherwise they are abstract classes. Instead, implement this method in subclasses. Other classes that know their behavior can implement these methods in the class.
Interfaces are variants of abstract classes. In an interface, all methods are abstract. Multiple inheritance can be obtained by implementing such an interface. All methods in the interface are abstract, and they have no program body. Interfaces can only define static final member variables. The implementation of an interface is similar to that of a subclass, except that the implementation class cannot inherit behavior from the interface definition. When a class implements a special interface, it defines (that is, gives the program body) the methods of all such interfaces. It can then call the methods of the interface on any object of the class that implements the interface. Because of the abstract class, it allows the use of interface names as the type of reference variables. The usual dynamic binding will take effect. References can be converted to and from interface types, and the instanceof operator can be used to determine whether an object's class implements an interface.
39. start a thread with run () or start ()?
Answer: To start a thread is to call the start () method, so that the virtual processor represented by the thread can be run, that is, it can be scheduled and executed by the JVM. This does not mean that the thread will run immediately. The run () method can stop the thread by generating a flag that must exit.
40. Can an interface inherit from an interface? Can abstract classes implement interfaces? Can abstract classes inherit concrete classes?
A: Interfaces can inherit from interfaces. An abstract class can implement an interface, whether it can inherit an entity class or not, but only if the entity class has an explicit constructor.
Can the 4 1. constructor be rewritten?
A: The constructor cannot be inherited, so it cannot be overridden, but it can be overloaded.
42. Can you inherit the String class?
Answer: String class is final class, so it cannot be inherited.
43. There is a return statement in try {}, so will the code in finally {} immediately after try be executed, when, before or after return?
Yes, before coming back.
44. Two objects have the same value (x.equals(y) == true), but they can have different hash codes. Is this correct?
A: No, they have the same hash code.
45. can 45.swtich act on byte, long and String?
A: In switch(expr 1), expr 1 is an integer expression. So the parameters passed to switch and case statements should be int, short, char or byte. The rope can neither be long nor short.
47. When a thread enters the synchronization method of an object, can other threads enter other methods of the object?
No, the synchronization method of an object can only be accessed by one thread.
48. Can abstract methods be static, native and synchronous at the same time?
A: Neither.
49. Do lists, sets and mappings inherit from the collection interface?
List, collection is a map, isn't it?
50. Elements in a set cannot be repeated, so what method can be used to distinguish whether they are repeated? Is it = = or equal to ()? What's the difference between them?
Answer: The elements in the collection cannot be duplicated, so the iterator () method is used to distinguish whether they are duplicated. Equals () is to determine whether two sets are equal.
The equals () and = = methods determine whether the reference value points to the same object. Equals () is overridden in the class to return a true value when the contents and types of two independent objects match.
Is there a length () method for the 5 1. array? Does String have a length () method?
A: The array has no method length (), but it has an attribute length. The method length of the string is ().
52. What is the difference between 52.sleep () and wait ()?
A: The sleep () method is a way to stop a thread for a period of time. After the sleep interval expires, the thread may not resume execution immediately. This is because at that moment, other threads may be running and not scheduled to give up execution unless (a) the "wake-up" thread has a higher priority.
(b) The running thread is blocked for other reasons.
Wait () is a thread interaction. If a thread calls a synchronization object X, the thread will suspend execution and the called object will enter a waiting state until it is awakened or the waiting time is up.
54. Tell me about the difference between final, finally and finalize.
A:
Final-Modifier (keyword) If a class is declared as Final, it means that it can no longer derive new subclasses or inherit as a parent class. Therefore, a class cannot be declared abstract and final at the same time. Declaring variables or methods as final ensures that they will not be changed in use. Variables declared as final must be given an initial value at the time of declaration, and can only be read and cannot be modified in future references. Methods declared as final can only be used and cannot be overloaded.
Finally— Provides a finally block to perform any cleanup operations during exception handling. If an exception is thrown, the matching catch clause will be executed, and then control will enter the finally block (if any).
Done-Method name. Java technology allows you to use the finalize () method to clean up the objects before the garbage collector clears them from memory. The garbage collector calls this method when it is determined that the object is not referenced. It is defined in the Object class, so all classes inherit it. Subclasses override the finalize () method to organize system resources or perform other cleanup tasks. The finalize () method is called on the object before it is deleted by the garbage collector.
55. How to deal with hundreds of thousands of concurrent data?
A: Use stored procedures or transactions. Update while getting the maximum ID .. Please note that the primary key is not self-incremental. When this method is concurrent, there will be no duplicate primary keys ... To get the maximum ID, you need a stored procedure to get it.
56. What are the main bugs in Session, and what methods does Microsoft propose to solve them?
A: Due to the process recycling mechanism in iis, if the system is busy, the session will be lost. You can store the session in the form of a state server or a SQL Server database, but this method is slow and cannot capture the end event of the session.
57. What is the difference between a process and a thread?
A: The process is the unit that the system allocates and schedules resources. Thread is the unit of CPU scheduling and dispatching. A process can have multiple threads, and these threads * * * enjoy the resources of this process. Both threads and processes define some kind of boundary, but the difference is that the process defines the boundary between applications, and different processes cannot * * * enjoy the code and data space, while the thread defines the boundary between the code execution stack and the execution context. A process can contain several threads, and creating multiple threads to complete a task at the same time is multithreading. Different threads in the same process share code and data space. For example, if a family represents a process, within the family, every member is a thread, and every family member has the obligation to accumulate family wealth and the right to consume it. When faced with a task, the family can also send several members to cooperate, and people outside the family can't directly consume property that doesn't belong to their own family.
58. What is the difference between a heap and a stack?
A: stack: automatically allocated and released by the compiler. Variables defined in the function body are usually on the stack.
Heap: generally allocated and released by programmers. Memory allocated using new, malloc and other memory allocation functions is in the heap.
59. What is the function of adding static before member variables and member functions?
Answer: They are called constant member variables and constant member functions respectively, and also called class member variables and class member functions. Used to reflect the state of the class. For example, class member variables can be used to count the number of class instances, and class member functions are responsible for this statistical operation.
60. Compared with ASP, what are the main improvements in ASP.NET?
Answer: asp interpretation form and aspx compilation type improve performance and help protect source code.