Source: Internet
Author: User
Tags finally block
34. object-oriented languages include ________, _________, and ________.
A: encapsulation, inheritance, and polymorphism.

35. To use foreach to traverse the accessed object, you need to implement the ____________ interface or the type of the declared ________________ method.
A: ienumerable and getenumerator.

36. What is GC? Why does GC exist?
A: GC is a garbage collector. Programmers do not have to worry about memory management, because the Garbage Collector will automatically manage. To request garbage collection, you can call one of the following methods:
System. GC ()
Runtime. getruntime (). GC ()

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

38. What is the difference between abstract class and interface?
The class that does not implement the Declaration method is called abstract class. It is used to create a class that reflects certain 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 an abstract class and point it to an instance of a specific subclass. Abstract constructors or abstract static methods are not allowed. The subclasses of abstract classes provide implementation for all abstract methods in their parent classes. Otherwise, they are also abstract 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 an abstract class. All methods in the interface are abstract. Multi-inheritance can be achieved by implementing such an interface. All methods in the interface are abstract, and none of them have a 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 that implements the interface class. Because there is an abstract class, it allows the interface name 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.

39. Do I use run () or start () 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.

40. Can an interface inherit the interface? Can an abstract class implement the (implements) interface? Can an abstract class inherit a concrete class )?
A: The interface can inherit the interface. Abstract classes can be implemented (implements) interfaces, and whether abstract classes can inherit object classes, provided that object classes must have clear constructors.

41. Can constructor be overwritten?
A: constructor cannot be inherited, so overriding cannot be overwritten, but overloading can be overloaded.

42. Can I inherit the string class?
A: The string class is a final class, so it cannot be inherited.

43. If there is a return statement in try {}, will the code in finally {} following this try be executed? When will it be executed, before or after return?
A: Yes. It will be executed before return.

44. The two objects have the same value (X. Equals (y) = true), but different hash codes are available, right?
A: No. It has the same hash code.

45. Does swtich work on byte, long, and string?
A: In switch (expr1), expr1 is an integer expression. Therefore, the parameters passed to the switch and case statements should be int, short, Char, or byte. Long and string cannot apply to swtich.

47. After a thread enters a synchronized method of an object, can other threads access other methods of this object?
No. One Synchronized Method of an object can only be accessed by one thread.

48. can abstract methods be both static, native, and synchronized?
A: No.

49. Does list, set, and map inherit from the collection interface?
A: List, set is map, not

50. 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 object equals () is overwritten in the class, in order to return the true value when the content and type of the two separated objects match.

51. Does the array have the length () method? Does string have the length () method?
A: The array does not have the length () method. It has the Length attribute. String has the length () method.

52. What is the difference between sleep () and wait?
A: The sleep () method is used to stop a thread for a period of time. After the sleep interval expires, the thread may not resume execution immediately. This is because at that time, other threads may be running and not scheduled to give up execution, unless (a) the thread "wakes up" has a higher priority.
(B) The Running thread is blocked for other reasons.
When wait () is a thread interaction, if the thread sends a wait () call to a synchronization object X, the thread will pause the execution and the called object will enter the waiting state, wait until the wake-up or wait time is reached.

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

54. Let's talk about the differences between final, finally and finalize.
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 you to use the finalize () method to clear objects from the memory before the Garbage Collector clears them. 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.

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

56. What are the major bugs in session? What methods does Microsoft propose to solve them?
A: The session is lost when the system is busy due to the process recycle mechanism in IIS. You can use sate server or SQL Server database to store the session. However, this method is slow, the end event of the session cannot be captured.

57. What is the difference between a process and a thread?
A: A process is the unit of resource allocation and scheduling by the system. A thread is the unit of CPU scheduling and scheduling. A process can have multiple threads which share the resources of the process.

58. What is the difference between stack and stack?
STACK: the stack is automatically allocated and released by the compiler. Variables defined in the function body are usually on the stack.
Heap: usually assigned and released by programmers. The memory allocated by using new and malloc functions is on the heap.

59. What is the role of adding static before member variables and member functions?
A: They are called common member variables and common member functions, also known as class member variables and class member functions. They are used to reflect the status of the class respectively. For example, a class member variable can be used to count the number of class instances. class member functions are responsible for such statistical actions.

60. asp. Net compared with ASP, what are the main advances?
A: ASP interpretation form and aspx compilation form help improve the performance and protect the source code.

61. generate an int array with a length of 100 and insert 1-100 randomly into it, which cannot be repeated.
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 [I] = (INT) mylist [I];

62. Please describe several common methods for passing parameters between pages in. NET and describe their advantages and disadvantages.
A: Session (viewstate) is simple but easy to lose.
Application global
Cookies are simple but may not be supported and may be forged.
Input tType = "hidden" is simple and may be forged
The URL parameter is simple and displayed in the address bar with a limited length.
The database is stable and secure, but its performance is relatively weak.

63. What does GAC mean?
A: Global Assembly cache.

64. How many requests can be sent to the server?
A: Get and post. Get is generally the link mode, and post is generally the button mode.

65. What is the difference between datareader and dataset?
A: One is a read-only cursor and the other is a table in memory.

66. How many stages are there in the software development process? What is the role of each stage?
Answer: requirement analysis, architecture design, code writing, QA, and deployment

67. What are the meanings of using and new keywords in C? Using command and statement new create instance new hide methods in the base class.
A: Using introduces namespaces or uses unmanaged resources.
New create an instance or hide the parent class Method

68. to process a string, remove the spaces at the beginning and end of the string. If there are consecutive spaces in the string, only one space is reserved, that is, multiple spaces are allowed in the string, however, the number of consecutive spaces cannot exceed one.
A: String inputstr = "xx ";
Inputstr = RegEx. Replace (inputstr. Trim (),"*","");

69. What is the output of the following code? Why?
Int I = 5;
Int J = 5;
If (object. referenceequals (I, j ))
Console. writeline ("Equal ");
Console. writeline ("not equal ");
A: They are not equal because they compare objects.

70. What is SQL injection and how to prevent it? For example.
A: attackers use SQL keywords to attack websites. Filter keywords, etc.

71. What is reflection?
A: Dynamically Retrieve assembly information

72. How to Write Design Patterns with Singleton
A: In the static property, the new constructor is private.

73. What is application pool?
A: Web applications, similar to thread pools, improve concurrency performance.

74. What is a virtual function? What is an abstract function?
A: virtual functions: functions that are not implemented can be inherited and overwritten by sub-classes. Abstract function: Specifies a function that must be implemented by a non-virtual subclass and must be overwritten.

75. What is XML?
A: The markup language can be expanded using XML. Extensible Markup Language. A tag is an information symbol that a computer can understand. With this tag, computers can process articles containing various information. To define these tags, you can select an international markup language, such as HTML, or use a markup language that is freely determined by people like XML. This is the scalability of the language. XML is simplified and modified from SGML. It mainly uses XML, XSL, and XPath.

76. What is Web service? UDDI?
A: Web Service is a network-based, distributed modular component that executes specific tasks and complies with specific technical specifications. These specifications Enable Web service to interoperate with other compatible components.
The purpose of UDDI is to establish standards for e-commerce. UDDI is a set of web-based, distributed, and standard standards for implementing information registration centers for Web Services, it also contains a set of access protocols that enable enterprises to register their own web services so that other enterprises can discover.

77. What is a user control in
A: The user control is generally used when the content is mostly static, or a little changes... it is relatively large... similar to include... in ASP, but the function is much more powerful.

78. List the XML technologies you know and their applications.
A: XML is used for configuration. It is used to save static data types. Web Services... And config are the most exposed to XML.

What are common objects in Describe them separately.
Answer: Connection database connection object
Command database commands
Datareader data reader

80. What is code-behind technology.
Answer: aspx, resx, and CS files are separated by code. HTML code and server code are separated to facilitate code compilation and arrangement.

81. What is soap and what applications are there.
A: Simple Object Access protocal. Simple objects accept the protocol. it uses XML as the basic encoding structure and is built on existing communication protocols (for example, HTTP, But Ms is said to be engaged in soap with the underlying architecture on TCP/IP) A protocol that standardizes the use of web services ..

82. C # What are the differences between property and attribute? What are the advantages of this mechanism?
A: attributes are used to access fields of a class, and features are used to identify additional properties of a class or method.

83. Main differences between XML and HTML
Answer: 1. XML is case-sensitive and HTML is not.
2. In HTML, if the context clearly shows where the paragraph or list key ends, you can omit the ending mark such as </P> or </LI>. In XML, the end mark cannot be omitted.
3. In XML, an element with a single tag but no matching ending tag must end with one/character. In this way, the analyzer does not need to find the end mark.
4. in XML, attribute values must be placed in quotation marks. Quotation marks are usable in HTML.
5. In HTML, You can have attribute names without values. In XML, all attributes must have corresponding values.

Related Article

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.