C # interview questions

xiaoxiao2021-04-08  4

1. In C #, String Str = NULL and STRING STR = "" Please try to use the text or image instructions. Answer Point: Describe the detailed spatial allocation. (10 points) Answer: String str = NULL does not assign him memory space, and string str = "" gives it the memory space for the length of the empty string. 2, please detail in the DotNET class (Class) and structure (STRUCT): (10 points) Answer: Class can be instantiated, belonging to the reference type, is assigned to the stack of memory, Struct belongs to the value type, which is allocated on the store. 3, according to the delegation ( delegate) knowledge, complete the following user control. Code fragment: (10) 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)) {// Please quote the code in the following to call the ONDBOPERATE entrusted ONNEW event. }}} A: if (onnew! = NULL) ONNEW (THIS, E); 4, analyze the following code, complete the fill in the blank (10 points) string stramp = "AbcDefg a certain"; int i = system.text.Encoding. Default.getBytes (startmp) .length; int J = startmp.Length; After the above code is executed, i = j = A: I = 13, J = 10 5, SQLServer server, give two fields in Table1 ID, LASTUPDATEDATE, ID indicate that the updated transaction number, LastUpdatedate indicates the server time when the update is updated, please use a SQL statement to get the last updated transaction number. (10) A: SELECT ID from Table1 WHERE LASTUPDATEDATE = (SELECT MAX (LastupdateDate) from table1) 6, analyze the following code based on thread security, when the TEST method is called when I> 10 occurs when I> 10 will cause a deadlock? Brief explanation. (10 points) Public void test (int i) {lock (this) {if (i> 10) {i-; test (i);}}} answer: no dead lock, (but there is a little int The value is passed, so each change is just a copy, so there will be no deadlock. But if INT is changed to an object, then the deadlock will occur) 7, and the following code is analyzed.

(10) 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) The above code can be used correctly Connect pool? A: Answer: If the incoming Connectionstring is exactly the same, you can use the connection pool correctly. However, the same means that the number of spaces of characters, the order is exactly the same. 2) The abnormality processing method used by the above code, whether all the exceptions within the TEST method can be captured and displayed? A: You can only capture an exception in the database connection. (In catch, Catch, if there is other possible operation, try, catch, so it should be used in theory that all exceptions will be captured.) 8, brief Talk about the understanding of the two techniques of Remoting and WebService under Microsoft .NET architecture and the actual application. (10) A: WS is mainly available to HTTP, penetrate the firewall. Remoting can utilize TCP / IP, binary transfer to improve efficiency. 9. The company demands to develop a component that inherited the System.Windows.Forms.ListView class, requiring the following special features: Click on the list of ListView, you can follow all the rows in the row in each row value of the column ( Sort by DataGrid is similar). According to your knowledge, please briefly talk about your ideas: (10) A: According to the column header of the click, the ID of the column is removed, and after the ID is sorted, it is bound to the ListView 10, given the following XML File, complete the algorithm flowchart. (10)

< File filename = "io.sys"> Draw a flowchart that traverses all file names (FileName) (please use the recursive algorithm). Answer: Void FindFile (Directory D) {fileorFolders (); foreach (FileorFolder FOF in fileorfolders) {if (fof is file) {if (fof is file) you found a file; Else if (FOF is Directory) FindFile (FOF);}} Simply put, start traversing a child node from the root node, looking at its child nodes from the found child, one layer is related to the relevant reply

First, select the blanking question (2 points per empty, a total of 60 points). 1. Select () when operating the SQL Server database. a) SQL Server .NET Framework data provider; b) OLE DB .NET Framework data provider; c) ODBC .NET Framework data provider; d) Oracle .NET Framework data provider; 2. In the following options, () It is a reference type. a) ENUM Type B) String Type C) String Type D) INT Type 3. About the code hidden file in ASP.NET is correct, the logic of the program of the program is composed of code, these codes Create for interaction with the form. Programming logic is unique to files with different user interfaces. This file is called "code hidden" file, if you created with C #, this file will have an ".ascx.cs" extension. b) The code hidden file in all web form pages in the project is compiled into .exe files. c) All web form pages in the project are compiled into a project dynamic link library (.dll) file. d) Not correct. 4. The following description is that () a) does not support abstract classes in C # in C in C . b) C can declare a member of the class in the header file to define a member of the class in the CPP file, there is no header in the C # and declare and define the class members at the same place. c) Explicitly hidden members inherited from the base class in C #. d) The virtual function to redefine the base class in the derived class in the C # must be added to Override. 5.C # data type with () a) value type and call type; b) value type and reference type; c) reference type and relationship type; d) relationship type and call type; 6. The following description is incorrect () a) Class cannot be multiple inheritance and interface can be; b) Abstract class itself can define members and interfaces cannot be; c) The abstract classes and interfaces cannot be instantiated; d) A class can have multiple base classes and multiple bases Interface; 7. Method () a) Save method B) LOAD method B) LOADXML Method D) SEND method 8. The following describes the correct () a) constructor. Declare the return type. b) Constructor can not use the private modification C) The constructor must be the same as the class name. The constructor cannot be used as a parameter 9. The following is a definition of enumeration type in C #, where the wrong usage is () a) public enum Var1 {mike = 100, nike = 102, jike} b) public enum var1 {mike = 100, nike, jike} c) public enum var1 {mike = -1, nike, jike} d) public enum var1 {mike, nike , JIKE} 10.int [] [] myarray3 = new int [3] [] {new int {new int {new int {5, 6, 2}, new int → {6, 9, 7, 8, 3}, NEW INT [2] {3, 2}}; myArray3 [2] [2] is (). a) 9B) 2C) 6D) Offline 11. Interface is a reference type, which can be declared in the interface (), but not a public domain or private member variable. a) Method, attribute, indexer, and event; b) method, attribute information, attribute; c) indexer and field; d) Event and field; 12.ASP.NET Framework, server control is working with Web forms Specially designed.

Server controls have two types, they are () a) HTML control and web controls b) HTML control and XML control C) XML control and web control D) HTML control and IIS control 13.asp.net, in web form Register a user control, specify the name "Mike" of the control, the correct registration instruction is () a) <% @ register tagprefix = "mike" tagname = "space2" src = "MYX.ASCX"%> B <% @ Register tagprefix = "space2" tagname = "mike" src = "MYX.ASCX"%> c) <% @ register tagprefix = "spacex" tagname = "space2" src = "mike"%> D) or more Non-14. In ADO.NET, for the ExecuteNonQuery () method of the Command object, the following narrative is (). a) INSERT, UPDATE, DELETE, etc. SQL statements are mainly implemented with an ExecuteNonQuery () method; b) The executenonquery () method returns the number of rows that perform the SQL statement. c) SQL statement of SELECT operation can only be performed by the executeReader () method; d) The executeReader () method returns a DataReder object; 15. The following ASP.NET statement (b) correctly created a connection to the SQL Server 2000 database . a) SqlConnection con1 = new Connection ( "Data Source = localhost; Integrated Security = SSPI; Initial Catalog = myDB"); b) SqlConnection con1 = new SqlConnection ( "Data Source = localhost; Integrated Security = SSPI; Initial Catalog = myDB" ); c) SqlConnection con1 = new SqlConnection (Data Source = localhost; Integrated Security = SSPI; Initial Catalog = myDB); d) SqlConnection con1 = new OleDbConnection ( "Data Source = localhost; Integrated Security = SSPI; Initial Catalog = myDB" ); 16.WINFORM, the description of the properties and events of the Toolbar control is incorrect (). a) Buttons Attribute indicates all toolbar buttons of Toolbar controls B) Buttonsize property indicates the size of the toolbar button on the Toolbar control, such as the height and width c) DROPDOWNARROWS attribute indicates that the toolbar button (this button has a column value requires the following pull display Next to Whether the arrow key is displayed D) ButtonClick events trigger 17 when the user clicks anywhere, and when performing a stored procedure in ADO.NET, if you want to set the output parameter, you must set the direction and () of the parameters at the same time. , Set the parameter size if necessary. a) size; b) upper limit; c) initial value; d) type; 18. If you set the form's FORMBODERSTYLE to NONE, ().

a) The form does not have a border and cannot be adjusted; b) The form does not have a border but can adjust the size; C) The form has a border but cannot adjust the size; d) The form is transparent; 19. If you want to set the form to Transparent, then () a) To set the FormBoderstyle property to none; b) Set the Opacity property to be less than 100% value; c) Set the locked property to true; d) To set the enabled property to true; 20. The following information about the C # medium indexer is correct is that the parameter of the indexer must be two or more b) The parameter type of the indexer must be an integer type C) indexer without name D) 21. The following description is (). a) Forms are also controls; b) Forms are also classes; c) The control is from the form inheritance; d) The parent class of the form is a control class; 22. To operate the registry, you must include (). a) System.comPonentModel Namespace; b) System.collections Namespace; c) System.Threading Namespace; D) Microsoft.win32 Namespace; 23. To create multi-document applications, you need to set your form () property True. a) DrawGrid; b) showintaskbar; c) enabled; d) ismdicontAiner; 24. If you set TreeView1 = New TreeView (), TreeView1.Nodes.Add ("Root Node") Returns a () value of the value. a) Treenode; b) int; c) string; d) TreeView; 25. The following is an error with the XML description (). a) XML provides a method of describing structured data; B) XML is a simple, standard; C) XML document can carry various information; d) XML is just to generate structured documents 1. The difference between PROPERTY and Attribute, what are their use, where is the benefits of this mechanism? 2. Tell you how to understand the Web Service, how to combine XML in Dot Net Framework? (Tell the concept) 3. C #, Java and C features, what is the same place, different places, C # separately absorbs their advantages from C and Java? 4. Can C # Can you direct memory? (This is a difficult point? Want to pay attention!) 5. How do I write with Visual C 6.0, how to combine with other DOT NET Component under CLR? 6. Some projects I have previously made? Introduce your own programming experience. (This is not too much, basically a question, know if it is a fake) 7. What expectations do you have for the company? Your salary expectation? Why do you learn a computer? Previous experience (this is very important)? Q3: Maintain the integrity of the database, consistency, do you like trigger or self-contained business logic? Why Q4: ADO. What improvements have Net mainly have maintained relative to ADO? Q5: ASP.

What are the main progress in NET and ASP? Q6: What is the delegation in C #? Is an event? Q7: Describe the implementation process of the C # medium index, can only be indexed according to the number? Q8: C # To make a class support foreach traversal, what is the implementation process? Q10: Write an HTML page, implement the following features, display "Hello" when you click on the page, right-click, display "Forbidden right click". And automatically close the page after 2 minutes. Q11: Do you know XMLHTTP, WebService? Simply describe its characteristics, the role of Q12: What is the difference between the interface and abstraction? What is the basis for choosing an interface and an abstract class? Q13: Customizen control and general user controls? If you want to use one of these, which you would choose? Why Q14: Probably describes the ASP. NET server control lifecycle Q15: UML Q16: Object-oriented concept, main features Q17: Basis of class division. Types of granularity Q18: Things management issues first, talk about Final, Finally, Finalize. Second, anonymous inner class (anonymous internal class) can be extends other classes, can IMPLEMENTS INTERFACE (interface)? Third, Static Nested Class and Inner Class are different, the more better, The interview question is very general). The difference between fourth, & and &&. Fifth, the difference between HashMap and HashTable. Sixth, the difference between Collection and Collectes. Seventh, when do you use Assert. Eighth, what is GC? Why do you have GC? Ninth, String S = New String ("XYZ"); create a few String Object? Tenth, Math.Round (11.5) is equal? ​​Math.Round (- 11.5) Is it equal? ​​Eleventh, short s1 = 1; S1 = S1 1; What is wrong? Short S1 = 1; S1 = 1; What is wrong? No. 12, SLEEP () and Wait () What is the difference? 13. Is there a goto in Java? Fourteenth, there is a length () method? String has a length () method? The difference between the fifteenth, OverLoad and Override. Whether the OVERLOADED method can change the type of return value? The sixteenth, the elements in the set cannot be repeated, then what method is used to distinguish whether it is repeated? Is it == or equals ()? What is the difference? Seventest, give me a Runtime Exception you most frequently.

Eighteenth, error and exception? Ninteenth, List, SET, MAP inherit from the Collection interface? Ten, what is the difference between the Abstract Class and Interface? Second 11, Abstract Method is available at the same time Static, whether it is Native to Native, is it possible to be SYNCHRONIZED? 22, whether the interface can inherit the interface? Is the abstract class to implement (IMPLEMENTS) interface? Does the abstract class can inherit the physical class (CONCRETE CLASS)? 20 Third, starting a thread is Run () or start ()? 24. Is the constructor can be Override? 25, can you inherit the String class? Type 6, when a thread enters an object After a synchronized method, can other threads can enter other methods of this object? The second sevente, TRY {} has a return statement, so the code in finally {} after this try will not be executed. When is it performed, before return or after? Twenty-eight, program: 20 multiplied by 8 equal to a few? Two-nine, two object values ​​(Y ) == true), but there are different haveh codes, this sentence is not right? Thirty, when an object is passed as a parameter to a method, this method can change the properties of this object, and return The result of change, then here is the value delivery or reference delivery? 31. If SWTICH can function on Byte, whether it can work on long, can it work in String? 32, program: Write a Singleton out. Database: 1. Differences between stored procedures and functions 2. What is transaction? 3. The role of the cursor? How do you know that the cursor has arrived at the end? 4. The trigger is divided into an existing trigger and post-event trigger, which triggers and distinctions. What is the difference between statement level trigger and row trigger. 1. Implementing the following function A to generate an int array with a C # to generate an int array, and insert 1-100 randomly, and cannot be repeated. B Sort above the array of arches, need to support ascending order, sequencing two sequences 2. Please indicate how the parameters are passed between several pages in .NET, and say their advantages and disadvantages. 3. Please explain the error handling mechanism in .NET, and 4. Please speak a strong name 5. Please list the methods of several cycles in C # and point out their differencesses 6. Please point out all types of base classes in .NET. Please indicate the meaning of the GAC 8.

In the SQL SREVER, new data is inserted into a table, how to quickly get the current value of the cycling field, how do you use the false method? What is the difference in interface? Q: What is the difference between OVERRIDE and overload? Q: What is the difference between value type and reference type? Q: How to understand static variables? Q: How many ways to send requests to the server? Q: What is the difference between DataReader and DataSet? Q: If you need to pass a variable in a B / S structure system, you can't use Session, cookie, Application, how many ways do you have? Q: Use .NET to make a B / S structure system, you use several layers of structure to develop, the relationship between each layer and why is it hierarchical? Q: How many stages in the software development process? Each stage effect? Q: Microsoft launched a series of Application Block, please give your own Application Block and explain its role? Q: Please include some design patterns you used and in what circumstances use this mode? Q: Do you experience the WebService? Q: What is your interest in programming? What is the problem that I don't understand during work? How do you usually improve your programming level? Q: What is the reason for your separation? Q: How to transfer Chinese parameters through hyperlink? Q: Please program all the TextBox controls on the traversal page and assign it to string.empty? Q: Please program a bubble sort algorithm? 1. Override and overloaded Difference 2, .NET error handling mechanism What is 3, the interface and the difference between the interfaces and classes in C # 1. DataReader and DataSet is different 1. What kind of method can implement one class to access another one The membership function and attributes of the class, and please refer to explanation and analysis. 2. If you need to record the number of instances of the class, how to implement it, write a simple class to prove. 3.a class is Class B Base class, and have its own constructor, a destructuring function, please exemplify the B class from instantiation to the implementation process of constructing and destructuring the dummy process. 4. You need to implement the processing of a string, first put the character The skeleton is removed. If there is a continuous space in the middle of the string, only one space is kept in the middle of the string, but the number of consecutive spaces cannot exceed one. 1. Fill in the blank question 1.c # three The element operator is __?: ___? 2. When the integer A is assigned to an Object object, the integer A will be __ box (package) ___? 3. member has _____ can access the form? NEW Class () .METHOD; 4.PUBLIC Static const Int a = 1; Is this code error? What is it? Const cannot use Static to modify 5.float f = -123.567f; int i = (int) f; i's value is now _____? 123 6. Use the Operator statement and only declare "==", what is wrong? 7. The keyword of the delegate declaration is ______? Delagete 8. What is the characteristics of the class modified with SeaD? Sealed, unable to inherit 9. All custom user controls in ASP.NET must inherit from _______? Control 10. All sequential classes in .NET are marked as _____? 11. In .NET hosting In the code, we don't have to worry about memory vulnerabilities, this is because there is a ______? GC 12. Is there any mistake in the code below? _______ using system;

Class a {public virtual void f () {console.writeline ("af);}}} Abstract Class B: a {public abstract override void f (); // new public abstract void f ();} 13. T only declare the private example constructor, then outside the program text, ___ can ___ (can be not) from t to send new classes, can not be ____ (can not be OR) to create T Any example. 14. Is the code below have an error? Switch (i) {case (): casezero (); break; case 1: caseone (); break; case 2: dufault; // wrong casketwo (); Break;} 15. In .NET, class system.Web Can you inherit? Uipage? Can two. Spring questions 1. What is the meaning of two keywords and new keywords in C #, please write what you know? USING instruction and statement NEW Create an instance new hidden base class China French 4. Talk about the difference between class and structure? Class is the reference type, the structure is a value type 5. A string of a length of 1000, which is composed of 10,000 characters from A-Z. Please write a primary program with C # language. 6. For such an enumeration type: enum color: byte {red, green, blue, orange} string [] ss = enum.getnames (typeof (color)); byte [] bb = enum.getvalues ​​(Typeof )); Try to write a program to display all symbolic names defined in the enumeration type and their corresponding values. 7. Do you understand the design pattern? Please list the name of the design pattern you know. // 8. Please design a table in SQL Server to save an organizational map of a tree structure (assuming only the content in the structural figure needs to be saved), if I want to check all the positions under a position, use one The stored procedure is implemented, what kind of ideas do you have? 9. What is SQL injection, how to prevent? Please explain it. 10. What is the code output below? why? INT i = 5; INT J = 5; IF (Object.referenceequals (i, j)) Console.Writeline ("Equal"); "NOT Equal"); // is not equal, because compared Object 1. Write a method of implementing a string of string, adding some conditions, including ",", ",", for its design test case.

转载请注明原文地址: http://www.9cbs.com/read-132884.html

New Post(0)