ASP. 60-Way Test

Source: Internet
Author: User
Tags finally block

1. Describe the access rights of private, protected, public, and internal modifiers.
For. 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.

2. Lists several ways to pass values between ASP.
A. 1. Use QueryString, such as ...? id=1; Response. Redirect () ....
2. Use the session variable
3. Using Server.Transfer

3. The rules for a 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.
Answer: public class MainClass
{
public static void Main ()
{
Console.WriteLine (Foo (30));
}
public static int Foo (int i)
{
if (i <= 0)
return 0;
else if (i > 0 && i <= 2)
return 1;
else return foo (i-1) + foo (i-2);
}
}

What are the delegates in 4.c#? Is the event a delegate?
For:
A delegate can substitute a method as a parameter into another method.
A delegate can be understood as a reference to a function.
Yes, it's a special kind of delegate.

The difference between 5.override and overloading
For:
Override is different from overloading. Overloading is the same as the name of the method. Different parameters or parameter types, multiple overloads to accommodate different needs
Override is an override of a function in a base class. In order to adapt to the need.

6. If you need to pass variable values in a B/s structure, but you cannot use session, Cookie, application, how many methods do you handle?
For:
This. Server.Transfer

7. Please programmatically traverse all TextBox controls on the page and assign it a value of String.Empty?
For:
foreach (System.Windows.Forms.Control Control in this.) Controls)
{
If (Control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox TB = (System.Windows.Forms.TextBox) control;
Tb. Text = String.Empty;
}
}

8. Do you programmatically implement a bubbling sorting algorithm?
For:
int [] array = new int

;
int temp = 0;
for (int i = 0; i < array. Length-1; i++)
{
for (int j = i + 1; j < Array. Length; J + +)
{
if (Array[j] < array)
{
temp = array;
Array = array[j];
ARRAY[J] = temp;
}
}
}

9. Describe the implementation of indexers in C #, and can they only be indexed by numbers?
Answer: No. Any type can be used.

10. Ask for the value of the expression below and write down one or more of the implementations you think of: 1-2+3-4+......+m
For:
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 ();

11. Using. NET to 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?
A: Generally 3 floor
The data access layer, the business layer, the presentation layer.
The data access layer makes additions and deletions to the database.
The business layer is generally divided into two layers, the business table layer realizes the communication with the presentation layer, the business rule layer realizes the user password security and so on.
The presentation layer adds a form in order to interact with the user such as a user.
Advantages: Clear division of labor, clear, easy to debug, but also scalable.
Cons: Increased costs.

12. 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 ()
{
Y=-1;
}
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?
Answer: x=1,y=0;x= 1 Y = 1

13. What is an application domain?
A: An application domain can be understood as a lightweight process. Play a safe role. Small resource footprint.

What are the 14.CTS, CLS, and CLR explanations for each?
A: CTS: a common language system. CLS: Common Language Specification. CLR: Common language runtime.

15. What are crates and unboxing?
A: Converting from a value type interface to a reference type boxing. Converting from a reference type to a value type unboxing.

16. What is a regulated code?
Answer: unsafe: Unmanaged code. Not run through the CLR.

17. What is a strongly typed system?
Answer: RTTI: type identification System.

What classes are needed to read and write databases in 18.net? Their role?
Answer: DataSet: Data memory.
DataCommand: Executes the statement command.
DataAdapter: The collection of data, the term padding.

What are the authentication methods for 19.asp.net? What is the principle of the distinction?
Answer: 10. Windwos (default) with IIS ... From (form) with account .... Passport (Key)

20. What is Code-behind technology?
A: Code after planting.

21. In. NET, what does the accessory mean?
Answer: Assembly. (intermediate language, source data, resources, assembly list)

22. What are the common methods of calling WebService?
Answer: 1. Use the WSDL.exe command-line tool.
2. Use the Add Web Reference menu option in Vs.net

What is the working principle of 23..net Remoting?
A: The server sends a process number to the client, a program field number to determine the location of the object.

24. In C #, string str = null with string str = "" Try to use text or an image to illustrate 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.

25. Please describe the similarities and differences between classes (class) and structure (struct) in dotnet.
A: 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.

26. Based on the knowledge of the delegate (delegate), complete the code snippet in the following user controls:
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))
{
Use the following complement code to invoke the OnNew event for the Ondboperate delegate signature.
}
}
}
Answer: if (onnew! = null)
OnNew (this, e);

27. Complete the blanks by analyzing the following code
String strtmp = "ABCDEFG xxx";
int i= System.Text.Encoding.Default.GetBytes (strtmp). Length;
int j= strtmp.length;
After executing the above code, i= j=
Answer: i=13,j=10

28.SQLSERVER server, the given table table1 has two field IDs, Lastupdatedate,id represents the updated transaction number, Lastupdatedate represents the server time when the update, use a SQL statement to obtain the last updated transaction number
Answer: Select ID from table1 Where lastupdatedate = (select MAX (lastupdatedate) from table1)

29. Based on the knowledge of thread safety, analyze the following code to see if the test method will cause a deadlock when i>10 is called? and briefly explain the reason.
public void Test (int i)
{
Lock (This)
{
if (i>10)
{
i--;
Test (i);
}
}
}
A: There is no deadlock, but a bit of int is passed by value, so each change is just a copy, so there is no deadlock. But if you change int into an object, the deadlock will happen.)

30. Briefly discuss your understanding of the two technologies of remoting and webservice under the Microsoft. NET Framework and the practical applications.
A: WS is primarily available with HTTP, penetrating firewalls. and remoting can use TCP/IP, binary delivery to improve efficiency.


31. The company requires the development of a component that inherits the System.Windows.Forms.ListView class, which requires the following special features: When you click a ListView column header, you can rearrange all the rows in the view by clicking each row of rows in the column ( Sort the same way as a DataGrid). According to your knowledge, please briefly talk about your ideas
A: Depending on the column header of the click, the ID of the package is taken out, sorted by that ID, and then bound to the ListView.

32. Given the following XML file, complete the algorithm flowchart.
<FileSystem>
< DRIVERC >
< Dir dirname= "MSDOS622" >
< File FileName = "Command.com" ></File>
</dir>
< File FileName = "MSDOS. SYS "></File>
< File FileName = "IO. SYS "></File>
</driverc>
</filesystem>
Please draw a flowchart that iterates through all filenames (using the recursive algorithm).
For:
void FindFile (Directory D)
{
Fileorfolders = D.getfileorfolders ();
foreach (Fileorfolder fof in Fileorfolders)
{
if (FoF is File)
You Found a file;
else if (FoF is Directory)
FindFile (FOF);
}
}

33. 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)

34. Object-oriented language has ________, _________, ________
Answer: encapsulation, inheritance, polymorphism.

35. Objects that can be accessed with a foreach traversal need to implement the ________________ interface or declare the type of the ________________ method.
Answer: IEnumerable, GetEnumerator.

What is 36.GC? Why do you have a GC?
A: The GC is a garbage collector. Programmers don't have to worry about memory management because the garbage collector is automatically managed. To request garbage collection, you can call one of the following methods:
System.GC ()
Runtime.getruntime (). GC ()

37.String s = new string ("XYZ"); several string Object created?
A: Two objects, one is "XyX", the other is a reference object pointing to "XyX" s.

What is the difference between 38.abstract class and interface?
For:
A class that declares the existence of a method and does not implement it is called an abstract class, which is used to create a class that embodies some basic behavior, declares a method for that class, but does not implement the class in that class. An instance of the abstract class cannot be created. However, you can create a variable whose type is an abstract class that points to an instance of a specific subclass. Cannot have abstract constructors or abstract static methods. The subclasses of the abstract class provide implementations for all abstract methods in their parent class, otherwise they are also abstract classes. Instead, implement the method in the subclass. Other classes that know their behavior can implement these methods in the class.
An interface (interface) is a variant of an abstract class. In an interface, all methods are abstract. Multiple inheritance can be obtained by implementing such an interface. All the methods in the interface are abstract, without a program body. An interface can only define static final member variables. The implementation of an interface is similar to a subclass, except that the implementation class cannot inherit the behavior from the interface definition. When a class implements a special interface, it defines the method (which is given by the program body) to all such interfaces. It can then invoke the interface's method on any object that implements the interface's class. Because of an abstract class, it allows you to use the interface name as the type of the reference variable. The usual dynamic binder will take effect. A reference can be converted to an interface type or converted from an interface type, and the instanceof operator can be used to determine whether the class of an object implements an interface.

39. Start a thread with run () or start ()?
A: Starting a thread is calling the start () method so that the virtual processor represented by the thread is in a running state, which means it can be dispatched and executed by the JVM. This does not mean that the thread will run immediately. The run () method can produce a flag that must be exited to stop a thread.

40. Can interfaces be inherited by an interface? is an abstract class achievable (implements) interface? Does an abstract class inherit entity classes (concrete Class)?
A: An interface can inherit an interface. Abstract classes can implement (implements) interfaces, whether an abstract class can inherit an entity class, but only if the entity class must have an explicit constructor.

41. Can the constructor constructor be override?
A: The constructor constructor cannot be inherited, so overriding cannot be overridden, but it can be overloaded with overloading.



42. Can I inherit the String class?
A: The string class is the final class and cannot be inherited.

43.try {} has a return statement, then the code in the finally {} immediately after this try will not be executed, when executed, before or after the return?
A: It executes and executes before return.

44. Two object values are the same (x.equals (y) = = true), but can have different hash code, this sentence right?
Answer: No, there is the same hash code.

Does 45.swtich work on a byte, can it function on a long, or does it work on a string?
Answer: in switch (EXPR1), expr1 is an integer expression. So the arguments passed to the switch and case statements should be int, short, char, or byte. Long,string can not act on Swtich.

47. When a thread enters an synchronized method of an object, does the other thread have access to other methods of this object?
No, an synchronized method of an object can only be accessed by one thread.

Whether the 48.abstract method can be static at the same time, whether it can be native at the same time, can it be synchronized at the same time?
Answer: No.

49.List, Set, does the map inherit from the collection interface?
A: List,set is map is not

The elements in 50.Set cannot be duplicated, so what is the way to distinguish between duplicates or not? Are you using = = or equals ()? What is the difference between them?
A: The elements in set cannot be duplicated, so use the iterator () method to distinguish between duplicates or not. Equals () is the interpretation of two sets for equality.
The Equals () and = = methods Determine whether the reference value points to the same object Equals () is overwritten in the class so that when the contents and types of the two detached objects match, the truth is returned.

51. Does the array have the length () method? Does string have the length () method?
A: The array does not have the length () method and has the length property. String has the length () method.

What is the difference between 52.sleep () and wait ()?
A: The Sleep () method is the method that causes the thread to stop for a period of time. After the sleep interval expires, the thread does not necessarily resume execution immediately. This is because at that point, other threads may be running and not scheduled to abort execution unless (a) the "Wake Up" thread has a higher priority
(b) The running thread is blocked for other reasons.
When wait () is a thread interaction, if the thread makes a wait () call to a synchronization object x, the thread pauses execution, and the object goes into a wait state until it wakes up or waits until the time is up.

53.short S1 = 1; S1 = s1 + 1; what's wrong? Short S1 = 1; S1 + = 1; what's wrong?
Answer: short S1 = 1; S1 = s1 + 1; error, S1 is a short type, s1+1 is an int type, cannot be converted to short type explicitly. Can be modified to S1 = (short) (S1 + 1). Short S1 = 1; S1 + = 1 correct.

54. Talk about final, finally, finalize the difference.
For:
final-modifier (keyword) If a class is declared final, it means that it can no longer derive a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared abstract and declared final. Declaring variables or methods as final ensures that they are not changed in use. A variable declared as final must be given an initial value at the time of declaration, and can only be read in subsequent references and cannot be modified. A method that is declared final can also be used only and cannot be overloaded
Finally-provides a finally block to perform any cleanup operations when the exception is processed. If an exception is thrown, the matching catch clause executes, and the control enters the finally block, if any.
The finalize-method name. Java technology allows the use of the Finalize () method to do the necessary cleanup before the garbage collector clears objects from memory. This method is called by the garbage collector to this object when it determines that the object is not referenced. It is defined in the Object class, so all classes inherit it. Subclasses override the Finalize () method to organize system resources or perform other cleanup work. The Finalize () method is called on the object before the object is deleted by the garbage collector.

55. How to handle hundreds of thousands of concurrent data?
A: Use a stored procedure or transaction. Update at the same time when the maximum identity is obtained. Note that the primary key is not self-incrementing when this method is concurrent and there is no duplicate primary key. Get the maximum identity you want to have a stored procedure to get.

56.Session What are the major bugs that Microsoft has proposed to solve?
A: IIS because of the process recycling mechanism, the system is busy session will be lost, you can use Sate server or SQL Server database to store the session but this way is slower, and can not capture the end event of the session.

57. What is the difference between a process and a thread?
A: The process is the system for resource allocation and scheduling units, the thread is the CPU scheduling and dispatch units, a process can have multiple threads, these threads share the resources of this process.

58. What is the difference between heap and stack?
For:
Stack: Automatically allocated and freed by the compiler. 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 are allocated on the heap.

59. member variables and member functions before adding static function?
A: 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.

60.ASP. NET compared with ASP, what is the main progress?
A: ASP interpretation form, aspx compiler type, performance improvement, is conducive to protect the source code.

61. Produce an int array with a length of 100, and randomly insert 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;

ASP. 60-Way Test

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: info-contact@alibabacloud.com 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.