Original quote: https://m.sanwen8.cn/p/104gMSd.html
First, what do you know and experience about Web performance optimization?
Occurrence index: five stars
Main test Center: This problem is bloggers in the blog park in the news to see, recall the previous years of interview experience, found that the probability of the problem is still relatively high. Because it has a wide range of exams, it allows interviewers to quickly get to know your technology and the depth of the technical side.
Reference answer: This problem can be divided into the front and back end.
1. Front-End optimization
(1) Reduce The number of HTTP requests. We know that each time we send an HTTP request, the connection and wait will take a considerable amount of time, so when sending an HTTP request, minimize the number of requests, and the data that can be fetched out of a request should not be sent multiple times.
(2) Enable browser caching, when determining the requested data will not change, you can read the browser cache directly do not send requests to the server. For example, we have a parameter in Ajax to set whether the cache is enabled at the time of the request, in which case we need to do the appropriate cache processing when sending the request.
(3) CSS file placed in
(4) Use compressed CSS and JS files. This needless to say, network traffic is small.
(5) If the conditions allow, try to use CDN to refer to the file, so as to reduce network traffic. For example, we use the site http://www.bootcdn.cn/.
(6) in writing JS and CSS syntax, try to avoid duplicate CSS, as far as possible to reduce the number of JS inside the loop, and so on.
2, Back-end optimization:
(1) Program optimization: This is a big topic, I choose a few common here. such as reducing the hierarchical structure of the code, avoid looping nesting, avoid looping curd database, optimization algorithm and so on.
(2) Database optimization: (Because the database optimization is not the key point, so you can choose a few major) such as enabling the database cache, commonly used word Jianjian index, try to avoid large transaction operations, avoid the writing of select *, try not to use in and not the usage of such performance and so on.
(3) Server optimization: (This is available as an option) load balancing, Web server and database separation, UI and service separation, and so on.
Second, MVC route understanding? Common
Occurrence index: five stars
Main test Center: the main test center of this problem is the understanding of MVC routing.
Reference Answer:
1, first we need to understand the role of MVC in the middle: the role of URL routing is to map the browser URL request to a specific MVC controller action.
2, when we visit Http://localhost:8080/Home/Index this address, the request was intercepted first by UrlRoutingModule, intercepted the request, from routes to the current request URL to match the Routedata object , encapsulates the Routedata object and the current URL into a RequestContext object, and then obtains the controller name from the RequestContext encapsulated Routedata, based on the controller's name, The controller object is created by reflection, this time the controller is actually activated, and finally executes the corresponding action within the controller.
Third, talk about what you think to do a good system, about the introduction of the use of what technology?
Occurrence index: five stars
Main test Center: This is a very open face question. Bloggers have met a few of the company's interviewers have asked this, bloggers think they want to use this problem to quickly understand the skills of the interviewer. It would be nice to talk about the technology you used in your recent project.
Reference Answer:
Take one of my previous projects as an example to illustrate it briefly. The project is divided into client and server, the client is divided into BS client and CS client, the BS client adopts the framework of MVC 5.0, CS client is WinForm Project, the service side uses WEBAPI to provide service interface, consider the possibility to expand the mobile terminal later, So the parameters and return values of the service interface use a common JSON format to pass the data.
1, the service side of the interface-oriented programming, we in the process of software architecture, layer and layer through the interface dependence, the lower level is not directly to provide implementation of the upper layer, but to provide the interface, the concrete implementation of dependency injection in the way when the dynamic injection into. A MEF is a component that implements dependency injection. Its use makes the UI layer not directly dependent on the BLL layer, but relies on the middle of a IBLL layer, when the program is running, the implementation of the BLL inside the UI layer through the MEF dynamic, the benefit is to reduce the layer-to-layer coupling. Service-side exceptions, permissions validation, logging and other common functions using the mechanism of AOP interception Unified management, the project is using Postsharp this component, the common requirements function is not related to the separation of the class, improve the maintainability of the code.
2, the client of the BS adopts the Jquery+bootstrap way, all the pages adopt the flow layout, can better adapt to a variety of different terminal equipment (PC, mobile phone). The project uses a variety of powerful bootstrap components to adapt to a variety of complex business needs.
Four, JS inheritance implementation.
Occurrence index: five stars
Main test Center: This problem tests the depth of the interviewer's understanding of JS. According to the blogger's experience, this type of question is generally more likely to appear in a written exam, why put it here, because it is really too common. In fact, JS implementation of the way a lot of inheritance, we just have to write a good one of them.
Reference answer: Prototype chain inheritance
function person (name, age) {
THIS.name = name;
This.age = age;
}
Adding a method to a person through a prototype chain
Person.prototype.getInfo = function () {
Console.log (this.name + "is" + This.age + "Years old!");} function Teacher (staffid) { this.staffid = StaffID;} //Inherit person Teacher.prototype by prototype life Teacher = new Person (); var would = new Teacher; will.name = "would"; wil L.age = 28;
Will.getinfo ();
V. What do you know about the design pattern? Combine the use of one of the most used design patterns you can say about it.
Occurrence index: five stars
Main test Center: Needless to say, this question is the understanding of the design pattern. Generally in order to be simple may require you to write a singleton pattern, note that it is best to write a full point, consider the kind of thread safety. And then I'll let you talk about how you're going to use this pattern in your project.
Reference Answer:
General wording
Public class Singleton
{
Define a static variable to hold an instance of the class
Private static Singleton uniqueinstance;
Define an identity to ensure thread synchronization
Private static readonly object locker = new Object ();
Define private constructors so that the outside world cannot create instances of that class
Private Singleton ()
{
}
<summary>
Defining public methods provides a global access point, and you can also define public properties to provide global access points
</summary>
<returns></returns>
Public static Singleton getinstance ()
{//double locking requires only one sentence to be judged.
if (uniqueinstance = = null)
{
Lock (Locker)
{
Created if an instance of the class does not exist, or is returned directly
if (uniqueinstance = = null)
{
Uniqueinstance = new Singleton ();
}
}
}
return uniqueinstance;
}
}
Singleton mode ensures that a class has only one instance and provides a global access point, and its usage scenarios such as the task manager should have only one in the whole system, and then the object of manipulating the file, at the same time we can only have one object * * as a file. Most important, such as the very many functions in our project → logging, in one thread, the logged object should have only one. The singleton mode is designed to ensure the security of the program and the uniqueness of the data. Or you can combine the other design patterns you use to illustrate them.
VI. How does IIS work?
Occurrence index: four stars
Main test Center: This question is mainly about how the. NET Framework and IIS are combined to render the page. This is a bit of a complicated process, the interview can not be said to be complete, then we will seize a few key points to say on it. In fact, Bo Master can not fully understand the process, today just take this opportunity to warm * * *.
Reference Answer:
1. http. SYS (which can be understood to be a listening component of IIS) intercepts this request when the client sends it.
2. http. Sys contacted was to request configuration information from the Configuration Storage Center.
3. Then send the request to the application pool for IIS.
4, check the suffix of the request, start Aspnet_isapi.dll This DLL, this DLL is inside the. NET Framework, that is, to this step, the request entered the jurisdiction of the. NET Framework.
5, this time if is WebForm, starts to perform the complex page life cycle (Httpruntime→processrequest→httpcontext→httphandler), if is MVC, starts the MVC route mechanism, Specifies httphandler for the URL according to the routing rule.
6, HttpHandler processing the request, the request ends, gives the response, the client handles the response, the entire process is finished.
Vii. HTTP protocol
Occurrence index: four stars
Main test Center: This topic mainly for the web inside the understanding of the HTTP protocol.
Reference Answer:
1, the HTTP protocol is the browser and server to follow the common norms, is a TCP/IP based on the application layer protocol.
2, HTTP is a typical request/response protocol. The client sends the request, the contents of the request and the parameters are stored in the request message, the server receives the request, responds, and the result of the return response is put into the response message. Request messages and response messages can be viewed through F12.
3, the HTTP protocol is "stateless", when the client sends an HTTP request to the service side, the server receives the request and then returns the corresponding results to the client, the servers immediately disconnect and release resources. In the actual development process, we sometimes need to "keep" this state, so derived from Session/cookie these technologies.
4, the main way of HTTP requests are get/post.
5, the HTTP status code is best to remember a few, Bo Master had an interview was asked. 200 (Request succeeded), 404 (The requested resource does not exist), 403 (Forbidden), 5xx (server-side error)
Eight, database optimization experience (back-end engineers are very common)
Occurrence index: four stars
Main test Center: This topic examines the experience of the backend engineer to operate the database. To tell the truth, the database is the main weakness of bloggers, bloggers think for this kind of exam, need to grasp a few common and key optimization experience, if not said, welcome everyone treatise.
Reference Answer:
1. Optimization of database operation and maintenance: Enable Database Cache. For some of the more commonly used queries can adopt the mechanism of database caching, when deployment needs to be careful to set up cache dependencies, to prevent "outdated" data generation.
2, database index optimization: such as the commonly used word Jianjian index, joint query to consider the Federated index. (PS: If you have a foundation, you can talk about the usage scenarios and differences between clustered and nonclustered indexes)
3, database query optimization: Avoid the writing of select *, try not to use in and not in this consumption performance and so on.
4, the Optimization of database algorithm: Try to avoid large transaction operation, reduce the loop algorithm, for large data volume operation, avoid using the use of cursors and so on.
Ix. about code optimization How do you understand? Would you consider refactoring the code?
Occurrence index: four stars
Main test Center: This question is about the interviewer's understanding of code optimization and how the code is refactored.
Reference Answer:
1, for code optimization, the previous company will do weekly code review, the main role of audit is to ensure the correctness of the Code and execution efficiency, such as reducing the hierarchy of code, avoid looping nesting, avoid looping curd database, try to avoid a large amount of data in memory (easy memory overflow), optimization algorithm.
2, for the old code, there may be many places to call, and development and maintenance personnel is likely not the same person, so refactoring should be extra careful, if not full of certainty, do not easily refactor. If refactoring is necessary, adequate unit testing and global testing must be done.
Ten, talk about your strengths and weaknesses?
Occurrence index: four stars
Main test Center: This problem makes people have a curse of the impulse, but no way, but many so-called big companies will ask this. such as Huawei. The question is a matter of opinion, and the answer can be organized.
Reference Answer:
Advantages: For the new technology * * Strong ability, can quickly adapt to the new environment and so on
Cons: Too obsessive about technology, etc.
Xi. How do you understand the technical implementation of the server-side MVC architecture? What are the benefits of this architectural approach? How do you apply this architecture in your project?
Occurrence index: three stars
Main test Center: This question is the understanding of the MVC framework.
Reference answer: MVC, as the name implies, Model, View, Controller. All of the interface code is placed inside the view, and all the logic involved with interface interaction and URL routing is inside the controller, model provides the data models. MVC's architectural approach makes the system more maintainable, makes each part more focused on its responsibilities, and MVC provides a powerful routing mechanism that facilitates page switching and interface interaction. Then we can combine the comparison with WebForm to talk about how MVC solves complex control tree generation and avoids complicated page life cycle.
12, Website optimization: The site is running slowly, how to locate the problem? Find out how to solve the problem?
Occurrence index: three stars
Main test Center: This question and the problem is similar, examines the web problem localization ability and the optimization plan.
Reference Answer:
Browser f12→ network → View the number of HTTP requests and the time spent on each request, find the source of the problem, and then resolve it in turn, and the solution can refer to the Web optimization scenario in question one.
13. Tell me about the technology you are best at. And tell me how you use it?
Occurrence index: three stars
Main test Center: This is a very open face question. Originally encountered this kind of problem, Bo master very much wants a sentence: Your sister, this is called what question! But the interviewer did ask. Think back, actually this question examines the depth of the technology you are good at. In fact, bloggers feel that for this problem, can be combined with your project to use a certain technology to be good.
Reference Answer:
Simply talk about the use of MEF in our projects.
Before we talk about MEF, we must first talk about dip, IOC, DI
Dependency inversion principle (DIP): A principle of software architecture design (abstract concept)
Inversion of Control (IoC): A way of reversing flows, dependencies, and interfaces (the specific implementation of the dip).
Dependency Injection (DI): an IOC implementation that reverses dependencies (how IOC is implemented).
What do you mean? That is, we are in the process of software architecture, layer and layer through the interface dependencies, the lower level is not directly to the upper layer to provide the implementation, but rather to provide the interface, the concrete implementation of dependency injection in the way of dynamic injection in the time of operation. A MEF is a component that implements dependency injection. Its use makes the UI layer not directly dependent on the BLL layer, but relies on the middle of a IBLL layer, when the program is running, the implementation of the BLL inside the UI layer through the MEF dynamic, the benefit is to reduce the layer-to-layer coupling. This is also the embodiment of interface-oriented programming approach.
14. Have you ever written a JS component? An example is described.
Occurrence index: three stars
Main test Center: This topic is the JS component package and JS closure of some usage. Generally speaking, there is a greater chance of a written test.
Reference answer: Customizing the Select component of HTML
ComboBox
(function ($) {
$.fn.combobox = function (options, param) {
if (typeof options = = ' string ') {
Return $.fn.combobox.methods[options] (this, param);
}
Options = $.extend ({}, $.fn.combobox.defaults, Options | | {});
var target = $ (this);
Target.attr (' Valuefield ', Options.valuefield);
Target.attr (' TextField ', Options.textfield);
Target.empty ();
var option = $ (' <option></option> ');
Option.attr (' value ', ' );
Option.text (Options.placeholder);
Target.append (option);
if (options.data) {
Init (target, options.data);
}
else {
var param = {};
Options.onBeforeLoad.call (target, Option.param);
if (!options.url) return;
$.getjson (Options.url, Option.param, function (data) {
Init (target, data);
});
}
function init (target, data) {
$.each (data, function (I, item) {
var option = $ (' <option></option> ');
Option.attr (' value ', Item[options.valuefield]);
Option.text (Item[options.textfield]);
Target.append (option);
});
Options.onLoadSuccess.call (target);
}
Target.unbind ("Change"); Target.on ("Change", function (e) {if (Options.onchange)Return Options.onchange (Target.val ()); }); } $.fn.combobox.methods = {getvalue:function (JQ) {return Jq.val (); }, Setvalue:function (JQ, param) {jq.val (param);}, Load:function (JQ, url) {$.getjson (URL, function (data) {Jq.empty (); var option = $ (' <option></option> '); Option.attr (' value ', ' ); Option.text (' Please select '); jq.append (option); $.each (data, function (I, item) {var Option = $ (' <option></option> '); option.attr (' value ', item[jq.attr (' Valuefield ')]); Option.text (item[jq.attr (' TextField ')); jq.append (option);}); }); } }; $.fn.combobox.defaults = {URL: null, param: null, data: null, Valuefield: ' value ', TextField: ' Tex T ', placeholder: ' Please select ', onbeforeload:function (param) {}, Onloadsuccess:function () {}, Onchange:function (value ) { }
};
}) (JQuery);
Call the time
$ ("#sel_search_orderstatus"). ComboBox ({
URL: '/apiaction/order/orderapi/getorderstatu ',
Valuefield: ' VALUE ',
TextField: ' NAME '
});
You can automatically fetch data from the background, noting that Valuefield and TextField correspond to display and actual values.
Have you ever written multithreaded components yourself? Brief description!
Occurrence index: three stars
Main test Center: This question is two years ago blogger in Ctrip in a telephone interview encountered, and other places basically did not encounter, in fact, to now can not understand the interviewer asked the purpose of the question. But I think there's a source of this problem, and it's estimated that the interviewer wants to know your depth of understanding about multithreading and thread pooling.
Reference answer: can refer to http://www.cnblogs.com/alexander-lee/archive/2009/10/31/159****47.html
Original address: http://developer.51cto.com/art/201512/503102.htm
. NET Senior Software engineer face Test List (reprint)