Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the interview questions for Asp.Net?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces what the Asp.Net interview topics are, which can be used for reference by interested friends. I hope you will gain a lot after reading this article. Let's take a look at it.

1. Briefly describes the access rights of the private, protected, public, internal modifiers.

Answer. Private: a private member that can only be accessed inside the class.

Protected: protects the member, which can be accessed within the class and in the inherited class.

Public: public member, fully public, with no access restrictions.

Internal: accessible within the same namespace.

2. List several ways to pass values between asp.net pages.

Answer.

1. Use querystring, such as....? id=1; response. Redirect ()....

two。 Use session variabl

3. Use server.transfer

3. The rules for a column of numbers are as follows: 1, 1, 2, 3, 5, 8, 13, 21, 34. To find out what the 30th digit is, it is realized by recursive algorithm.

A:

Public class mainclass

{

Public static void main ()

{

Console.writeline (foo (30))

}

Public static int foo (int I)

{

Does if (I 0 & & I 10:00) cause a deadlock? And briefly explain the reasons.

Public void test (int I)

{

Lock (this)

{

If (I > 10)

{

IMurray-

Test (I)

}

}

}

A: deadlocks do not occur. (but a bit of int is passed by value, so only one copy is changed at a time, so there is no deadlock. But if you replace int with an object, then a deadlock will occur)

thirty。 Briefly talk about your understanding of remoting and webservice technologies under Microsoft. Net framework and their practical applications.

Answer: ws mainly uses http to penetrate the firewall. And remoting can make use of tcp/ip, binary transmission to improve efficiency.

thirty-one。 The company requires the development of a component that inherits the system.windows.forms.listview class, requiring the following special functions: when you click on the head of each column of listview, you can rearrange all rows in the view according to the value of each row of the column (sorted in a similar way as datagrid). According to your knowledge, please briefly talk about your ideas.

Answer: according to the column header clicked, the id of the column is taken out, sorted by the id, and then bound to the listview.

thirty-two。 Given the following xml file, complete the algorithm flow chart.

< driverc >

Please draw a flow chart to traverse all the file names (filename) (use a recursive algorithm).

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)

}

}

thirty-three。 Write a sql statement: take records 31 through 40 from table a (sqlserver, with the auto-growing id as the primary key. Note: id may not be contiguous.

Answer: solution 1: select top 10 * from a where id not in (select top 30 id from a)

Solution 2: select top 10 * from a where id > (select max (id) from (select top 30 id from a) as a)

thirty-four。 Object-oriented languages have the characteristics of _ nature, _ nature, _ nature.

Answer: encapsulation, inheritance, polymorphism.

thirty-five。 Objects that can be traversed with foreach need to implement the _ interface or declare the type of the _ method.

A:

Ienumerable 、 getenumerator .

What is 36.gc? Why is there a gc?

A: gc is a garbage collector. Programmers don't have to worry about memory management because the garbage collector manages it automatically. 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 object have been created?

Answer: two objects, one is "xyx" and the other is a reference object s pointing to "xyx".

What's the difference between 38.abstract class and interface?

A:

A class that declares the existence of a method without implementing it is called an abstract class, which is used to create a class that reflects some basic behavior and declare methods for the class, but cannot implement the class in the class. You cannot create an instance of the abstract class. However, you can create a variable whose type is an abstract class and point to an instance of a concrete subclass. There can be no abstract constructor or abstract static method. 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 a subclass. Other classes that know their behavior can implement these methods in the class.

The interface (interface) is a variant of the abstract class. In an interface, all methods are abstract. Multiple inheritance can be achieved by implementing such an interface. All the methods in the interface are abstract, and none of them has a program body. Interfaces can only define static final member variables. The implementation of an interface is similar to a subclass, except that the implementation class cannot inherit behavior from the interface definition. When a class implements a particular interface, it defines (that is, given by the program body) the methods of all such interfaces. It can then call the methods of the interface on any object of the class that implements the interface. Because of the abstract class, it allows the interface name to be used as the type of the reference variable. The usual dynamic linking will take effect. References can be converted to or from interface types, and the instanceof operator can be used to determine whether an object's class implements an interface.

thirty-nine。 Do you start a thread with run () or start ()?

/ / Thread th=new Thread (new ThreadStart (Method))

/ / Th.Start ()

Answer: start a thread by calling the start () method

forty。 Can the interface inherit the interface? Can abstract classes implement (implements) interfaces? Can abstract classes inherit entity classes (concrete class)?

Answer: interfaces can inherit interfaces. Abstract classes can implement (implements) interfaces, and abstract classes are non-inheritable entity classes.

forty-one。 Can the constructor constructor be override?

Answer: constructor constructor cannot be inherited, so overriding cannot be overridden, but overloading can be overloaded.

forty-two。 Can I inherit the string class?

Answer: the string class is a sealed class and cannot be inherited.

There is a return statement in 43.try {}, so will the code in the finally {} immediately after the try be executed, when will it be executed, before or after the return?

A: it will be executed, before return.

forty-four。 Is it true that two objects have the same value (x.equals (y) = = true), but can have different hash code?

A: no, there is the same hash code.

Can 45.swtich act on byte, long and string?

Answer: in switch (expr1), expr1 is an integer expression. So the parameters passed to the switch and case statements should be int, short, char, or byte. Long,string can not act on swtich.

forty-seven。 When a thread enters a synchronized method of an object, can other threads enter other methods of the object?

No, a synchronized method of an object can only be accessed by one thread.

Can the method of 48.abstract be static, native, or synchronized at the same time?

A: neither.

Do 49.list, set, map inherit from collection interface?

A: list,set is map, not map

Elements in 50.set cannot be repeated, so what method is used to distinguish whether they are repeated or not? Do you use = = or equals ()? What's the difference between them?

Answer: elements in set cannot be repeated, so use the iterator () method to distinguish whether they are repeated or not. Equals () determines whether two set are equal.

The equals () and = = methods determine whether the reference value points to the same object equals () is overridden in the class in order to return a true value if the content and type of the two separate objects match.

fifty-one。 Is there a length () method for arrays? Is there a length () method for string?

Answer: the array does not have the method length (), but has the property of length. String has the method length ().

What's the difference between 52.sleep () and wait ()?

Answer: the sleep () method is a way to stop a thread for a period of time. Threads may not resume execution immediately after the sleep interval expires. This is because at that moment, other threads may be running and are not scheduled to abort execution unless (a) the "awake" thread has a higher priority.

(B) the running thread is blocked for other reasons.

Wait () is when a thread interacts, if a thread makes a wait () call to a synchronous object x, the thread pauses execution and the called object goes into a waiting state until it is woken up or the waiting time is up.

53.short S1 = 1; S1 = S1 + 1; what's wrong with it? Short S1 = 1; S1 + = 1; what's wrong with it?

Answer: short S1 = 1; S1 = S1; if there is a mistake, S1 is an int type, and S1 is an int type, which cannot be explicitly converted into an int type. It can be modified to S1 = (short) (S1 + 1). Short S1 = 1; S1 + = 1 is correct.

fifty-four。 Talk about the difference between final, finally and finalize.

A:

Final- modifier (keyword) if a class is declared as final, it means that it cannot derive a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared both abstract and final. Declaring variables or methods as final ensures that they will not be changed in use. Variables 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. Methods declared as final can only be used and cannot be overloaded

Finally- provides a finally block to perform any cleanup operations when the exception is handled. If an exception is thrown, the matching catch clause is executed and the control goes into the finally block, if any.

Finalize- method name. Java technology allows you to use the finalize () method to do the necessary cleanup before the garbage collector clears the object out of memory. This method is called on the object by the garbage collector when it determines that the object is not referenced. It is defined in the object class, so all classes inherit it. The subclass overrides the finalize () method to organize system resources or perform other cleanup work. The finalize () method is called on the object before the garbage collector deletes it.

fifty-five。 How to deal with hundreds of thousands of concurrent data?

A: use transactions. Note that there is no duplicate primary key when the primary key is not incremental. To get the maximum identity, there is a select @ @ identity to get it. If it is a query, it is best to create enough indexes. If the query speed of the created index is not fast enough, the data should be partitioned.

What is the major bug of 56.session and what methods does Microsoft propose to solve it?

A: due to the process recovery mechanism in iis, session will be lost if the system is busy. Session can be stored in sate server or sql server database, but this method is slow and cannot capture end events of session.

fifty-seven。 What is the difference between processes and threads?

A: the process is the unit of resource allocation and scheduling of the system; the thread is the unit of cpu scheduling and dispatching. A process can have multiple threads that share the resources of the process.

fifty-eight。 What's the difference between heap and stack?

A:

Stack: automatically allocated and released by runtime. Variables defined in the function body are usually on the stack.

Heap: generally allocated and released by programmers. The result of allocating memory with new, malloc and other allocating memory functions is on the heap.

fifty-nine。 What is the role of member variables and member functions preceded by static?

Answer: they are called constant member variables and constant member functions, also known as class member variables and class member functions. Used to reflect the state of the class respectively. For example, class member variables can be used to count the number of class instances, and class member functions are responsible for such statistical actions.

60.asp . What is the main progress of net compared with asp?

Answer: asp interpretation, aspx compilation, improved performance, conducive to the protection of source code.

sixty-one。 Produces an int array of 100 in length, randomly inserts 1-100 into it, and cannot be repeated.

Int [] intarr=new int [100]

Arraylist mylist=new arraylist ()

Random rnd=new random ()

While (mylist.count

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report