Access rights for private, protected, public, internal modifiers

Source: Internet
Author: User
Tags sql server driver odbc sql server driver

3. Describe the access rights of private, protected, public, and internal modifiers.
Private: A privately owned member that can be accessed within a 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 the auto-growing ID as the primary key, note that the ID may not be contiguous. )
Select Top * from a where ID not in (select top with ID from a)
Solution 2:select Top * from a Where ID > (select MAX (ID) from (select top with ID from a) as A)
5. Lists several ways to pass values between ASP.
Use querystring, such as ...? id=1; Response. Redirect () ....
2. Use the session variable
3. Using Server.Transfer
2. Please describe the methods used to pass parameters between pages in. NET, and say their pros and cons.
Session (viewstate) simple, but easy to lose
Application Global
Cookies are simple, but may not be supported, may be forged
Input ttype= "hidden" is simple and may be forged
URL parameter is simple, display in the address bar, the length is limited
The database is stable and secure, but the performance is relatively weak
2. The difference between override and overload
Override the method used to override the parent class, overloading a method or operator with the same name with different types of parameters
3. What is the error handling mechanism for. Net
The. NET error handling mechanism uses the try->catch->finally structure, where an error occurs, and the layer is thrown until a matching catch is found.
4. The similarities and differences between interfaces and classes in C #
Interfaces and classes are classes, different things, interfaces contain only the declaration of a method or property, do not contain the code of the implementation method, the interface can implement multiple inheritance, and the class can only be single inheritance, the class that inherits the interface must implement the method or property declared in the interface. Interface mainly defines a specification, unified call method, the interface is playing an increasingly important role in large-scale projects.
4. Similarities and differences between DataReader and datasets
The biggest difference between the DataReader and the DataSet is that DataReader always consumes SqlConnection when used, and operates the database online. Any operation on SqlConnection throws a DataReader exception: Because DataReader only loads one piece of data in memory at a time, the memory consumed is small. Because of the particularity of DataReader and high performance. So DataReader is only in. After you read the first one, you can't read the first one.
A dataset loads data into memory at once. Discard database connections. Discard database connection after reading. Because the dataset loads all of the data in memory. So the comparison consumes memory ... But be more flexible than DataReader. You can dynamically add rows, columns, and data. Callback Update to database ...
What is the meaning of the two keywords using and new in C #, please write what you know?
The using introduces a namespace, or automatically calls its idespose,new after using a pair of images, instantiates a pair of images, or modifies a method that tables this method to completely override this method
2. 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 () {
public override void Printfields () {
Console.WriteLine ("X={0},y={1}", X, y);
What output is generated when you use new B () to create an instance of B? X=1,y=0
3. In the following example
Using System;
Class A
public static int X;
Static A () {
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 is the resulting output? x=1,y=2
4. What is the difference between class and structure?
The biggest difference is that one is a reference type, and one is a value type the default member access for public is another difference
1. How to get the handle of the current form or control in. NET (C # or, especially the handle to the control itself (list).
This (C #) Me (
2 How users customize messages in. NET (C # or and process them in a form.
Overload the Defwndproc function in the form to process the message:
protected override void Defwndproc (ref System.WinForms.Message m)
Switch (m.msg)
Case Wm_lbutton:
String differs from the use of the format function of CString in MFC
String message = String. Format ("Message received!" parameter: {0},{1} ", M.wparam,m.lparam);
MessageBox.Show (message);///Display a message box
Case USER:
Code to process
Base. Defwndproc (ref m);///Call the base class function to process a non-custom message.
3. How to start another program in. NET (C # or Process
4. How to cancel the closing of a form in. NET (C # or
private void Form1_Closing (object sender, System.ComponentModel.CancelEventArgs e)
5. is appplication.exit or form.close different in. NET (C # or
Answer: One is to exit the entire application and one is to close one of the form
6. There is a double variable in C #, such as 10321.5, such as 122235401.21644, which is exported as the value of the currency according to the habits of the various countries. For example, the United States with $10,321.50 and $122,235,401.22 in the United Kingdom is £10 321.50 and £122 235 401.22
System.Globalization.CultureInfo myculture = new System.Globalization.CultureInfo ("en-us");
System.Globalization.CultureInfo myculture = new System.Globalization.CultureInfo ("EN-GB"), for UK currency type
Decimal y = 9999999999999999999999999999m;
String str = String.Format (myculture, "My amount = {0:c}", y);
7. A password uses only K, L, M, N, o a total of 5 letters, the words in the password are arranged from left to right, the password Word must follow the following rules:
(1) The minimum length of a password word is two letters, can be the same, can also be different
(2) K cannot be the first letter of a word
(3) If L appears, the number of occurrences occurs more than once
(4) m cannot make the last one or the second-lowest letter
(5) k appears, then n must appear
(6) O if it is the last letter, L must appear
Question one: Which of the following letters can be placed behind O in the Lo to form a 3-letter password word?
A) K B) L C) M D) N
Answer: B
Question two: If you can get the letter is K, L, M, then can form a two-letter long password word number of how many?
A) 1 B) 3 C) 6 D) 9
Answer: A
Question three: Which of the following is the word password?
A) Klln B) loml C) Mllo D) Nmko
Answer: C
8.62-63=1 equation does not hold, please move a number (can not move minus and equal sign), so that the equation is set up, how to move?
Answer: 62 moved to 2 of the 6-time Square
New has several uses
First type: New Class ();
The second type: Coverage method
Public new XXXX () {}
Third: The new constraint specifies that any type parameter in a generic class declaration must have a public parameterless constructor.
2. How to copy an array into the ArrayList
foreach (object o in array) arraylist.add (o);
What data sources can 3.datagrid.datasouse connect to [Dataset,datatable,dataview]
Dataset,datatable,dataview, IList
4. Overview of Reflection and serialization
Reflection: Assemblies contain modules, while modules contain types, and types also contain members. Reflection provides an object that encapsulates assemblies, modules, and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get a type from an existing object. You can then invoke a method of the type or access its fields and properties
Serialization: Serialization is the process of converting an object into a format that is easy to transfer. For example, you can serialize an object and then use HTTP to transfer the object between the client and the server over the Internet. At the other end, deserialization reconstructs the object from the stream.
5. Overview of the principles of the O/R mapping
Use reflection to configure the mapping of classes to database tables
7. What are the characteristics of a class decorated with sealed?
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.
The sealed modifier is primarily used to prevent unintended derivation, but it also enables some runtime optimizations. Specifically, because sealed classes never have any derived classes, calls to virtual function members of instances of sealed classes can be converted to non-virtual calls to handle.
11. Detailed. The similarities and differences between class and struct in net!
Class: Put in? The struct is placed in?
struct Value passing
Classes have a lot in common with structs: structs can implement interfaces and can have the same member types as classes. However, structs differ from classes in several important ways: structs are value types rather than reference types, and structs do not support inheritance. The value of the structure is stored on the stack or inline. Careful programmers can sometimes enhance performance by intelligently using structures.
12. Overview. NET in the understanding and practical application of the two technologies of remoting and webservice.
Remote logic calls, the Remoing interface can only be used in. Net
13. What is Code-behind technology aspx and CS
14. Overview of the three-tier structural system web/business/dataaccess How to implement the MVC pattern, illustrate! Web/business/dataaccess
2. What is a user control in ASP.
A: The user control is the. ascx extension thing, and can be dragged to a different page to save code. For example, a login may be available on multiple pages, it can be made into a user control, but one problem is that the relative path of the user control to the different levels of the directory will become inaccurate, The self-written method adjustment is required.
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?
A: Boxing is to turn a value type into a reference type, from the MS Il perspective it looks like a boxing, and remember that the value is transferred from the stack to the heap. Unpacking instead, overloading means that a method name is the same as the number of arguments, and the return value can be the same method. The CLR is a common language runtime, others are unclear.
4. List the XML technologies you know and their applications
A: XML is a good thing, save the configuration, the communication between the station and the station, the WEB service will use it.
5. What is the difference between a value type and a reference type? Write the sample code for C #.
A: The structure is a value type, the class is a reference type, so the transfer structure is the application of the value type, the object or class is the reference type, this does not have to write more.
What are the objects commonly used in Describe it separately.
A: Connection command Sqladapter DataSet DataTable DataView and so on. I can't finish it.
7. How to understand the delegation?
A: It is said to be equivalent to a function pointer, which defines a delegate that can invoke the method without invoking the original method name.
This is explained in the msdn2005:
Delegates have the following characteristics:
A delegate is similar to a C + + function pointer, but it is type-safe.
A delegate allows a method to be passed as a parameter.
Delegates can be used to define callback methods.
Delegates can be chained together; For example, multiple methods can be called on an event.
method does not need to match the delegate signature exactly. For more information, see Covariance and contravariance.
C # version 2.0 introduces the concept of anonymous methods, which allow code blocks to be passed as parameters in place of a separately defined method.
What are the similarities and differences between the interfaces and classes in 8.c#.
A: The interface is responsible for the definition of the function, the project through the interface to standardize the class, Operation class and abstract class concept!
And the class is responsible for the specific implementation of the function!
There are also definitions of abstract classes in classes, and the difference between abstract classes and interfaces is that:
Abstract class is an incomplete class, there are abstract methods in the class, properties, can also have specific methods and properties, need further specialization.
But the interface is a specification of behavior, and everything inside is abstract!
A class can inherit only one base class, which is the parent class, but can implement multiple interfaces
9.. What classes are needed to read and write databases in net? Their role
A: This kind of self can write, ah, you mean the base class? That Configuration,sqlconnection,sqlcommand to be used.
The similarities and differences between 10.UDP connections and TCP connections.
A: The former just preach, regardless of the data to not, no need to establish a connection. The latter ensures that the transmitted data is accurate and needs to be linked.
What are the authentication methods for What is the principle of the distinction?
A: Form authentication, Windows Integrated authentication, etc., the principle is not clear.
13. What is Code-behind technology?
A: Code separation, this is a sensible thing, like ASP to mix a bunch of very uncomfortable. Or it can be interpreted as HTML code written in the foreground, C # code written in the background. Of course, the front desk also has scripts, class calls, in fact, written together is also possible.
What namespaces are owned by classes that read and write XML in
Answer: System.Xml
16. Explain the meaning and role of UDDI, WSDL.
17. What is soap and what are the applications?
A: SOAP (Simple Object access Protocol) is an XML-based protocol that is a protocol for exchanging information and executing remote procedure calls in a decentralized or distributed environment. Using SOAP, regardless of any particular transport protocol (the most common or HTTP protocol), allows any type of object or code to communicate with each other, on any platform, in any language. This mutual communication takes the form of XML-formatted messages, see:
20. What are the common calling WebService methods?
You can use Http-get http-post to access Web services from a browser, ASP page, or other Web service call, or you can make a SOAP request to another Web service from an ASP page or other Web service http-get http-post Soap Using the Web service proxy
6. What is the difference between a private assembly and a shared assembly?
A private assembly is typically used by a single application and stored in the same directory as the application, or in a subdirectory below the directory. Shared assemblies are typically stored in the global Assembly cache, which is a set of. The assembly repository maintained by the net runtime. Shared assemblies are typically code libraries that are useful to many applications, such as the. NET Framework classes.
7. Please explain the difference between a process and a thread? What is the difference between a process and a program?
In general, an application that corresponds to one or more processes can think of a process as the identity of the application in the * system, whereas a process is usually composed of multiple threads, and the thread is the smallest unit in which the system allocates processing time for the application.
8. What does the CLR and Il mean respectively?
CLR: The common language runtime, similar to a Jvm,java virtual machine in Java; NET environment, various programming languages use a common basic resource environment, which is that CLR,CLR will communicate directly with the * system, and programming languages such as C #. NET will try to avoid direct communication with the * system, and enhance the execution security of the program code, you can see: The CLR is a specific programming language such as: C #. NET-to-system translation, and it provides a number of resources for specific programming languages:
IL, intermediate language, also known as MSIL, Microsoft intermediate Language, or CIL, generic intermediate language; NET source code (written in any language) is compiled into IL at compile time. The instant (JUST-IN-TIME,JIT) compiler processes the machine code, which is interpreted and executed, as the application runs.
10. Please explain the ASP. How the data is validated in net
Non-null validation in, comparison validation, value range validation, regular expression validation and customer custom validation five controls, plus a centralized validation information processing control
11. Web controls can fire server-side events, how do server-side events occur and explain their rationale? What is automatically returned? Why use automatic returns.
When a Web control event occurs, the client submits the data back to the server in the form of a commit, and the server invokes the Page_Load event, and then automatically invokes the server-side event based on the state information returned when we click on the client control, the data is passed directly back to the server using the submission form.
Only the mechanism of server-side events can be implemented by automatic return, and only client-side events can be invoked without the automatic callback mechanism, but not the server event
12. Can Web controls and HTML service-side controls invoke client methods? If so, please explain how to call?
Can call
For example: <asp:textbox id= "TextBox1" FONT-SIZE:9PT; Color:black ">clientfunction ();" runat= "Server" >
<input id= "Button2" value= "button" Name= "Button2"
runat= "Server" FONT-SIZE:9PT; Color:black ">clientfunction ();" >
13. Please explain important nodes in the Web. config file
AppSettings contains custom application settings.
System.Web System Configuration
Compilation Dynamic Debug Compilation settings
customerrors Custom Error message settings
Authentication authentication, this section sets an authentication policy for the application.
Authorization authorization, this section sets the authorization policy for the application.
14. 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 to use when compiling this page
inherits= "T1.tst1" Table uses which hidden class to use for runtime
15. What is viewstate, can I disable it? Are the controls you use disabled?
ViewState is a mechanism for saving state, and the EnableViewState property is set to False to disable
16. What could be the cause of the discovery that the input data on the page could not be read? How to Solve
It is possible that the IsPostBack property of the page is not judged when data is processed in Page_Load
17. Please explain what the context object is, and under what circumstances you want to use the context object
The context object refers to the current property of the HttpContext class and is used when we want to access the built-in object (Response,request,session,server,appliction, etc.) in a normal class
18. Please explain the difference between forwarding and jumping?
Forwarding is the service side of the jump a page to submit data to B page, b page processing and then jump from the server to other pages
Jump refers to the client's jump
1. Please briefly describe the detailed steps for programming synchronous communication with a socket
1. Initializing sockets using protocols and network addresses in applications and remote devices
2, in the application through the specified port and address to establish the monitoring
3. The remote device makes a connection request
4, the application accepts the connection to produce the communication Scoket
5. Application and Remote device start communication (application will hang in communication until end of communication)
6, end of communication, close the application and remote device socket recovery resources
1. In C #, string str = null and string str = "" Try to use text or an image to illustrate the difference.
String str = NULL is not allocated memory space to him, while string str = "" Assigns it a memory space with a null character channeling length.
2. Please describe the similarities and differences between class and structure (struct) in dotnet: (10 points)
Class can be instantiated, is a reference type, is allocated on the heap of memory, the struct belongs to the value type, is allocated on the memory stack.
3, according to the knowledge of the delegate (delegate), complete the following code snippet in the user control to fill in: (10)
Namespace test
public delegate void Ondboperate ();
public class UserControlBase:System.Windows.Forms.UserControl
public event Ondboperate OnNew;
Privatevoidtoolbar_buttonclick (Objectsender, e)
if (E.button.equals (btnnew))
Use the following complement code to invoke the OnNew event for the Ondboperate delegate signature.
if (onnew! = null)
OnNew (this, e);
4. Analyze the following code to complete the blanks (10 points)
String strtmp = "ABCDEFG xxx";
int i= System.Text.Encoding.Default.GetBytes (strtmp). Length;
int j= strtmp.length;
After the execution of the above code, i= j= I really do not know, j=10
5. SQL Server, there are two field IDs in the given table Table1, Lastupdatedate,id represents the updated transaction number, Lastupdatedate represents the server time when updating, use a SQL statement to obtain the last updated transaction number. (10)
Select top ID from table1 order BY lastupdatedata Desc
8. Briefly discuss your understanding of the two technologies of remoting and webservice under the Microsoft. NET Framework and the practical applications. (10)
Remoting is a technique used in. NET to make method calls across machine, process, and AppDomain, and for a 30%-structured program, it can be built using remoting technology. It is the basic technology for distributed applications. The equivalent of the previous DCOM Web service is a common model for building applications and can be implemented on all operating systems that support Internet network communication. Web Service enables component-based development and the combination of the web to achieve the best, component-based object model
9. What is SQL injection and how do I prevent it? Please illustrate.
Use the SQL keyword to attack a website. Filter keywords ' etc
The so-called SQL injection (SQL injection), is to use the programmer to the user input data legitimacy detection is not strict or non-detection characteristics, deliberately submitted special code from the client, so as to collect program and server information, so as to obtain the desired data.
http://localhost/lawjia/show.asp?ID=444 and User>0, at this point, the server runs the select * from table name where field =444 and user>0 such a query, of course, This statement is not going to work, definitely error, error message is as follows:
• Type of error:
Microsoft OLE DB Provider for ODBC Drivers (0X80040E07)
[Microsoft] [ODBC SQL Server Driver] A syntax error occurred when SQL Server converted the nvarchar value ' sonybb ' to a column with a data type of int.
A generates an int array with a length of 100 and a random insertion of 1-100 into it, and cannot be duplicated.
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= (int) myList;
20. Please describe the difference between class and structure.
1), structure is the value type;
2), the structure does not support inheritance;
3), the structure can not define the default constructor;
4), the structure cannot define the destructor;
5), structure cannot use the initial value to set the domain value.

Private, protected, public, internal modifier access rights

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: 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.