What is the use of 1.using keywords? What is IDisposable?
The using can declare the introduction of namespace, and can also implement the release of unmanaged resources, implement the Idisposiable class in the using, and automatically invoke the Dispose method of the object when the using ends, freeing the resource. Using is actually equivalent to try......finally, which is more convenient to use.
2.assembly.load ("Foo.dll"); Is this sentence correct?
Error, the correct one should be Assembly.Load ("foo"); or Assembly.LoadFrom ("Foo.dll");
The main difference between 3.XML and HTML
(1) XML is case-sensitive, HTML is not distinguished.
(2) in HTML, if the context clearly shows where the paragraph or list key ends, you can omit the end tag such as </p> or </li>. In XML, you must never omit the end tag.
Html:<br><br>
Xml:</img><br/><br/>
(3) in XML, an element that has a single tag without a matching closing tag must end with A/character. This way the parser knows not to look for the end tag.
(4) in XML, attribute values must be enclosed in quotation marks. In HTML, the quotation marks are available for use.
(5) In HTML, you can have a property name without a value. In XML, all attributes must have corresponding values.
XML is used to store and transfer data, and HTML is used to display the data
4.string str = NULL with string str = "" describes the difference.
A: string str = NULL does not allocate memory space to him, and string str = \ "\" assigns it a memory space with an empty string length. string str = NULL no string object, String str = "" has a string object.
5. Write out an SQL statement: Take the 31st to 40th record in table A (SQL Server, with the auto-growing ID as the primary key, note that the ID may not be contiguous. )
Answer: 1:select top * from a where ID not in (select top IDs from a)
Solution 2:select Top * from a Where ID > (select MAX (ID) from (select top with ID from a) as A)
Solution 3:select Id,row_number () over (order by ID) as RowNum from A where rowNum between and 40 (recommended)
6. The object-oriented language has ________. _________. ________ Sex
Answer: encapsulation. Inheritance. Polymorphism.
7. All serializable classes in. NET are marked as _____?
Answer: [Serializable]
8. We don't have to worry about memory leaks in. NET managed code, because we have ___?
Answer: GC.
9. What is an application domain? What is a regulated code? What is managed code? What is a strongly typed system? What are crates and unboxing? What is overloading? Cts. What are the CLS and CLR explanations for each?
The application domain is security. Reliability. Versioning and uninstalling assemblies provide an isolation boundary. Application domains are typically created by the runtime host, which is responsible for booting the common language runtime before running the application. application domains provide a more secure, more versatile processing unit that the common language runtime can use to provide isolation between applications.
Regulated code: Any code that runs in the. NET environment is controlled code (managed). NET external code is also running on Windows, which is called an unregulated code (unmanaged).
Code developed using a language compiler based on the common language runtime is called managed code, and managed code has many advantages, such as cross-language integration. Cross-language exception handling. Enhanced security. Version control and deployment support. Simplified component Interaction Model-debugging and Analysis Services.
A strongly typed language is a language that can prohibit any code that violates a type system, or that is capable of capturing all errors that violate a type system. We say that C + + is strongly typed in C + +, because C + + prohibits implicit conversions in C, such as converting void* to arbitrary pointer types.
Boxing and unpacking enable value types to be treated as objects. Boxing a value type packages the value type into an instance of the Object reference type. This allows value types to be stored in the garbage-collected heap. Unpacking will extract the value type from the object.
Each type member has a unique signature. A method signature consists of a method name and a list of parameters (the order and type of the parameters of the method). Multiple methods with the same name can be defined within a type as long as the signature is different. When you define two or more methods that have the same name, they are called overloads.
CTS Common type systems (common type System)
A specification that determines how the common language runtime defines. Use and manage types.
CLR Common language runtime
The. NET Framework provides a run-time environment called the common language runtime that runs code and provides services that make the development process easier.
CLS Common Language Specification
To fully interact with other objects, regardless of the language in which they are implemented, the object must expose to callers only the common functionality of all the languages that they must interoperate with. The common Language Specification (CLS) is defined for this purpose, which is a set of basic language features required by many applications.
10. What is Code-behind technology?
is code-behind, the separation of display logic and processing logic from the method of ASPX pages pointing to the CS file in ASP. This facilitates the creation of Web applications. such as division of labor, art and programming can be a dry, no longer like the previous ASP code and HTML code mixed together, difficult to maintain.
11. An interface is a reference type that can be declared in an interface. Properties. Indexers and events, but cannot declare public domain or private member variables.
12. In ADO, the ExecuteNonQuery () method and the ExecuteReader () method for the Command object are described below (c).
A) SQL statements such as Insert.update.delete are performed mainly with the ExecuteNonQuery () method;
b) The ExecuteNonQuery () method returns the number of rows affected by the execution of the SQL statement.
c) The SQL statement for the select operation can only be performed by the ExecuteReader () method;
D) the ExecuteReader () method returns a Datareder object;
Answer: Executescalar→select getdate ().
13. The following about the indexer in C # is understood correctly (c)
A) The parameters of the indexer must be two or more than two
b) The parameter type of the indexer must be an integer type
c) Indexer has no name
D) above are not
14. To create a multi-document application, you need to set the (d) property of the form to true.
a) DrawGrid;
b) ShowInTaskbar;
c) Enabled;
d) IsMdiContainer;
15. If Treeview1=new TreeView () is set, TREEVIEW1.NODES.ADD ("root node") returns a value of type (a).
a) TreeNode;
b) int;
c) string;
d) TreeView;
16. The following description of the XML error is (d).
A) XML provides a way to describe structured data;
b) XML is a simple. Platform-independent and widely adopted standard;
c) XML documents can carry a variety of information;
d) XML is just for the purpose of generating structured documents;
17. The following C # code attempts to define an interface:
public interface Ifile{int A;int Delfile () { A = 3;} void Disfile ();}
For the above code, the following description is incorrect (d).
A) errors in the above code include: The variable cannot be defined in the interface, so the int a code line will appear error;
b) Errors in the above code include: The interface method Delfile is not allowed to implement, so can not write a specific implementation function;
c) code void Disfile (); Declaration error-Free, interface can have no return value;
d) code void Disfile (); should be written as void Disfile () {}; null and NULL are not the same.
18. There is a button control in ASP. MyButton, if you click the control, navigate to the other page http://www.abc.com, the correct code is (c).
A) private void MyButton_Click (object sender, System.EventArgs e) {Redirect ("http://www.abc.com");}
b) private void MyButton_Click (object sender, System.EventArgs e) {request.redirect ("http://www.abc.com");}
c) private void MyButton_Click (object sender, System.EventArgs e) {reponse.redirect ("http://www.abc.com");}
d) private void MyButton_Click (object sender, System.EventArgs e) {request.redirect ("http://www.abc.com"); return true;}
19. Declare a delegate public delegate int mycallback (int x); The prototype of the callback method that is produced with the delegate should be (b).
a) void mycallback (int x);
b) int receive (int num);
c) string receive (int x);
D) uncertain;
What is the difference between 20.StringBuilder and String?
A: String in the operation (such as assignment. splicing, etc.) will produce a new instance, and StringBuilder will not. So it's best to use StringBuilder when a large number of string concatenation or frequent manipulation of a string, do not use string
If you want to manipulate a growing string, try not to use the string class instead of the StringBuilder class. Two classes work differently: The String class is a traditional way of modifying a string, and it does work to add a string to another string. Yes, but in. NET Framework, this operation is really not a row. Because the system first writes two strings to memory, then deletes the original string object, creates a string object, and reads the data in memory to the object. This carefree matter, it took a lot of time. This is not the case with the StringBuilder class under the System.Text namespace, which provides a append method that can be used to modify the string in place of an existing object, simply and directly. Of course, the difference between these two efficiencies is not generally noticeable, but if you are going to do a lot of adding to a string, the time and string classes that the StringBuilder class consumes are simply not an order of magnitude.
21. Please describe the difference between the attribute and the indexer.
Properties Indexer
identified by name. identified by signature.
Accessed through a simple name or member access. Accessed through element access.
Can be a static member or an instance member. Must be an instance member.
The get accessor for the property has no parameters. The get accessor of the indexer has the same formal parameter list as the indexer.
The set accessor of a property contains an implicit value parameter. In addition to the value parameter, the indexer's set accessor has the same formal parameter list as the indexer.
22. Please describe the difference between const and readonly.
The const keyword is used to modify the declaration of a field or local variable. It specifies that the value of a field or local variable cannot be modified. A constant declaration introduces one or more constants of a given type.
The declaration of a const data member must contain an initial value, and the initial value must be a constant expression. Because it is at compile time it needs to be fully evaluated.
A const member can be initialized with another const member, provided there is no cyclic dependency between the two.
The readonly evaluation assignment at run time allows us to defer the initialization of object to run time while ensuring "read-only access".
The ReadOnly keyword differs from the CONST keyword: the const field can only be initialized in the declaration of the field. The readonly field can be initialized in a declaration or constructor. Therefore, depending on the constructor used, the ReadOnly field may have different values. In addition, the Const field is a compile-time constant, and the ReadOnly field can be used to run a constant number.
ReadOnly can only be initialized at declaration time or in constructors, and cannot be inside the constructor of the static modifier.
Resources:
Http://www.cnblogs.com/royenhome/archive/2010/05/22/1741592.html
Http://www.cnblogs.com/jams742003/archive/2010/03/23/1692913.html
Http://www.cnblogs.com/wayfarer/archive/2006/04/27/386658.html
23. Please explain the ASP. What is the relationship between a Web page in net and its hidden class?
An ASP. NET page typically corresponds to a hidden class, which is typically specified in the declaration of an ASP. Page declaration of a hidden class such as a page tst1.aspx the following
<%@ page language= "C #" codebehind= "Tst1.aspx.cs" autoeventwireup= "false" inherits= "T1.tst1"%>
Codebehind= "Tst1.aspx.cs" indicates which code file is used when compiling this page, which hidden class is used by the inherits= "t1.tst1" Table with runtime
24. What is viewstate, can I disable it? Are the controls you use disabled?
ViewState is a mechanism for saving States, and the EnableViewState property is set to False to disable. The most powerful example: Label.textbox after disabling viewstate different performance to illustrate.
25. What is your experience with Web service?
A: If you write some of the programs you want others to use through the Web services, you can also write their own methods labeled [webmethed] to implement Web services. [is when writing a program, you want to implement some other sites have been implemented, but also with Web services to be visualized as an XML language encoding. You can use the XML generated by someone else's code to find the information you need to implement some of the functions of the program you write.
26. Under what circumstances do you use virtual methods? How does it differ from the interface?
Answer: When a subclass re-defines a method of a parent class, the method of the parent class must be defined as virtual
There cannot be a method body in the definition interface, the virtual method can.
When implemented, subclasses can not redefine virtual methods, but if a class inherits an interface, that interface must be implemented.
27. Indefinite selection:
(1) The following description is correct: B C
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) Read the records from the database, you may use the method is: B C D
A. ExecuteNonQuery b. executescalar C. Fill D. ExecuteReader
(3) For a class that implements the IDisposable interface, which of the following can perform application-defined tasks related to releasing or resetting unmanaged resources? (Multiple selection) (ABC)
a.close b.dispose c.finalize D.using E.quit
(4) Which of the following descriptions of ref and out are correct? (Multiple selection) (ACD)
A. With the ref parameter, the arguments passed to the ref parameter must be initialized first.
B. With the out parameter, the arguments passed to the out parameter must be initialized first.
C. With the ref parameter, the parameter must be passed explicitly to the method as a ref parameter.
D. With the out parameter, the parameter must be passed explicitly to the method as an out parameter.
28. Single Choice:
(1) The following options, (C) are reference types.
A) enum type B) struct type c) string type d) int type
(2). Description of the code-behind file in ASP. Correct is (C)
A) The logic of a Web Forms page's program consists of code that is created to interact with the form. The programming logic is unique in a file that differs from the user interface. The file is called a "code-behind" file, and if created in C #, the file will have a ". Ascx.cs" extension.
b) The code-behind files for all Web Forms pages in the project are compiled into an. exe file.
c) The code-behind files for all Web Forms pages in the project are compiled into a project dynamic link library (. dll) file.
D) above are not correct.
(3). The following description is incorrect (D)
A) The class cannot have multiple inheritance and interface can;
b) The abstract class itself can define members and interfaces can not;
c) Abstract classes and interfaces are not instantiated;
D) A class can have multiple base classes and multiple base interfaces;
What are the similarities and differences between 29.DataReader and datasets?
DataReader Always use SqlConnection, online operation database, each time only in memory load a piece of data, so the memory is very small, is only in. Read-only
A dataset loads data into memory at once. Discard database connections. After reading, the database connection (non-connected mode) is discarded, and all the data is loaded in memory. So the comparison consumes memory ... But be more flexible than DataReader. You can dynamically add rows, columns, and data. Callback Update operation for database (dynamic operation of data read into memory)
30.public static const; int a = 1; Is this code wrong?
Error: const cannot be decorated as static, because it is statically when defined as a constant (const).
. NET pen question set (ii)