2014 NetEase front-end development pen question-answer

Source: Internet
Author: User

Originally from: http://yjbys.com/bishi/timu/585868.html

Mainly for the NetEase test tonight. Tidy up.

1. (2 points) for multiple keywords, that kind of file organization is convenient and efficient ()

A, sequential file B, inverted file C, hash file D, B + Tree index file

Resolution: Answer B.

There are four basic ways to organize files on external memory: sequential organization, index organization, hash organization and chain organization; the corresponding file names are: Sequential files, index files, hash files, and multi-keyword files. The choice of how the file is organized depends on how and how frequently the records are used, the access requirements, the nature of the external memory, and the capacity of the file.

Multi-keyword files: Files that contain multiple secondary keyword indexes are called multi-keyword files.

Inverted file (also called inverted index): The file that is organized by the record's non-primary attribute value (also called the secondary key) is called an inverted file, which is the secondary index. All the secondary key values are included in the inverted file, and all the record primary key values associated with it are listed, primarily for complex queries.

The main advantage of the inverted table is that when dealing with complex multi-keyword queries, it is possible to complete the query in the inverted table first, and then the logical operation, and then access the records after the results are obtained. This eliminates the need for random access to each record, converting a query of records into an operation of an address set, thus increasing the lookup speed.

2. (2 points) which algorithms can be used to traverse the Network Diagram ()

  A, Breadth First search B, depth first search C, linear programming strategy D, decision tree

Resolution: Answer A, B.

The breadth-first search assumes that a vertex, V, accesses each of the never-visited adjacency points of v after accessing V, then accesses their adjacency points sequentially from those adjacency points, and makes the adjacency point of the first visited vertex accessible before the neighboring point of the vertex being accessed (hence the need to queue to store the vertices). Until the adjacency points of all the visited vertices in the diagram are accessed. If there are still non-visited vertices in the diagram, repeat the process until all the vertices in the diagram have been accessed, as a starting point for the unused vertices in the diagram.

The depth-first search method is the generalization of the first root traversal of the tree, its basic idea is: from a vertex of Figure G V0, access to V0, and then select a v0 adjacent and not visited Vertex VI access, and then from the VI to select a and vi adjacent to the vertex VJ access, and then continue. If all adjacent vertices of the currently visited vertex have been accessed, retreat back to the last vertex in the sequence of vertices that has been visited, with the vertices w that have not been visited, and walk forward from W in the same way until all the vertices in the diagram are accessed.

3. (2 points) we use a 6-tuple to represent the number of vertices of a 6-node graph, which of the following 6 tuples are possible combinations ()

A, <1,2,3,4,5,6>

B, <2,4,4,2,3,5>

C, <1,3,4,2,2,1>

D, <1,2,2,4,5,2>

Analytical:

Graph without direction: An undirected graph is a two-tuple, where: 1. V is a non-empty collection, called a vertex set. 2.E is a collection of unordered two tuples of elements in V, called Edge sets.

If each edge in a diagram is non-directional, it is called a non-directed graph.

0≤e≤n (n-1)/2 If G is a graph without direction

4. (2 points) The following statement about the computable nature is correct ()

A, all questions can eventually be abstracted into a computational model, which can be calculated within a limited time (although it may take a long time): The design of modern computers is based on this theory.

B, there are some problems, we can not give the answer in a limited time: However, all problems can be in a limited time to verify the correctness of their answers.

C, Godel (DEL) The first law indicates that there is no complete and compatible axiom system.

D, the above statements are not correct.

Parsing: computable (calculability) refers to whether an actual problem can be solved using a computer, but a problem that can be solved by using a computer should be defined as "a problem that can be resolved within a limited step."

5. (2 points) 16 binary numeric C396 and 8 binary value 64474 The XOR result value (10 binary) is ()

A, 43690 B, 16660 C, 60350 D, 20375

Analytical:

XOR: Exclusive or (XOR-or operation, modulo 2 and), XOR (XOR) is a mathematical operator. It is applied to logical operations. The XOR symbol is "^". True or False results are true, false or True results are true, true or true results are false, false or false results are false. That is, two values are different, or the result is true. Conversely, it is false. The difference is 1, the same is 0.

If x is a binary number 0101,y is a binary number 1011, then x^y=1110.

The result is 0 only if the bit of the comparison is not at the same time as the result is 1

That is, "the same is 0, the difference is 1"!

6. (2 points) The following classic question which belongs to the NP problem ()

A, Turing stop problem B, sort C, 0,1 knapsack problem D, enumerate all subsets of a finite set

Analytical:

Turing outage problem: There is no such program (algorithm) that can calculate whether any program (algorithm) will end (down) on a given input.

Should choose c

7. (2 points) The following letter string exists: Agdccdddgfbbffggdddgggeffddcccdddfgaaa now needs to encode the string Huffman, then the letter F corresponds to the bit value (in binary format) ()

A, ten B, one C, 101 D,

Analytical:

Now that you're using a computer, use JavaScript to solve the problem of counting.

var temp= ' agdccdddgfbbffggdddgggeffddcccdddfgaaa ';

var count=temp.match (/f/g); Search entire string match letter F

Console.log (temp.length); The total character length is 36

Console.log (count.length); The result of the output should be 6.

Huffman code: (Huffman Coding) is a coding method, is a lossless data compression of the entropy coding (weight coding) algorithm, the method is completely based on the probability of the occurrence of characters to construct the shortest average length of the word, sometimes called the best code.

HC Concrete Method: first by the occurrence of the probability of the size of the queue, the two minimum probability of adding, as a new probability and the remaining probability of re-queueing, and then the smallest two probabilities added, and then re-queued until finally become 1. Each time the addition of "0" and "1" to add the two probabilities, read out by the symbol began to go to the last "1", the route encountered on the "0" and "1" in the lowest position to the highest order, is the Huffman code of the symbol.

9. (2 points) process management if improper design will result in a "deadlock", the typical banker algorithm belongs to (1), and the deprivation of resources belongs to the (2) method.

A, (1) = Deadlock Prevention, (2) = deadlock avoidance

B, (1) = Deadlock Prevention, (2) = deadlock cancellation

C, (1) = Deadlock avoidance, (2) = Deadlock prevention

D, (1) = Deadlock avoidance, (2) = deadlock cancellation

Resolution: Answer B

Deadlock: Refers to two or more than two processes in the execution process, because of the contention for resources caused by a mutual waiting phenomenon, if there is no external force, they will not be able to proceed.

The four necessary conditions for a system to generate a deadlock:

1) Mutually exclusive condition: refers to the process of allocating resources to the exclusive use, that is, for a period of time a resource is occupied by only one process. If there are other processes requesting resources at this time, the requestor can wait until the resource-occupying process is freed.

2) Request and hold condition: means that the process has maintained at least one resource, but a new resource request has been made, and the resource has been occupied by another process, at which time the request process is blocked, but the other resources that you have obtained remain.

3) Non-deprivation conditions: Refers to the process has been obtained resources, before the end of use, can not be deprived, can only be released by themselves when the use is complete.

4) Loop wait condition: Refers to the deadlock, there must be a process-a circular chain of resources, that is, the process set {p0,p1,p2,,pn} P0 is waiting for a P1 to occupy the resources; P1 is waiting for P2 to occupy the resources, ..., PN is waiting for resources that have been consumed by P0.

Banker algorithm: We can think of the operating system as a banker, the operating system manages the resources equivalent to the money bankers manage, the process to the operating system request allocation of resources equivalent to the user to the banker loan. The operating system allocates resources to the process in accordance with the rules established by the banker, and when the process first requests the resources, it tests the maximum resource requirements for the process, and if the existing resources of the system can meet its maximum demand, allocate the resources according to the current amount of requests, or postpone the allocation. When a process continues to request resources in execution, it first tests the number of resources that the process has taken up and the number of resources in the application that exceed the maximum resource requirements for the process. If the allocation of resources is not exceeded, if no more than the existing resources of the test system can meet the maximum amount of resources required by the process, if it can be satisfied with the current amount of applications allocated resources, otherwise also deferred allocation.

10. (2 points) for database indexing, the following statement is correct ()

A, for some fields to index, can have a small reduction of the relevant database table disk space consumption;

B, for some fields to index, can effectively improve the efficiency of reading and writing related fields;

C, common database management system, usually use hash table to store the index;

D, the existence of the database index, may result in the deletion of related fields less efficient;

Parsing: The index needs to occupy physical space, in addition to the data table to occupy the data space, each index also occupies a certain amount of physical space, if you want to establish a clustered index, then the space needed is larger, so ax

When the data in the table is added, deleted and modified, the index should be maintained dynamically, reducing the maintenance speed of the data, so d√

Greatly speed up the retrieval of data, which is the main reason for creating indexes but does not improve write efficiency BX

B-Tree CX

Part II: Professional topics (front-end development)

There are 1 types of questions. The question of indefinite choice 12, 2. The blank question 5 about 3.4. The programming question 5, the emphasis examines the JavaScript, the programming question asks the handwritten code, which contains the JS topic 3 or 4 DAO, together gives three toggles the label interface prototype diagram, requests the handwriting html+css+ JavaScript implements prototype diagrams and interactive effects. Due to the distance for a period of time, the detailed questions are not clear. Just remember a few knowledge points.

1. Brief answer: What is closure, what is the use of closures? Please give an example.

Parsing: In JavaScript, a global variable can be read inside a function, and a local variable inside a function cannot be read outside the function.

  

function  F1 () {  var n=1024;  function  f2 () {Console.log (n)}  return  F2 ();} var foo =F1 (); foo ();

The above function F2 () is a closed packet

Closures are functions that can read other functions ' internal variables.

2. Fill in the blanks: usage and distinction between apply and call.

Analytical:

The role of both is to bind the function to another object, and the two differ only in the way they define the parameters.

Explanation from MDN: Note:while The syntax of this function was almost identical to that of apply (), the fundamental difference is T Hat Call () accepts an argument list, while apply () accepts a single array of arguments.

Apply (Thisarg,argarray);

Call (Thisarg[,arg1,arg2 ...]);

Compatibility of 3.bind functions

Analytical:

The Bind method creates a new function, called a binding function. When this binding function is called, the binding function passes the first parameter of the Bind method as this when it is created, The second and later parameters of the incoming bind method plus the arguments of the binding function itself are invoked in order as arguments to the original function.

Fun.bind (thisarg[, arg1[, arg2[, ...])

4. Refer to the prototype drawings and requirements given, handwritten html,css and JS.

2014 NetEase front-end development pen question-answer

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.