0. What is object-oriented
Object-oriented oo = Object-Oriented Analysis OOA + object-oriented design Ood + Object-Oriented Programming OOP;
The general interpretation is that everything is an object, and all things are considered as independent objects (units). They can complete their own functions, rather than dividing them into functions like C;
The pure OO language is mainly Java and C #. c ++ also supports Oo, and C is process-oriented;
1. Briefly describe the access permissions of private, protected, public, and internal modifiers.
A. Private: Private Members can be accessed within the class.
Protected: protects members, which can be accessed within the class and in the inheritance class.
Public: A Public member. It is completely public and has no access restrictions.
Internal: accessible within the same namespace.
2. List several methods for passing values between ASP. NET pages.
Answer. 1. Use querystring, such ....? Id = 1; response. Redirect ()....
2. Use session Variables
3. Use server. Transfer
3. The rule for a column is as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ...... calculate the number of digits 30th, and use recursion. Algorithm .
A: public class mainclass
{
Public static void main ()
{
Console. writeline (FOO (30 ));
}
Public static int Foo (int I)
{
If (I <= 0)
Return 0;
Else if (I> 0 & I <= 2)
Return 1;
Else return Foo (I-1) + Foo (I-2 );
}
}
4. What is the delegate in C? Is an 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 is a special delegate
5. Differences between override and overload
A:
The difference between override and overload. Overload means that the method name is the same. The parameters or parameter types are different and are reloaded multiple times to meet different needs.
Override is used to override functions in the base class. To meet your needs.
6. If you need to pass variable values in a B/S system, but you cannot use session, cookie, and application, how can you handle them?
A:
This. server. Transfer
7. programmatically traverse all textbox controls on the page and assign it a string. Empty?
A:
Foreach (system. Windows. Forms. 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. How can I program 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] <array)
{
Temp = array;
Array = array [J];
Array [J] = temp;
}
}
}
9. To describe the implementation process of the indexer in C #, can it be indexed only by numbers?
A: No. Any type can be used.
10. Evaluate the values of the following expressions and write out one or more implementation methods: 1-2 + 3-4 + ...... + M
A:
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. Use. Net for B/S structure. How many layers of structure do you use for development? What is the relationship between each layer and why do you need to layer it like this?
A: Generally, it is three layers.
Data access layer, business layer, and presentation layer.
The data access layer adds, queries, and modifies databases.
The business layer is generally divided into two layers. The business apparent layer communicates with the presentation layer, and the business rule layer Implements user password security.
The presentation layer adds a form to interact with users, for example, users.
Advantages: clear division of labor, clear organization, easy debugging, and scalability.
Disadvantage: increase costs.
12. In the following example
Using system;
Class
{
Public ()
{
Printfields ();
}
Public Virtual void printfields (){}
}
Class B:
{
Int x = 1;
Int y;
Public B ()
{
Y =-1;
}
Public override void printfields ()
{
Console. writeline ("x = {0}, y = {1}", x, y );
}
What is the output when new B () is used to create B's instance?
Answer: x = 1, y = 0; X = 1 y =-1
13. What is an application? Program Domain?
A: The application domain can be considered as a lightweight process. Security. Small resource occupation.
14. What are the explanations of CTS, CLS, and CLR?
A: CTS: a general-purpose language system. CLS: general language specification. CLR: Common Language Runtime Library.
15. What is packing and unpacking?
A: From the value type interface to the Reference Type Packing. Converts a reference type to a value type Unbox.
16. What is regulated? Code ?
A: unsafe: unmanaged code. Does not run through CLR.
17. What is a strong system?
A: rtti: The type recognition system.
Which classes are required for reading and writing databases in 18.net? What are their roles?
Answer: Dataset: data storage.
Datacommand: Execute the statement command.
Dataadapter: a collection of data.
What are the authentication methods for 19.asp.net? What are their principles?
Answer: 10. Windwos (default) Iis... from (form) account... passport (key)
20. What is code-behind technology?
A: Code post-planting.
21. In. net, what does the accessory mean?
A: assembly. (Intermediate language, source data, resources, assembly list)
22. What are common WebService call methods?
A: 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..net remoting?
A: the server sends a process number and a program domain number to the client to determine the object location.
24. In C #, use text or images to describe the differences between string STR = NULL and string STR =.
A: String STR = NULL indicates that no memory space is allocated to it, while string STR = "" indicates that it is allocated with a memory space of a null string.
25. What are the similarities and differences between classes and struct in DOTNET?
A: The class can be instantiated. It belongs to the reference type and is allocated to the memory stack. struct belongs to the value type and is allocated to the memory stack.
26. Based on the delegate knowledge, complete the following code snippets in the user control:
Namespace Test
{
Public Delegate void ondboperate ();
Public class usercontrolbase: system. Windows. Forms. usercontrol
{
Public event ondboperate onnew;
Privatevoidtoolbar_buttonclick (objectsender, system. Windows. Forms. toolbarbuttonclickeventargs E)
{
If (E. Button. Equals (btnnew ))
{
// Complete the following code to call the onnew event of the ondboperate delegate signature.
}
}
}
A: If (onnew! = NULL)
Onnew (this, e );
27. Analyze the following code to complete filling
String strtmp = "abcdefg ";
Int I = system. Text. encoding. Default. getbytes (strtmp). length;
Int J = strtmp. length;
After the above code is executed, I = J =
Answer: I = 13, j = 10
28. in the sqlserver server, the given table Table1 contains two field IDs and lastupdatedate. ID indicates the updated transaction number, and lastupdatedate indicates the server time when the update is performed, use an SQL statement to obtain the last updated transaction number.
A: Select ID from Table1 where lastupdatedate = (select max (lastupdatedate) from Table1)
29. Based on the knowledge of thread security, analyze the following code. Will the deadlock occur when I> 10 is called when the test method is called? And briefly explain the reasons.
Public void test (int I)
{
Lock (this)
{
If (I> 10)
{
I --;
Test (I );
}
}
}
A: No deadlock will occur (but one int is passed by value, so each change is only a copy, so no deadlock will occur. But if you replace int with an object, the deadlock will occur)
30. Briefly discuss your understanding of the remoting and WebService technologies under the Microsoft. NET architecture and their practical applications.
A: Ws uses http to penetrate the firewall. Remoting can improve the efficiency by using TCP/IP and binary transmission.
31. the company requires the development of an inherited system. windows. forms. listview components require the following special features: When you click the headers of columns in the listview, all rows in the view can be rearranged based on the values of each row in the click column (the sorting method is similar to that in the DataGrid ). Based on your knowledge, please briefly discuss your ideas
A: Based on the column header that you click, the ID of this column is taken out, sorted by this ID, and bound to listview.
32. Specify the following XML file to complete the algorithm flow chart.
<Filesystem>
<Driverc>
<Dir dirname = "msdos622">
<File filename = "command.com"> </File>
</Dir>
<File filename = "msdos. sys"> </File>
<File filename = "Io. sys"> </File>
</Driverc>
</Filesystem>
Draw a flowchart that traverses all file names (filename) (use recursive algorithms ).
A:
Void findfile (Directory D)
{
Fileorfolders = D. getfileorfolders ();
Foreach (fileorfolder fof in fileorfolders)
{
If (FoF is file)
You found a file;
Else if (FoF is directory)
Findfile (FoF );
}
}
33. Write an SQL statement: extract the 31st to 40th records in Table A (sqlserver, with an automatically increasing ID as the primary key, note: the ID may not be continuous.
Answer: solution 1: Select top 10 * from a where id not in (select top 30 ID from)
Solution 2: Select top 10 * from a where ID> (select max (ID) from (select top 30 ID from a) as)
34. object-oriented languages include ________, _________, and ________.
A: encapsulation, inheritance, and polymorphism.
35. To use foreach to traverse the accessed object, you need to implement the ____________ interface or the type of the declared ________________ method.
A: ienumerable and getenumerator.
36. What is GC? Why does GC exist?
A: GC is a garbage collector. Programmers do not have to worry about memory management, because the Garbage Collector will automatically manage. 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 string objects are created?
A: There are two objects, one being "xyx" and the other being the reference object s pointing to "xyx.
38. What is the difference between abstract class and interface?
A:
The class that declares a method rather than implementing it is called abstract class. It is used to create a class that reflects some basic behaviors and declare a method for this class, however, this class cannot be implemented in this class. You cannot create an abstract instance. However, you can create a variable whose type is an abstract class and point it to an instance of a specific subclass. Abstract constructors or abstract static methods are not allowed. The subclasses of abstract classes provide implementation for all abstract methods in their parent classes. Otherwise, they are also abstract classes. Instead, implement this method in the subclass. Other classes that know their behavior can implement these methods in the class.
An interface is a variant of an abstract class. All methods in the interface are abstract. Multi-inheritance can be achieved by implementing such an interface. All methods in the interface are abstract, and none of them have a program body. The interface 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 behaviors from the interface definition. When a class implements a special interface, it defines (to be given by the program body) all the methods of this interface. Then, it can call the interface method on any object that implements the interface class. Because there is an abstract class, it allows the interface name as the type of the referenced variable. Normally, dynamic Association editing will take effect. The reference can be converted to the interface type or from the interface type. The instanceof operator can be used to determine whether the class of an object implements the interface.
39. Do I use run () or start () to start a thread ()?
A: To start a thread is to call the START () method so that the virtual processor represented by the thread is runable, which means it can be scheduled and executed by JVM. This does not mean that the thread will run immediately. The run () method can generate the exit sign to stop a thread.
40. Can an interface inherit the interface? Can an abstract class implement the (implements) interface? Can an abstract class inherit a concrete class )?
A: The interface can inherit the interface. Abstract classes can be implemented (implements) interfaces, and whether abstract classes can inherit object classes, provided that object classes must have clear constructors.
41. Can constructor be overwritten?
A: constructor cannot be inherited, so overriding cannot be overwritten, but overloading can be overloaded.
42. Can I inherit the string class?
A: The string class is a final class, so it cannot be inherited.
43. If there is a return statement in try {}, will the code in finally {} following this try be executed? When will it be executed, before or after return?
A: Yes. It will be executed before return.
44. The two objects have the same value (X. Equals (y) = true), but different hash codes are available, right?
A: No, yes