Three. Net classical pen questions and three. net questions that American enterprise personnel like to take
1. Evaluate the values of the following expressions and write out one or more implementation methods you have come up with: 1-2 + 3-4 + ...... + M
A:
Int Num = this. TextBox1.Text. ToString ();
Int Sum = 0;
For (int I = 0; I <Num + 1; I ++)
{
If (I % 2) = 1)
{
Sum + = I;
}
Else
{
Sum = Sum-I;
}
}
System. Console. WriteLine (Sum. ToString ());
System. Console. ReadLine ();
2. Use. net as a B/S structure system. How many layers of structure do you use to develop the relationship between each layer and why do you need to layer it like this?
A: layer by MVC
Generally Three Layers
Data access layer, business layer, and presentation layer.
The data access layer adds, queries, and modifies databases.
The business layer is generally divided into two layers. The business apparent layer communicates with the presentation layer, and the business rule layer Implements user password security.
The presentation layer adds a form to interact with users, for example, users.
Advantages: clear division of labor, clear organization, easy debugging, and scalability.
Disadvantage: increase costs.
3. In the following example
Using System;
Class
{
Public ()
{
PrintFields ();
}
Public virtual void PrintFields (){}
}
Class B:
{
Int x = 1;
Int y;
Public B ()
{
Y =-1;
}
Public override void PrintFields ()
{
Console. WriteLine ("x = {0}, y = {1}", x, y );
}
What is the output when new B () is used to create B's instance?
Answer: X = 1, Y = 0; x = 1 y =-1