ASP. NET interview materials [4]

Source: Internet
Author: User
The company requires the development of an inherited system. windows. forms. listview components require the following special features: When you click the headers of columns in the listview, all rows in the view can be rearranged based on the values of each row in the click column (the sorting method is similar to that in the DataGrid ). Based on your knowledge, please briefly discuss your ideas
A: Based on the column header that you click, the ID of this column is taken out, sorted by this ID, and bound to listview.
Given the following XML file, complete Algorithm Flowchart.

<Driverc>





Draw a flowchart that traverses all file names (filename) (use recursive algorithms ).
A: 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 );
}}
String S = new string ("XYZ"); how many string objects are created?
A: There are two objects, one being "xyx" and the other being the reference object s pointing to "xyx.
What is the difference between abstract class and interface?
A: The class that declares the existence of a method without implementing it is called abstract class. It is used to create a class that reflects some basic behaviors and declare a method for this class, however, this class cannot be implemented in this class. You cannot create an abstract instance. However, you can create a variable whose type is a image class and point it to an instance of a specific subclass. There cannot be a pumping constructor or a pumping static method. The subclasses of abstract classes provide implementation for all the image extraction methods in their parent classes. Otherwise, they are also called image classes. Instead, implement this method in the subclass. Other classes that know their behavior can implement these methods in the class.
An interface is a variant of the image class. In the interface, all methods are extracted. Multi-inheritance can be achieved by implementing such an interface. All the methods in the interface are drawn, and none of them have Program Body. The interface can only define static final member variables. The implementation of an interface is similar to that of a subclass, except that the implementation class cannot inherit behaviors from the interface definition. When a class implements a special interface, it defines (to be given by the program body) all the methods of this interface. Then, it can call the interface method on any object of the class that implements this interface. Because of the image class, it allows the interface name to be used as the type of the referenced variable. Normally, dynamic Association editing will take effect. The reference can be converted to the interface type or from the interface type. The instanceof operator can be used to determine whether the class of an object implements the interface.
Is run () or start () used to start a thread ()?
A: To start a thread is to call the START () method so that the virtual processor represented by the thread is runable, which means it can be scheduled and executed by JVM. This does not mean that the thread will run immediately. The run () method can generate the exit sign to stop a thread.
The two pairs have the same image value (X. Equals (y) = true), but different hash codes are available. Is this true?
A: No. It has the same hash code.
Can swtich work on byte, long, and string?
A: In switch (expr1), expr1 is an integer, character, or string. Therefore, expr1 can be applied to byte and long, or string.
After a thread enters a synchronized method of an object, can other threads access other methods of this object?
A: No. One Synchronized Method of an object can only be accessed by one thread.
Can abstract methods be both static, native, and synchronized?
A: No.
Does list, set, and map inherit from the collection interface?
A: List, set is map, not
The elements in the set cannot be repeated. How can we identify whether the elements are repeated or not? Is = or equals () used ()? What are their differences?
A: The elements in the set cannot be repeated. Use the iterator () method to identify whether the elements are repeated or not. Equals () is used to determine whether two sets are equal.
The equals () and = Methods Determine whether the reference value points to the same pair like equals () is overwritten in the class, in order to return the true value when the content and type of the two separated objects match.
What is the difference between sleep () and wait?
A: The sleep () method suspends the current thread for a specified time.
Wait () releases the lock on the object and blocks the current thread until it acquires the lock again.
Short S1 = 1; S1 = S1 + 1; what is the error? Short S1 = 1; S1 + = 1; what is the error?
Answer: There is a mistake in short S1 = 1; S1 = S1 + 1; S1 is short type, S1 + 1 is int type, and cannot be explicitly converted to short type. It can be changed to S1 = (short) (S1 + 1 ). Short S1 = 1; S1 + = 1 is correct.
Let's talk about the differences between final, finally, and finalize.
A: Final-modifier (keyword) If a class is declared as final, it means that it cannot generate a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared both abstract and final. Declare variables or methods as final to ensure that they are not changed during use. Variables declared as final must be declared with an initial value, which can only be read and cannot be modified in future references. Methods declared as final can only be used and cannot be reloaded.
Finally-The Finally block is provided for troubleshooting. If an exception is thrown, the matched catch clause is executed, and the control enters the Finally block (if any ).
Finalize-method name. Java technology allows the use of the finalize () method to perform necessary cleanup before the Garbage Collector clears the image from the memory. This method is called by the garbage collector when it determines that this object is not referenced. It is defined in the object class, so all classes inherit it. Subclass overwrites the finalize () method to sort system resources or perform other cleanup tasks. The finalize () method is called before the Garbage Collector deletes an object.
How to handle hundreds of thousands of concurrent data records?
A: use stored procedures or transactions. When getting the maximum ID, update it at the same time. Note that the primary key does not have duplicate primary keys when it is not in auto increment mode. A stored procedure is required to obtain the maximum ID.

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.