[Finishing]c#. NET common interview questions with Answer (ZT) A friend who is looking for a job may use it. I am not too understand resistance, last week a friend came to me to find a job he tidied up, so I only responsible for posts, the answer to the question to you. --------1. What does object-oriented thinking mainly include? 1 Inherit polymorphic Package//--------2. What is a user Control 2 user control in ASP. Do not say know how to do//--------3. What is an application domain? What is a regulated code? What is a strongly typed system? What are crates and unboxing? What is overloading? What are the CTS, CLS, and CLR explanations for each? 3 Boxing and unpacking a value type is converted to a reference type, and a reference type is overloaded with a value type: The same function parameter is different//--------4. List what you know about XML technology and its applications 4.xml can be used to make Web pages (XSLT) XML as a database XML can be used to save the serialization of objects//--------5. What is the difference between a value type and a reference type? Write the sample code for C #. 5 value type, there is nothing to say. The reference type is useful when returning more than two arguments. Ref out I used to be out do not first assignment//--------What are the objects commonly used in 6.ado.net? Describe it separately. 6 I'm using sqlhelper directly with the connection command and parameters//--------7. How to understand a delegate? 7 The callback mechanism is useful. A delegate is used in net.//--------What are the similarities and differences between interfaces and classes in 8.c#. 8 interfaces, which are multiple inheritance, have only single inheritance for classes. The interface emphasizes that you have to implement, and that the method without this implementation is somewhat similar to the virtual class//--------9. What classes are needed to read and write databases in net? Their role 9 DataReader dataset There is also a less common//--------10.UDP connection and the similarities and differences between TCP connections. Ten UDP do not achieve what three times handshake.//--------What are the authentication methods for 11.asp.net? What is the principle of the distinction? The most common or previous session method for ASP. Form validation has not been used. Microsoft has not used either//--------12. How do processes and threads understand each other? A process is the unit in which a system allocates and dispatches resources, and a thread is a unit of CPU dispatch and dispatch, and a process can have multiple threads that share the resources of the process. --------13. What is Code-behind technology?Postoperative 13 Code post-placement: Don't know how to speak//--------14. The role of the Active Directory. 14 Active Directory: What namespaces do the classes that read and write XML in 15..net--------to belong to? System.Xml (System.IO when creating a directory)//--------16. Explains the meaning and role of UDDI, WSDL. 16 This is also something in the Web service.//--------17. What is soap and what are the applications? 17 Soap simple Protocol. I only know. Web services are based on the----------------------------------------------------------------------------------------------- ---18. How to deploy an ASP. 18 Section one page. That is, no code is written directly in the ASPX. Just put it in the IIS virtual directory. Of course, ASP.//--------19. How to understand the garbage collection mechanism in. NET. 19 Garbage Collection: General as long as the master. Unmanaged objects remember to release the resources.//--------20. What are the common calling WebService methods? 20 directly inside the vs.net is OK. It will generate a proxy class//--------1, process and thread differentiation process is the system of resource allocation and scheduling units; a thread is a unit of CPU dispatch and dispatch, and a process can have multiple threads that share the resources of this process. --------2, member variables and member functions before adding static they are called constant member variables and constant member functions, also known as Class member variables and class member functions. To reflect the state of the class, respectively. For example, a class member variable can be used to count the number of instances of a class, and the class member function is responsible for this statistical action. The difference between--------3, malloc, and New is the C + + keyword. malloc must allocate memory by the given byte allocation, and new can be automatically allocated according to the size of the object, and the constructor can be called. It can be said that new is the object of the object, and malloc is not. In essence, when new allocates memory, additional information is added to the actual block of memory, so new uses more memory than malloc. --------4, heap and stack of the difference stack: automatically allocated by the compiler, release. The variables defined in the function body are usually on the stack. Heap: Typically freed by programmer allocations. Allocating memory functions such as new, malloc, and so on areOn The stack is the data structure provided by the machine system, and the heap is provided by the C/S function library. Stack is a system-provided function, characterized by fast and efficient, the disadvantage is limited, the data is not flexible, and the stack is a function library provides the function, the characteristic is flexible and convenient, the data adapts widely, but the efficiency has a certain reduction. A stack is a system data structure that is unique to a process/thread, and a heap is a library internal data structure that is not necessarily unique. Memory allocated by different heaps cannot operate with each other. The stack space is divided into two kinds: static allocation and dynamic allocation. Static allocations are done by the compiler, such as the automatic variable (auto) assignment. Dynamic allocation is done by the Alloca function. The dynamic allocation of the stack does not have to be released (it is automatic), and there is no release function. For portable programs, the dynamic allocation of stacks is not encouraged! The allocation of heap space is always dynamic, although all data space will be released back to the system at the end of the program, but an accurate memory/release memory match is an essential element of a good program. --------1. What is the main improvement of ADO? ADO is stored in a recordset, and ADO is a dataset, and ADO provides data sets and data adapters that are useful for distributed processing and reduce the consumption of database server resources. --------2. Asp. NET compared with ASP, what is the main progress? A: ASP. NET implements object-oriented programming, precompiled server-side code instead of interpreting execution like ASP, improving performance, code separation easy to manage, customizable and extensible, powerful development work, better security mechanisms, and more. --------3. What is a delegate in C #? Is the event a delegate? A: A delegate is essentially a "method interface," which is equivalent to a function pointer in C + +, and of course it is more secure than a function pointer and is typically used for event handling in C #. The event is not a delegate, but because the nature of the event determines the parameters that the program logic that handles it can access, the logic that handles the event in C # is wrapped as a delegate. --------4. How many ways is new? Answer: The first type: New Class (); Second type: Override method Public New XXXX () {} Third: The new constraint specifies that any type parameter in a generic class declaration must have a common parameterless constructor. --------5. How to copy an array to arrayList a: foreach (object arr in array) Arraylist.add (arr);//--------6. Datagrid.datasouse can connect to what data source A: Dataset,datatable,dataview, ilist//--------7. With SWhat are the characteristics of ealed modified classes? A: The sealed modifier is used to prevent other classes from being derived from the class being decorated. If a sealed class is specified as the base class for other classes, a compile-time error occurs. Sealed classes cannot be abstract classes at the same time. --------8. Enumerate the five main objects in ADO, and briefly describe a: Connection connection object, command executes commands and stored procedures, DataReader forward read-only traffic DataAdapter adapter, support additions and deletions, dataset data-level objects, equivalent to one or more in memory Sheet. --------9. Overview Three-tier architecture A: Presentation layer (USL), Business Logic Layer (BLL), data access Layer (DAL)//--------10. What are crates and unboxing? What is overloading? A: Boxing is the conversion of a value type into a reference type, and a unboxing instead converts a reference to a value type. Overloading means that a method name is the same as the number of arguments, and the return value can be the same. --------11. What is the difference between a value type and a reference type? A: Both the simple type and the enumeration type are value types, and the classes, interfaces, and array types are reference types. --------12. Brief WebService A: A Web service can be described as a feature that can be deployed on the web and can be invoked by any application or other service. The so-called service is the system provides a set of interfaces, and through the interface using the system-provided features, Web services can provide any enterprise to the customer, enterprise-to-business, point-to-point or department to the Department to communicate the services required, such as a company can be connected through the network to another company's services, so direct delivery order. --------13. Overview. The GC mechanism in net. A: The full name of GC is garbage collection, Chinese name garbage collection, which is a function of memory management in. Net. The garbage collector tracks and reclaims allocated objects in managed memory and periodically performs garbage collection to reclaim memory allocated to objects that do not have valid references. The GC automatically occurs when memory requests are not satisfied with available memory. When garbage collection occurs, the garbage collector first searches for managed objects in memory, then searches for the referenced objects from managed code and marks them as valid, then releases the objects that are not marked as valid and reclaims the memory, and finally collates the memory to move the valid objects together//--------14. Asp. NET common built-in objects? Answer: Resqponse, Request, Server, Session, Acclication, cookie//--------15. What is the CLR? A: The CLR (the common language runtime) and the Java Virtual machine are also a run-time environment that is responsible for resource management (memory allocation and garbage collection) and ensures that applications andNecessary separation between the underlying operating system. --------//--------1. Fill in the Blanks: (1) Object-oriented language has (inheritance), (encapsulation), (polymorphism). (Basic concept) (2) objects that can be accessed with a foreach traversal need to implement the IEnumerable interface or declare the type of the Getenumerable method. (Understanding of the foreach mechanism) (3) Enumerate the five main objects in ADO: Command, Connection, DataSet, DataSetCommand, DataReader. (Knowledge of ADO)//--------2. Indefinite selection: (1) The following description is correct: (BC) (understanding of the interface) a. There can be virtual methods in the interface. B. A class can implement multiple interfaces. C. The interface cannot be instantiated. D. The interface can contain implemented methods. (2) from the database to read records, you may use the method is: (BCD) (to examine the proficiency of ADO) a. ExecuteNonQuery B. executescalar c. Fill D. ExecuteReader//--------3. Describes the access rights of private, protected, public, and internal modifiers. A: Private members are only accessible within the class. Protected: A protected member that can be accessed within the class and in the inheriting class. Public: Common members, completely public, without access restrictions. Internal: can be accessed within the same namespace. --------4. Write out an SQL statement: Take the 31st to 40th record in table A (SQL Server, with an auto-growing ID as the primary key, note that the ID may not be contiguous.) Solution 1:select Top * from a where ID not in (select top with ID from a) solution 2:select top * from a Where ID > (select ma X (ID) from (select top with ID from a) as A)//--------5. Lists several ways to pass values between ASP. 5 solution. 1. Use querystring, such as ...? id=1; Response. Redirect () .... 2. Use the session variable 3. Using ServEr. Transfer//--------6. Write out the output of the program class Class1 {private String str = "CLASS1.STR"; private int i = 0; static void Stringconvert (String str) {str = "string being converted."; } static void Stringconvert (Class1 c) {c.str = "string being converted.";} static void Add (int i) {i++;} static void A DDWITHREF (ref int i) {i++;} static void Main () {int i1 = ten; int i2 =; string str = "STR"; Class1 C = new Class1 (); ADD (I1); Addwithref (ref i2); ADD (C.I.); Stringconvert (str); Stringconvert (c); Console.WriteLine (I1); Console.WriteLine (I2); Console.WriteLine (C.I.); Console.WriteLine (str); Console.WriteLine (C.STR); }} 6 solution. (Examine value references and object references) 0 str string being converted. --------7. Write out the output of the program public abstract class A {public A () {Console.WriteLine (' A ');} public virtual void fun () {Consol E.writeline ("A.fun ()"); }} public class B:a {public B () {Console.WriteLine (' B '),} public new void Fun () {Console.WriteLine ("B.fun ()");} pub Lic static void Main () {A A = new B (); A.fun ();}} 7 Solutions. A B A.fun () (examine the constructor in the inheriting class, and the new method,)//--------8. Write out the output of the program: public class A {public virtual void Fun1 (int i) {Console. WriteLine (i); } public void Fun2 (a a) {a.fun1 (1); FUN1 (5); }} public class B:a {public override void Fun1 (int i) {base. FUN1 (i + 1); public static void Main () {b b = new B (); A = new A (); A.fun2 (b); B.fun2 (a); }} 8 solution. 2 5 1 6//--------9. The rules for the number of columns are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34 ... The 30th digit is the number, which is realized by recursive algorithm. (C # language) 9 solution. public class MainClass {public static void Main () {Console.WriteLine (Foo ()), public static int Foo (int i) {if (I &L t;= 0) return 0; else if (i > 0 && I <= 2) return 1; else return foo (i-1) + foo (i-2); }}//--------10. Program design: The cat shouted, all the mice began to flee, the master was awakened. (C # language) Requirements: 1. To be interactive, the behavior of the mouse and the master is passive. 2. Considering extensibility, cat calls can cause other linkage effects. 10 solution, Points: 1. Linkage effect, run code as long as the cat.cryed () method is executed. 2. Abstract scoring criteria for mice and Masters: <1> constructs cat, Mouse, master three classes, and enables the program to run (2 points) <2> extract abstract (5 points) <3> linkage effects from Mouse and master As long as the execution of cat.cryed () can make the mouse escape, the master awakened. (3 points) public interface Observer {void Response ();The observer's response, as the mouse sees the cat's reflection, is public interface Subject {void Aimat (Observer obs);//for which observers, this refers to the cat's object to catch---mouse} public class Mouse: Observer {private string name; public Mouse (string name, Subject subj) {this.name = name; subj. Aimat (this); } public void Response () {Console.WriteLine (name + "attempt to escape!");}} public class Master:observer {public Master (Subject subj) {subj. Aimat (this); } public void Response () {Console.WriteLine ("Host waken!");}} public class Cat:subject {Private ArrayList observers, public Cat () {this.observers = new ArrayList (), public void A Imat (Observer obs) {this.observers.Add (OBS), public void Cry () {Console.WriteLine ("Cat cryed!"); foreach (Observer obs In This.observers) {Obs. Response (); }}} class MainClass {static void Main (string[] args) {cat cat = new Cat (); Mouse mouse1 = new Mouse ("Mouse1", cat); Mouse mouse2 = new Mouse ("Mouse2", cat); Master master = new Master (CAT); Cat. Cry (); }}//--------Design Method Two: Use event-delegate design. Public delegate void Subeventhandler (); Public abstract class Subject {public event Subeventhandler subevent; protected void Fireaway () {if (this). SubEvent! = null) this. SubEvent (); }} public class Cat:subject {public void Cry () {Console.WriteLine ("Cat cryed."); Fireaway (); }} public abstract class Observer {public Observer (Subject sub) {Sub. SubEvent + = new Subeventhandler (Response); } public abstract void Response (); public class Mouse:observer {private string name; public Mouse (string name, Subject sub): Base (sub) {this.name = NA Me } public override void Response () {Console.WriteLine (name + "attempt to escape!");}} public class Master:observer {public Master (Subject sub): Base (sub) {} public override void Response () {Console.writel INE ("host Waken"); }} class Class1 {static void Main (string[] args) {cat cat = new Cat (); Mouse mouse1 = new Mouse ("Mouse1", cat); Mouse mouse2 = new Mouse ("Mouse2", cat); Master master = new Master (CAT); Cat. Cry (); } } //-------- *Question://--------1. Asp. What are the authentications in net? What is your current project in the way of validation please explain 2. What is a Web control? What are the advantages of using Web controls? 3. Please explain the ASP. How does data validation be done in net? 4. What do you think about regular expressions? 5. Asp. How many kinds of controls are there in the CPC? What's the difference? 6. Web control can stress a service-side event, how does a server-side event occur and explain its rationale? What is automatically returned? Why use automatic returns. 7. Can Web controls and HTML service-side controls invoke client methods? If so, please explain how to call? 8. Asp. What are the advantages of net versus ASP? 9. Please explain the important node 10 in the Web. config file. Please explain the ASP. What is the relationship between a Web page in net and its hidden class? 11. What is viewstate, can I disable it? Are the controls you use disabled? 13. What could be the cause of the discovery that the input data on the page could not be read? How to solve 14. Please explain the order of code execution in a Web page. 15. Please explain what the context object is and under what circumstances you want to use context object 16. Please explain the difference between forwarding and jumping? 17. Please explain the way data is passed between different pages in ASP. 18. Please explain the ASP. NET 19 of the four controls between button LinkButton ImageButton and hyperlink. Please explain. NET multi-tier applications the data is transmitted in several ways between the middle and the layer. And explain the way you do it in your own project. 20. If an ASP appears. NET events can not be triggered by what causes? 21. What if you need to add a drop-down list box to a column in the Datagride control and bind the data? 22. Explain what is the difference between data binding in ASP and traditional data binding? 23. Please explain the difference between the event model implemented by the. NET implementation of a delegate and the event model implemented in Java using an interface. 24. Please explain what the explicit implementation of the interface means? Q: Under what circumstances do you use virtual methods? How does it differ from the interface? What is the difference between q:override and overloading? Q: What is the difference between a value type and a reference type? Q: How do I understand static variables? Q: How many ways are there to send requests to the server? What is the difference between a q:datareader and a dataset? Q: If you need to pass the variable value in a B/s structure, but you can not use session, Cookie, application, how many methods do you handle? Q: With. NEt do b/s structure of the system, you are using a few layers of structure to develop, the relationship between each layer and why such stratification? Q: How many stages does the software development process generally have? The role of each stage? Q: Microsoft has launched a series of application blocks, please name what you know Application block and explain its role? Q: Please list some of the design patterns you have used and under what circumstances do you use this mode? Q: How do you feel about webservice? Q: What is your interest in programming? How to solve the problem that you don't understand at work? How do you generally improve your programming level? Q: What is the reason for your departure? The following questions if you do not, please describe in more detail your solution and method Q: How to pass the Chinese parameters through hyperlinks? Q: Do you programmatically traverse all TextBox controls on the page and assign it a value of String.Empty? Q: Do you programmatically implement a bubbling sorting algorithm? 5. Do not call the C++/C string library function, write the function strcpy 1. The difference between property and attribute in C #, what are their uses, and what are the benefits of this mechanism? 2. Tell me about the Web service that you understand, how well the XML is combined in the DOT NET Framework (and the concept is OK) 3. C #, Java and C + + features, what are the same places, different places, C # from C + + and Java to draw their advantages? 4. Can C # directly manipulate memory? (This is a difficult point oh?) Be careful! ) 5. Code written in Visual C + + 6.0 (unmanaged code), how to combine with other dot net component under the CLR? 6. A number of projects that have been previously made? Introduce your own programming experience. (This is not the past, the basic question will know is true) 7. What do you expect from the company? What is your salary expectation? Why learn computer? Previous work experience (this is very important)? Q3: Maintain database integrity, consistency, do you prefer to use triggers or self-write business logic? Why Q4:ado. What are some of the major improvements in net versus ADO? Q5:asp. NET compared with ASP, what is the main progress? What are the delegates in q6:c#? Is the event a delegate? Q7: Describe the implementation of indexers in C #, and can they be indexed only by numbers? What is the implementation process for a class to support a foreach traversal in q8:c#? Q10: Write an HTML page, to achieve the following functions, left click on the page to display "Hello", right click on the display "No right button." and automatically closes the page after 2 minutes. Q11: You're against XMLHT.TP, WEBSERVICE understand? Simply describe its characteristics, function Q12: What is the difference between an interface and an abstract class? What is the basis of your choice to use interfaces and abstract classes? Q13: What are the similarities and differences between custom controls and general user controls? What would you choose if you were to use one of these two? Why Q14: Roughly describe the ASP. NET server control life cycle Q15:UML Q16: Object-oriented concept, main features Q17: The basis of class division. The problem of class granularity Q18: The problem of management of things first, talk about final, finally, finalize the difference. Second, Anonymous Inner class (anonymous inner Class) can extends (inherit) other classes, can implements (implement) interface (interface)? Thirdly, the Static Nested class and the Inner class are different, the more said the better (some of the questions are very general). The difference between,& and &&. The difference between HashMap and Hashtable. The difference between the Collection and the collections. VII, when to use the Assert. What's the GC? Why do you have a GC? The ninth, string s = new string ("XYZ"), and the creation of several string Object? Tenth, Math.Round (11.5) how much? Math.Round (-11.5) how much? 11th, short S1 = 1; S1 = s1 + 1; what's wrong? Short S1 = 1; S1 + = 1; what's wrong? 12th, what is the difference between sleep () and wait ()? 13th, does Java have a goto? 14th, does the array have the length () method? Does string have the length () method? 15th, the difference between overload and override. Can the overloaded method change the type of the return value? 16th, the elements in set cannot be duplicated, so what is the method used to distinguish between duplicates or not? Are you using = = or equals ()? What is the difference between them? 17th, give me one of your most common runtime exception. 18th, what is the difference between error and exception? 19th, List, Set, map inherit from collection interface? 20th, what is the difference between abstract class and interface? 21st, whether the method of abstract can beWhen is static, whether it can be native at the same time, whether it can be synchronized at the same time? 22nd, can interfaces inherit interfaces? is an abstract class achievable (implements) interface? Does an abstract class inherit entity classes (concrete Class)? 23rd, start a thread with run () or start ()? 24th, can the constructor constructor be override? 25th, is it possible to inherit the string class? 26th, when a thread enters an synchronized method of an object, does the other thread have access to other methods of this object? 27th, there is a return statement in the try {}, then the code in the finally {} immediately after the try will not be executed, when executed, before or after the return? 28th, the programming question: the most efficient way to figure out 2 times 8 and so on? 29th, two object values are the same (x.equals (y) = = true), but can have different hash code, this sentence is not correct? 30th, when an object is passed as a parameter to a method, this method can change the properties of the object and return the changed result, so is this a value pass or a reference pass? 31st, whether the Swtich can function on a byte, whether it can function on a long, whether it can work on a string? 32nd, the programming question: Write a singleton out. One. The three-dimensional operator in the fill-in question 1.c# is __?:___? 2. When the integer A is assigned to an object, the integer a will be boxed (encapsulated) __? 3. Does the class member have an accessible form of _____? this.; New Class (). Method; 4.public static const int a=1; Is this code wrong? What is it? Const can not be modified with static 5.float f=-123.567f; int i= (int) F; The value of I is now _____? 123 6. What is wrong with operator declaration and only "= =" declared? 7. What is the keyword of the delegate declaration? Delagete 8. What are the characteristics of a class decorated with sealed? Sealed, cannot inherit 9. All custom user controls must inherit from ________ in ASP. Control 10. All serializable classes in. NET are marked as _____? 11. We don't have to worry about memory leaks in. NET managed code because of the ______?GC 12. Is there any error 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 (); /new public abstract void F (); } 13. When the class T only declares the private instance constructor, then outside of the program text of T, ___ can derive a new class from T, either ___ (or not), and no instance of T can be created directly by ____ (or not). 14. Is there an error in the following code? switch (i) {case (): Casezero (), break, Case 1:caseone (), break, case 2:dufault;//wrong casetwo (); 15. In. NET, can a class System.Web.UI.Page be inherited? Can two. Simple answer 1. What are the meanings of the two keywords using and new in C #, please write what you know? Using directives and statement new Create instance new hides the base class in method 4. Talk about the difference between class and structure? A class is a reference type, a struct is a value type 5. A string of length 10000 is composed of randomly extracting 10,000 characters from A-Z. Please write the main program in C # language to implement. 6. For such an enumeration type: Enum color:byte{Red, Green, Blue, Orange} string[] Ss=enum.getnames (typeof (Color)); Byte[] Bb=enum.getvalues (typeof (Color)); Try to write a program that shows all the symbol names defined in the enumeration type and their corresponding values. 7. Do you understand design patterns? Please list the name of the design pattern you know. 8. Design a table in SQL Server to hold an organization chart of a tree structure (assuming that only the name in the structure is required to save), what do you think if I want to query all the positions in a position and use a stored procedure to implement it? 9. What is SQL injection and how do I prevent it? Please illustrate. 10. What does the following code output? Why? int i=5; int j=5; if (Object.referenceequals (I,J)) Console.WriteLine ("Equal"); else Console.WriteLine ("Not Equal"); 1. Write a method that implements the flip of a string, attaching some conditions, such as ",", ".", to the design of the test case. 2. A paper cup design test case (can be generalized cup, not necessarily a particular function of the cup) development of the concept of the language 3. What is reflection? 4. How to write design patterns with singleton What is the garbage collection mechanism in 5.c#? 6. What is Application Pool? 7. The difference between the list and the array, what are the advantages and disadvantages. 8.Remoting How is the client server implemented? 9. What is a friend function? 10. How to achieve polymorphism with standard C? 11. What is a virtual function? 12. What are abstract functions? 13. What is a memory leak, and what is the simplest way to determine which leaks are stored? English question 14. Introduce the project using c#/c++ in English, the main function 15. If you want to have a conference call with the United States, how to communicate with engineers in the United States 16. If the boss thinks your technique is backward, how will you answer the database knowledge question 17. What tools are used to invoke the stored procedure 18.SQL What are the two types of server indexes? The role of the index? What are the advantages and disadvantages of indexes? 19. Effects of triggers other knowledge questions and questions 20. What is a Web Service? 21. What is XML? How is 22.Socket implemented? This document is downloaded by A5 Http://down.admin5.com collection and collation, the copyright belongs to the original author. A5 download provides a huge amount of source code, software, materials, tutorials, documentation download. If you happen to like to play basketball, please login www.siboding.com to buy the authentic low-priced Carlsberg basketball
[Organize]c#. NET common interview questions with Answer (ZT)