130 ASP. NET interview questions

Source: Internet
Author: User

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 variable 3. use Server. transfer 3. the rules for a column are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ...... calculate the number of 30th digits and use a recursive algorithm. A: public class MainClass {public static void Main () {Console. writeLine (Foo (30);} public static int Foo (int I) {if (I <= 0) return 0; what is the delegate in else if (I> 0 & I <= 2) return 1; else return Foo (I-1) + Foo (I-2) ;}} 4.C? Is an event a delegate? A: A delegate can substitute a method as a parameter to another method. A delegate can be understood as a reference to a function. Yes, it is a special delegate. 5. What is the difference between override and overload? A: What is the difference between override and overload. Overload means that the method name is the same. Parameters or parameters of different types are reloaded multiple times to meet different requirements. 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. Program all TextBox controls on the page and assign them string. Empty? A: 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. how can I program a bubble sort 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 [I]) {temp = array [I]; array [I] = array [j]; array [j] = temp ;}} 9. can I describe the implementation process of the indexer in C # To see if it can only be indexed 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 answer: 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 is a B/S structure system. How many layers of structure are used for development? What is the relationship between each layer and why? A: Generally, it is a three-layer data access layer, a business layer, and a 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 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 is the output when a new B () instance is used to create B? Answer: X = 1, Y = 0; x = 1 y =-1 13. What is an application 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, and assembly list) 22. What are common WebService calling methods? A: 1.use the wsdl.exe command line tool. 2. How does one use the Add Web Reference menu option 23..net Remoting in VS. NET? 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 code below to call the OnDBOperate Committee The OnNew event with the signature. }}} Answer: if (OnNew! = Null) OnNew (this, e); 27. analyze the following code to complete filling in the blanks: 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 generation Code. Will a deadlock occur when I> 10 of the test method is called? And briefly explain the reasons. Public void test (int I) {lock (this) {if (I> 10) {I --; test (I) ;}} answer: 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. Let's take a brief look at your understanding of the remoting and webservice technologies under the Microsoft. NET Framework 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: According to the column header you click, the ID of this column is taken out, sorted by this ID, and then bound to the ListView. 32. Specify the following XML file to complete the algorithm flow chart. <DriverC> 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 consecutive. Answer: solution 1: select top 10 * from A where id not in (select top 30 id from A) solution 2: select top 10 * from A where id> (select max (id) from (select top 30 id from A) as A) 34. object-oriented languages include ________, _________, and ________ answers: 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 the existence of a method without 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. It has the same hash code. 45. Does swtich work on byte, long, and String? A: In switch (expr1), expr1 is an integer expression. Therefore, the parameters passed to the switch and case statements should be int, short, char, or byte. Long and string cannot apply to swtich. 47. After a thread enters a synchronized method of an object, can other threads access other methods of this object? No. One synchronized Method of an object can only be accessed by one thread. 48. can abstract methods be both static, native, and synchronized? A: No. 49. Does List, Set, and Map inherit from the Collection interface? A: List, Set is Map, not 50. The elements in Set cannot be repeated. So what method should we use to distinguish between duplicates? Is = or equals () used ()? What are their differences? A: The elements in the Set cannot be repeated. Use the iterator () method to identify whether the elements are repeated or not. Equals () is used to determine whether two sets are equal. The equals () and = Methods Determine whether the reference value points to the same object equals () is overwritten in the class, in order to return the true value when the content and type of the two separated objects match. 51. Does the array have the length () method? Does String have the length () method? A: The array does not have the length () method. It has the length attribute. String has the length () method. 52. What is the difference between sleep () and wait? A: The sleep () method is used 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 time, other threads may be running and not scheduled to give up execution, unless (a) the thread "wakes up" has a higher priority (B) the running thread is blocked for other reasons. When wait () is a thread interaction, if the thread sends a wait () call to a synchronization object x, the thread will pause the execution and the called object will enter the waiting state, wait until the wake-up or wait time is reached. 53. short s1 = 1; s1 = s1 + 1; what is the error? Short s1 = 1; s1 + = 1; what is the error? Answer: There is a mistake in short s1 = 1; s1 = s1 + 1; s1 is short type, s1 + 1 is int type, and cannot be explicitly converted to short type. It can be changed to s1 = (short) (s1 + 1 ). Short s1 = 1; s1 + = 1 is correct. 54. Let's talk about the differences between final, finally and finalize. A: final-modifier (keyword) If a class is declared as final, it means that it cannot generate a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared both abstract and final. Declare variables or methods as final to ensure that they are not changed during use. Variables declared as final must be declared with an initial value, which can only be read and cannot be modified in future references. Methods declared as final can only be used. finally blocks cannot be reloaded before exception handling to perform any cleanup operations. If an exception is thrown, the matched catch clause is executed, and the control enters the finally block (if any ). Finalize-method name. Java technology allows you to use the finalize () method to clear objects from the memory before the Garbage Collector clears them. This method is called by the garbage collector when it determines that this object is not referenced. It is defined in the Object class, so all classes inherit it. Subclass overwrites the finalize () method to sort system resources or perform other cleanup tasks. The finalize () method is called before the Garbage Collector deletes an object. 55. How to handle hundreds of thousands of concurrent data records? A: use stored procedures or transactions. Update at the same time when getting the maximum ID .. note that the primary key does not have repeated primary keys when the primary key is not self-incremental .. A stored procedure is required to obtain the maximum identity. 56. what are the major bugs in Session? What methods does Microsoft propose to solve them? A: The Session is lost when the system is busy due to the process recycle mechanism in iis. You can use Sate server or SQL Server database to store the Session. However, this method is slow, the END event of the Session cannot be captured. 57. What is the difference between a process and a thread? A: A process is the unit of resource allocation and scheduling by the system. A thread is the unit of CPU scheduling and scheduling. A process can have multiple threads which share the resources of the process. 58. What is the difference between stack and stack? A: Stack: the stack is automatically allocated and released by the compiler. Variables defined in the function body are usually on the stack. Heap: usually assigned and released by programmers. The memory allocated by using new and malloc functions is on the heap. 59. What is the role of adding static before member variables and member functions? A: They are called common member variables and common member functions, also known as class member variables and class member functions. They are used to reflect the status of the class respectively. For example, a class member variable can be used to count the number of class instances. class member functions are responsible for such statistical actions. 60. ASP. NET compared with ASP, what are the main advances? A: asp interpretation form and aspx compilation form help improve the performance and protect the source code. 61. generate an int array with a length of 100 and insert 1-100 randomly into it, which cannot be repeated. Int [] intArr = new int [100]; ArrayList myList = new ArrayList (); Random rnd = new Random (); while (myList. count <100) {int num = rnd. next (1,101); if (! MyList. contains (num) myList. add (num) ;}for (int I = 0; I <100; I ++) intArr [I] = (int) myList [I]; 62. please note in. net, and express their advantages and disadvantages. A: session (viewstate) is simple, but it is easy to lose the global cookie of the application, but it may not be supported. It may be easy to forge input ttype = "hidden", and may be simple to forge url parameters, it is displayed in the address bar. The database with limited length is stable and secure, but its performance is relatively weak. 63. what does GAC mean? A: Global Assembly cache. 64. How many requests can be sent to the server? A: get and post. Get is generally the link mode, and post is generally the button mode. 65. What is the difference between DataReader and Dataset? A: One is a read-only cursor and the other is a table in memory. 66. How many stages are there in the software development process? What is the role of each stage? Answer: requirement analysis, architecture design, code writing, QA, and deployment 67. What are the meanings of using and new keywords in c #? What do you know? Using command and statement new create instance new hide methods in the base class. Answer: using introduces a namespace or uses an unmanaged resource. new creates an instance or hides the parent class method 68. to process a string, remove the spaces at the beginning and end of the string. If there are consecutive spaces in the string, only one space is reserved, that is, multiple spaces are allowed in the string, however, the number of consecutive spaces cannot exceed one. a: string inputStr = "xx"; inputStr = Regex. replace (inputStr. trim (), "*", ""); 69. what is the output of the following code? Why? Int I = 5; int j = 5; if (Object. referenceEquals (I, j) Console. writeLine ("Equal"); else Console. writeLine ("Not Equal"); A: Not Equal, because the object is compared to 70. what is SQL injection and how to prevent it? For example. A: attackers use SQL keywords to attack websites. Filter keyword '71. What is reflection? A: Dynamically Retrieve assembly information 72. How to Write design patterns using Singleton answer: new in the static attribute, constructor private 73. What is Application Pool? A: Web applications, similar to Thread pools, improve concurrency performance. 74. What is a virtual function? What is an abstract function? A: virtual functions: functions that are not implemented can be inherited and overwritten by sub-classes. Abstract function: Specifies a function that must be implemented by a non-virtual subclass and must be overwritten. 75. What is XML? A: The markup language can be expanded using XML. EXtensible Markup Language. A tag is an information symbol that a computer can understand. With this tag, computers can process articles containing various information. To define these tags, you can select an international markup language, such as HTML, or use a markup language that is freely determined by people like XML. This is the scalability of the language. XML is simplified and modified from SGML. It mainly uses XML, XSL, and XPath. 76. What is Web Service? UDDI? A: Web Service is a network-based, distributed modular component that executes specific tasks and complies with specific technical specifications. These specifications Enable Web Service to interoperate with other compatible components. The purpose of UDDI is to establish standards for e-commerce. UDDI is a set of Web-based, distributed, and standard standards for implementing information registration centers for Web Services, it also contains a set of access protocols that enable enterprises to register their own Web services so that other enterprises can discover. 77. What is a user control in ASP.net? A: The user control is generally used when the content is mostly static, or a little changes... it is relatively large... similar to include... in ASP, but the function is much more powerful. 78. list the XML technologies you know and their applications. A: xml is used for configuration and is used to save static data types. web Services .. and what are common objects in config 79.ADO.net? Describe them separately. A: Connection database Connection object Command database Command DataReader data reader DataSet 80. What is code-Behind technology. Answer: ASPX, RESX, and CS files are separated by code. HTML code and server code are separated. easy to write and organize code. 81. what is SOAP and what applications are there. A: simple object access protocal. simple objects accept the protocol. it uses xml as the basic encoding structure and is built on existing communication protocols (for example, http, But ms is said to be engaged in soap with the underlying architecture on TCP/IP) A protocol that standardizes the use of Web services .. in 82.C#, what are the differences between property and attribute? What are the advantages of this mechanism? A: attributes are used to access the fields of the class, and features are used to identify additional properties such as classes and methods. The main differences between XML and HTML are as follows: 1. XML is case-sensitive and HTML is not. 2. In HTML, if the context clearly shows where the paragraph or list key ends, you can omit or end tags. In XML, the end mark cannot be omitted. 3. In XML, an element with a single tag but no matching ending tag must end with one/character. In this way, the analyzer does not need to find the end mark. 4. in XML, attribute values must be placed in quotation marks. Quotation marks are usable in HTML. 5. In HTML, You can have attribute names without values. In XML, all attributes must have corresponding values. What is the ternary operator in 84. c? A :? :. 85. When integer a is assigned to an object, integer a will be? Answer: packing. 86. Which of the following types of Class Members are accessible? A: this.; new Class (). Method; 87. public static const int A = 1; is there an error in this code? What is it? A: The const cannot be modified using static. 88. float f =-123.567F; int I = (int) f; what is the I value now _____? A:-123. 89. What is the keyword of the delegate statement ______? A: delegate. 90. What are the characteristics of classes modified with sealed? A: It is sealed and cannot be inherited. 91. All Custom User Controls in Asp.net must inherit from ________? A: Control. 92. In. Net, all serializable classes are marked _____? A: [serializable] 93. In. Net hosting code, we don't have to worry about memory vulnerabilities. This is because ______? A: GC. 94. 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 cannot be modified together .} // new public abstract void F (); 95. when class T only declares the constructor of a private instance, ___ can ___ (can or cannot) derive a new class from T outside the program text of T, it is not allowed to create any instance of T directly (either or not. A: No. No. 96. Is there an error in the following code? Switch (I) {case (): A: // The case () condition cannot be empty. CaseZero (); break; case 1: CaseOne (); break; case 2: dufault; a: // wrong. The format is incorrect. CaseTwo (); break;} 97. in. net, class System. web. UI. can pages be inherited? A: Yes. What is the error handling mechanism of 98..net? A: the. net error handling mechanism adopts the try-> catch-> finally structure. When an error occurs, it is thrown layer by layer until a matched Catch is found. 99. The operator statement is used and only = is declared. Is there any error? A: Do you want to modify Equale and GetHash () at the same time ()? If "=" is reloaded, it must be reloaded "! = "100. How to customize messages in. net (C # or vb.net) and process these messages in the form. A: Reload the DefWndProc function in form to process the message: protected override void DefWndProc (ref System. winForms. message m) {switch (m. msg) {case WM_Lbutton: // The Format function of string and CString in MFC is used differently. string message = string. format ("Receive message! Parameter: {0}, {1} ", m. wParam, m. lParam); MessageBox. show (message); // display a message box break; case USER: The processed code default: base. defWndProc (ref m); // call the base class function to process non-custom messages. Break;} 101. How to cancel closing a form in. net (C # or vb.net. A: private void Form1_Closing (object sender, System. componentModel. cancelEventArgs e) {e. cancel = true;} 102. in.. net (C # or vb.net), Appplication. exit or Form. what is the difference between Close? A: one is to exit the entire application, and the other is to close one of the forms. 103. There is a double type variable in C #, such as 10321.5, such as 122235401.21644, how to output the value as a currency according to the habits of different countries. For example, in the United States, $10,321.50 and $122,235,401.22 are used, while in the United Kingdom, 321.50 and 122 235 are used. Answer: System. globalization. cultureInfo MyCulture = new System. globalization. cultureInfo ("en-US"); // System. globalization. cultureInfo MyCulture = new System. globalization. cultureInfo ("en-GB"); for the British currency type decimal y = 9999999999999999999999999999 m; string str = String. format (MyCulture, "My amount = {0: c}", y); 104. A password only uses five letters (K, L, M, N, and O). The words in the password are left to the right. Sort the password words according to the following rules: (1) the minimum length of the password word is two letters, which can be the same or different (2) K cannot be the first letter of the word (3) if L appears, it appears more than once (4) M cannot make the last or second to last letter (5) K, then N must appear (6) O if it is the last letter, then L must have problem 1: Which of the following letters can be placed behind O in LO to form a password word with three letters? A) k B) l c) m d) N answer: B Question 2: If you can get letters K, L, M, what is the total number of two letter-long passwords? A) 1 B) 3 C) 6 D) 9 answer: A Question 3: Which of the following is the word password? A) klln B) LOML C) MLLO D) NMKO answer: C 8. 62-63 = 1 the equation is not true. Please move a number (the minus sign and the equal sign cannot be moved) so that the equation is true. How can we move it? Answer: 62 is moved to the power of 2 to the power of 105. for such an enumeration type: enum Color: byte {Red, Green, Blue, orange} A: string [] ss = Enum. getNames (typeof (Color); byte [] bb = Enum. getValues (typeof (Color); 106. C # What are the differences between property and attribute? What are their respective uses? What are the benefits of this mechanism? A: attribute: The base class of the custom attribute; property: 107.C# can I perform direct operations on the memory in the class? A: In.. net ,. net references the garbage collection (GC) function, which replaces programmers. However, in C #, the Finalize method cannot be directly implemented, but the Finalize () function of the base class is called in the destructor () method 108.ado. What are the main improvements to NET over ADO? A: 1. ado.net does not rely on the ole db provider, but uses it. net-managed programs, 2: Do not use com3: do not support dynamic cursors and server-side Games 4:, You can disconnect the connection and keep the current dataset available 5: strong type conversion 6: xml supports 109. write an HTML page to implement the following functions: "Hello" is displayed when you left click the page, and "forbidden right click" is displayed when you right click the page ". The page is automatically closed in 2 minutes. A: 110. Briefly describe ASP. NET Server Control lifecycle A: initialization loading view status processing sending and returning data loading sending and returning change notification processing sending and returning events pre-rendering save status rendering disposal uninstalling 111. can Anonymous Inner Class (Anonymous internal Class) be extends (inherited) other classes, and implements (implemented) interface (interface )? A: No. You can implement interface 112. the difference between Static Nested Class and Inner Class. The more you say, the better. A: Static Nested Class is an internal Class declared as static. It can be instantiated without relying on external Class instances. In general, internal classes must be instantiated before they can be instantiated. 113., & and. & Is a bitwise operator that represents bitwise and OPERATION. & is a logical operator that represents the difference between logic and (and). 114. HashMap and Hashtable. A: HashMap is a lightweight Implementation of Hashtable (non-thread-safe implementation). They have completed the Map interface. The main difference is that HashMap allows null key values ), because of non-thread security, the efficiency may be higher than that of Hashtable. 115. short s1 = 1; s1 = s1 + 1; what is the error? Short s1 = 1; s1 + = 1; what is the error? Answer: short s1 = 1; s1 = s1 + 1; (s1 + 1 is an int type, which requires forced conversion) short s1 = 1; s1 + = 1; (correctly compiled) 116. can the Overloaded method change the type of the returned value? A: The Overloaded method can change the type of the returned value. 117. What is the difference between error and exception? A: error indicates that the restoration is not an impossible but difficult case. For example, memory overflow. It is impossible to expect the program to handle such a situation. Exception indicates a design or implementation problem. That is to say, it indicates that if the program runs normally, it will never happen. 118. What is the difference with it? A: The bound data source is a server-side code block 119. you think ASP. NET 2.0 (VS2005) and the development tools you used earlier (. net 1.0 or other) What is the biggest difference? Which development ideas (pattern/architecture) you used on the previous platform can be transplanted to ASP. NET 2.0 (or already embedded in ASP. NET 2.0) Answer: 1 ASP.. NET 2.0 encapsulates and packages some code, so the same function reduces a lot of code compared to 1.0. 2. Both the code separation and page embedding server-side code modes are supported. In the previous version 1.0 ,.. NET prompt help is only available in separated code files. You cannot embed server-side code on the page to get help tips. 3. When switching code and design interfaces, 2.0 supports cursor positioning. in this case, I prefer 4 to bind data and Create Table pages. update, Delete, and other operations can be visualized, facilitating beginners 5 in ASP.. NET added more than 40 new controls, reducing the workload by 120. what is the difference between heavy load and coverage? Answer: 1. The method overwrites the relationship between the Child class and the parent class, and the vertical relationship. The method overload is the relationship between methods in the same class, is a horizontal relationship 2. Override can only be a method, or can only be a relationship between one method. Method Overloading is the relationship between multiple methods. 3. The overwrite request parameter list is the same; the reload request parameter list is different. 4. In the override relationship, the method body called is determined based on the object type (the object corresponds to the bucket type, the method body is selected based on the real parameter table and the form parameter table during the call. 121. To describe the implementation process of the indexer in C #, can I index data only by numbers? A: No. Any type can be used. 122. in C #, use text or images to describe the differences between string str = null and string str =. A: null is referenced by no space. "" is a string with a space of 0, and 123. analyze the following code to complete filling in the blanks: 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 124. 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) 125. analyze the following code. Public static void test (string ConnectString) {System. data. oleDb. oleDbConnection conn = new System. data. oleDb. oleDbConnection (); conn. connectionString = ConnectString; try {conn. open ();.......} Catch (Exception Ex) {MessageBox. Show (Ex. ToString ();} finally {if (! Conn. State. Equals (ConnectionState. Closed) conn. Close () ;}} 1) Can the above Code correctly use the connection pool? Answer: If the input connectionString is the same, you can use the connection pool correctly. But exactly the same means that the numbers of spaces in the hyphen are in the same order. 2) can all exceptions in the test method be captured and displayed in the exception handling method used by the above Code? A: You can only catch exceptions in database connections. (In finally, catch, if there are other operations that may cause exceptions, try and catch should also be used. So theoretically not all exceptions will be caught .) 126. 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: According to the column header you click, the ID of this column is taken out, sorted by this ID, in the bind to ListView 127. what is WSE? What is the latest version? A: The WSE (Web Service Extension) package provides the latest WEB Service security assurance. The latest version is 2.0. 128. 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 is the output when a new B () instance is used to create B? Answer: X = 1, Y = 0 129. in the following example, using System; class A {public static int X; static A () {X = B .Y + 1 ;}} class B {public static int Y = A.X + 1; static B () {} static void Main () {Console. writeLine ("X = {0}, Y = {1}", A.X, B .Y) ;}} what are the output results? Answer: x = 1, y = 2 130. What is the difference between abstract class and interface? A: The class that declares the existence of a method without 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. This article from the CSDN blog, reproduced please indicate the source: http://blog.csdn.net/clq271520093/archive/2008/08/27/2838668.aspx

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.