Microsoft School Recruit Questions

Source: Internet
Author: User
Tags ack connection reset

Microsoft's this pen to put out, purely for the convenience of everyone to learn communication, I believe that Microsoft will not be so stingy to pursue my responsibility. Really think Microsoft out of these problems are good, although there are only 20 choice, but the surface of the investigation is very full, data structure, network, algorithm, operating system, probability and so on are included in. And answer the wrong points, do not answer 0 points, correct part of the part of the sub-system is very reasonable, to avoid the confusion of people, and the understanding of knowledge points will be punished. Can really be a person's computer knowledge level, so it is worth studying these written questions. No nonsense, read the question. The answer and analysis in the back, these are I through the information and my own thinking to do, I have limited level, there must be omissions or errors, welcome to correct the exchange.

2. Which of the following cannot be used for interprocess communication in widows?

A. Naming events

B. Named pipes

C. Critical section

D. Shared memory

3. Which of the following operations is not the basic operation of a stack?

A. Into the stack

B. The stack

C. Check whether it is empty

D. Sorting elements in a stack

4. Which of the following is a "creational" design pattern?

A. Façade

B. Singleton

C. Bridge

D. Composite

E. None of the above

5. When a connection is established, which of the following packet send order is the correct TCP handshake protocol process?

A. Syn,syn+ack,syn+ack

B. Syn+ack,syn+ack,syn

C. Syn,syn+ack,rst

D. Syn,syn,ack

E. None of the above

6. What is the nature of functional programming? (Thecharacteristicsof functional programming is?)

A. avoidof changing state and mutable data

B. referentialtransparency

C. Lambdacalculus

D. Threadsafe

E. All of Above

7. What is correct about the HTTP protocol description?

A. In CS mode, as a request-response protocol

B. Stateless, independent of each request

C. protocols used by WWW and email

D. HTTP response including digital status code, 404 often represents "Pagenot Found"

E. None of the above

9.4 bags, 15 balls, each bag at least one ball, and the number of balls in the bag can not be repeated, how many ways?

A. 4

B. 5

C. 6

D. 7

11. There are two 32bit of the number A, B, using the following method to get the number of 32bit C, D. Which one can use C, D to get a, B value

A. c= (Int32) (A+b), D= (Int32) (A-B)

B. C= (Int32) (A+b), D= (Int32) ((a) >>1)

C. C= (Int32) (A+b), d=b

D. c= (Int32) (A+b), D= (Int32) (A+2*b)

E. c= (Int32) (A*b), D= (Int32) (A/b)

12. If the pre-order traversal result of a binary tree is ABCDEFG, which of the following is the possible sequence traversal result? ABCe

A. ABCDEFG

B. GFEDCBA

C. BCDEFGA

D. BCEADFG

E. BCDAEFG

What is the complexity of T (n) =1 (n<=1), t (n) =25+t (N/5) +n^2,t (n)? B

A. O (NLOGN)

B. O (N^2LOGN)

C. O (n^2)

D. O (n^3)

E. O (N^3LOGN)

14. Two threads run on a dual-core machine, each thread main program is as follows, thread 1:x=1;r1=y; thread 2:y=1;r2=x. X and Y are two global variables, initially 0. Which of the following is a possible value for R1 and R2? Abc

A. r1=1,r2=1

B. r1=1,r2=0

C. r1=0,r2=1

D. r1=0,r2=0

15. The depth of a complete binary tree with n elements is:

A. D (n) =log2 (n)

B. D (n) =1+log2 (n)

C. D (n) =n+log2 (n)

D. d (n) =1+n*log2 (n)

,... 999,1000?

A. 189

B. 191

C. 193

D. 195

17. What is the proportion of people born February 28 and born on February 29? What is the proportion of people born February 28, 2012 and February 29, 2012? B

A. 1:1 and 1:1

B. 4:1 and 1:1

C. 1:1 and 4:1

D. 4:1 and 4:1

18. Which of the following uses the greedy algorithm

A. Dijkstra algorithm in single-source shortest path

B. Prim algorithm for minimum spanning tree

C. Kruskal algorithm for minimum spanning tree

D. Floyd-warshall algorithm for calculating the shortest path of each pair of vertices

E. KMP algorithm in string matching

19.

Class a{

Public:

Intk1;int K2;

};

An array of a a[5]={{3,4},{6,5},{2,7},{3,1},{1,2}}

Which of the following is the result of a function call?

{{1,2},{2,7},{3,1},{3,4},{6,5}}

A. F1 (A,5,CMP)

B. F2 (A,5,CMP)

C. f3 (A,5,CMP)

D. f4 (A,5,CMP)

E. None of the above is correct

20.

<word>:: <letter>|<letter><pairlet>|<letter><pairdig>

<pairlet>:: <letter><letter>|<pairlet><letter><letter>

<pairdig>::<digit><digit>|<pairdig><digit><digit>

<letter>::a|b|c|...| Y|z

<digit>::0|1|2|...| 9

Which of the following words can be generated from the rules of <word>? IABCD II bcdef III D22

A. Neither

B. Only I and II

C. Only I and III

D. Only II and III

E. I and II and III are

Answers and Analysis:

2. Which of the following cannot be used for interprocess communication in widows?

A. Naming events

B. Named pipes

C. Critical section

D. Shared memory

Answer: C
As a result of the wiki, the process of interprocess communication in Windows is: File, pipe (pipe), named pipe (named pipe), signal (Signal), Message Queuing (Messages queue), shared memory, Memory Map (memory–mapped file), Semaphore (semaphore), Socket Interface (socket). Not sure about named events (Named event) This is right, looked up some information, as if not mentioned, but some interprocess communication code will use this, who can help explain it? In fact, the critical area should be guaranteed by the semaphore.

3. Which of the following operations is not the basic operation of a stack?

A. Into the stack

B. The stack

C. Check whether it is empty

D. Sorting elements in a stack

Answer: D

You can look at the ADT structure of the stack, the first three of which are in the basic operation function.

4. Which of the following is a "creational" design pattern?

A. Façade

B. Singleton

C. Bridge

D. Composite

E. None of the above

Answer: B

Creational include the following: Singleton; Factory Method; Abstract Factory;builder; Prototype

5. When a connection is established, which of the following packet send order is the correct TCP handshake protocol process?

A. Syn,syn+ack,syn+ack

B. Syn+ack,syn+ack,syn

C. Syn,syn+ack,rst

D. Syn,syn,ack

E. None of the above

Answer: E

This is a more detailed description of the three-time agreement of the handshake:

SYN, Seqa

SYN, ACK=1,SEQB, ACK number=seqa+1

Ack=1, ACK number=seqb+1

C in RST means: Connection reset Resettinga connection. The RST packet is sent when you want to reset the connection.

So some people say, c should also be possible, because after receiving Syn+ack, set to send RST, and this way can be used in network detection, but the topic is explicitly in the establishment of the TCP link at the time of the correct three handshake protocol, so I think the answer is to choose E.

6. What is the nature of functional programming? (Thecharacteristicsof functional programming is?)

A. avoidof changing state and mutable data

B. referentialtransparency

C. Lambdacalculus

D. Threadsafe

E. All of Above

Answer: E

This wiki, and not very understand, it seems that functionalprogramming is a programming model, it treats computer operations as a mathematical function of the calculation. In the wiki, avoidsstate and mutable data,lambdacalculus,referential transparency all have, threadsafe is correct. You can refer to this http://hovertree.com/

7. About the HTTP protocol description, which is correct

A. In CS mode, as a request-response protocol

B. Stateless, independent of each request

C. protocols used by WWW and email

D. HTTP response including digital status code, 404 often represents "Pagenot Found"

E. None of the above

Answer: A,b,d

Email is using the STMP protocol.

Another feature of HTTP is "no connection": the meaning of no connection is to limit the processing of only one request per connection. When the server finishes processing the customer's request and receives the customer's answer, the connection is disconnected. In this way, the transmission time can be saved.

9.4 bags, 15 balls, each bag at least one ball, and the number of balls in the bag can not be repeated, how many ways?

A. 4

B. 5

C. 6

D. 7

E. None of the above

Answer: C

This can be the number:

1,2,3,9

1,2,4,8

1,2,5,7

1,3,4,7

1,3,5,6

2,3,4,6

11. There are two 32bit of the number A, B, using the following method to get the number of 32bit C, D. Which one can use C, D to get a, B value

A. c= (Int32) (A+b), D= (Int32) (A-B)

B. C= (Int32) (A+b), D= (Int32) ((a) >>1)

C. C= (Int32) (A+b), d=b

D. c= (Int32) (A+b), D= (Int32) (A+2*b)

E. c= (Int32) (A*b), D= (Int32) (A/b)

Answer: C
Note that the integer overflow problem is considered, for the signed number, a, C, D can be recovered by the following way
First item: a= (c+d)/2,b=c-a
Second item: D move right one, do not know whether the emigration is 1 or 0, can not be restored
Item III: A=C-D,B=D
Item Fourth: B=d-c,a=c-b
Fifth: Although can be c*d again, but not to determine the positive and negative of A and B
But for unsigned numbers, a doesn't, here's the simple point, take 3bit numbers for example. such as a=111,b=110. c=a+b=001 (overflow), d=a-b=001, so a does not recover correctly. C can still, a=c-d=001-110=111. D answer, also because overflow cannot recover.

12. If the pre-order traversal result of a binary tree is ABCDEFG, which of the following is the possible sequence traversal result?

A. ABCDEFG

B. GFEDCBA

C. BCDEFGA

D. BCEADFG

E. BCDAEFG

Answer: A,b,c,e

A B

C E

What is the complexity of T (n) =1 (n<=1), t (n) =25+t (N/5) +n^2,t (n)?

A. O (NLOGN)

B. O (N^2LOGN)

C. O (n^2)

D. O (n^3)

E. O (N^3LOGN)

Answer: B

Or use the main theorem, push the words directly, it seems to be more troublesome.

Main theorem:

It is important to remember that the relationship between Nlogba and F (n) can be greater than the case 1, equal to the condition 2, less than the case 3.

T (n) =at (n/b) +f (n)

1) e>0, F (n) =o (NLOGBA-E), complexity of T (n) =theta (NLOGBA): e.g. t (n) =9t (N/3) + N, Theta (n2)

2) F (n) =theta (Nlogba) with a complexity of T (n) =theta (NLOGBA*LGN). Example: T (n) =25t (N/5) +o (n2), Theta (N2LGN)

3) e>0, f (n) =w (nlogba+e), complexity is t (n) =theta (f (n)). For example t (n) =3t (N/4) +cn2,theta (n2)

14. Two threads run on a dual-core machine, each thread main program is as follows, thread 1:x=1;r1=y; thread 2:y=1;r2=x. X and Y are two global variables, initially 0. Which of the following is a possible value for R1 and R2?

A. r1=1,r2=1

B. r1=1,r2=0

C. r1=0,r2=1

D. r1=0,r2=0

Answer: A,b,c

To investigate the critical area problem, there is no critical section, so it is possible to:

A:x=1 = Y=1 = R1=y=1 = R2=x=1

B:y=1 = r2=x=0 = X=1 = R1=y=1

C:x=1 = r1=y=0 = Y=1 =>r2=x=1

15. The depth of a complete binary tree with n elements is:

E. D (N) =log2 (n)

F. D (n) =1+log2 (n)

G. D (N) =n+log2 (n)

H. D (N) =1+n*log2 (n)

Answer: B

Generally speaking, the root node depth is considered to be 1, so the depth =1+ log2 (n)

16. In the,... 999,1000 How many 0 are there in these numbers?

A. 189

B. 191

C. 193

D. 195

There is no answer to this question, the correct should be 192, a number of methods are: 1-100 have: 9+2=11,101-200:9+9+2=20, then 201-300,..., 901-1000 mode is the same, but more than 1000 1, so the public 11+20*9+1=192. can also be according to a 0 have what, 2 0 have what, 3 0 have what such number, in short there is a more regular method of the number, ensure that there is no omission on it.

17. What is the proportion of people born February 28 and born on February 29? What is the proportion of people born February 28, 2012 and February 29, 2012?

A. 1:1 and 1:1

B. 4:1 and 1:1

C. 1:1 and 4:1

D. 4:1 and 4:1

Answer: B

4:1 (four years a leap year)

1:1 (if leap year, 28th and 29th are the same birth probability, no difference in birth probabilities on other dates)

18. Which of the following uses the greedy algorithm

A. Dijkstra algorithm in single-source shortest path

B. Prim algorithm for minimum spanning tree

C. Kruskal algorithm for minimum spanning tree

D. Floyd-warshall algorithm for calculating the shortest path of each pair of vertices

E. KMP algorithm in string matching

Answer: A,b,c

Greedy: Dijkstra,prim,kruskal (explicitly stated in the introduction to the algorithm).

Kruskal: Initialize each vertex to a tree that has only one root, the weights of the edges are sorted from small to large, the edges with the lowest weights are selected (u,v), if you and V are not in a tree, the two Trees of U and V are merged, and the edges (u,v) are added to the collection until all edges are found.

Prim: From any vertex, maintain a tree a, each step, select the smallest edge connection g (v,a), add node V to tree a until all the vertices have been found.

Dynamic Planning: FLOYD-WARSHALL,KMP

19.

Class a{

Public:

Intk1;int K2;

};

An array of a a[5]={{3,4},{6,5},{2,7},{3,1},{1,2}}

Which of the following is the result of a function call?

{{1,2},{2,7},{3,1},{3,4},{6,5}}

A. F1 (A,5,CMP)

B. F2 (A,5,CMP)

C. f3 (A,5,CMP)

D. f4 (A,5,CMP)

E. None of the above is correct

Answer: A,d

This problem is very interesting, at first glance, the problem is so big, may be bluffing, in fact, calm down to look at, very simple, is a sort of stability analysis of instability. The so-called stability, that is: to ensure that the first 2 equal number of the sequence before and after the order and the ordering of their two before and after the position of the same order, if the ordered node is only a number, then the stability is not significant, but if there are multiple key values, you need to consider stability analysis. For example, if the sorting algorithm is stable, because the original array {3,4} before {3,1}, according to the definition of stability, the result of the order will certainly not appear {3,1} before {3,4}. If the algorithm is unstable, then it can only be said that {3,1} has the potential to precede {3,4}, it is necessary to determine whether the value of equality will change position according to the specific sort procedure. For an analysis of the stability of eight algorithms, you can view http://hovertree.com/. Choosing sort, quick sort, hill sort, heap sort is not a stable sorting algorithm, while bubble sort, insert sort, merge sort, and Cardinal sort are stable sorting algorithms.

So, first make clear what sort algorithm the four functions adopt:

F1: Select sort; F2: direct insert sort; F3: Bubbling, F4: quick-line

F2 and F3 are stable and pass away directly. Then the non-stable again see whether the position was changed. A and D if you go through the program, you will find that the two elements of {3,4} and {3,1} are in a variable order.

For a answer, a[5]={{3,4},{6,5},{2,7},{3,1},{1,2}}

First Order: {{1,2},{6,5},{2,7},{3,1},{3,4}}

Second order: {{1,2},{2,7},{6,5},{3,1},{3,4}}

Third Order: {{1,2},{2,7},{3,1},{6,5},{3,4}}

Sort by four times: {{1,2},{2,7},{3,1},{3,4},{6,5}}

So right

For d answer, a[5]={{3,4},{6,5},{2,7},{3,1},{1,2}}

This is how the first order is run.

Initial: low=0,high=4,i=0,t={3,4}

For loop:

J=1, C ({6,5},t) >0,i=0, no Interchange (A[i],a[j]), {{3,4},{6,5},{2,7},{3,1},{1,2}}

J=2,c ({2,7},t) <0,i=1, interchange ({6,5},{2,7}), {{3,4},{2,7},{6,5},{3,1},{1,2}}

J=3, C ({3,1},t) =0,i=2, interchange ({6,5},{3,1}), {{3,4},{2,7},{3,1},{6,5},{1,2}}

J=4, C ({1,2},t) <0,i=3, interchange ({6,5},{1,2}), {{3,4},{2,7},{3,1},{1,2},{6,5}}

Finally, do Exchange (A,low,i), Exchange ({3,4},{1,2}), {{1,2},{2,7},{3,1},{3,4},{6,5}}

Get the first order result: {{1,2},{2,7},{3,1},{3,4},{6,5}}, the location of {3,1} was found, already in front of {3,4}, so the final result must be the same as the expected result. It is important to note that in the _F41 function, if (c (a[j],t) <=0), if written in C (a[j],t) <0, then the answer will not be selected. So the final answer is a and d.

20.

<word>:: <letter>|<letter><pairlet>|<letter><pairdig>

<pairlet>:: <letter><letter>|<pairlet><letter><letter>

<pairdig>::<digit><digit>|<pairdig><digit><digit>

<letter>::a|b|c|...| Y|z

<digit>::0|1|2|...| 9

Which of the following words can be generated from the rules of <word>? IABCD II bcdef III D22

A. Neither

B. Only I and II

C. Only I and III

D. Only II and III

E. I and II and III are

Answer: D

It is a question of the automatic machine of examining form. The key is to analyze what each pattern essentially represents. <letter> represents a single letter;<digit> represents a single digit;<pairdig> is two <digit>, or recursive <pairdig> and two <digit> In fact, it means an even number of <digit>, that is, an even number of numbers;,<pairlet> is an even number of letters. So the <word> may be: 1 letters, odd numbers of letters, or a letter and even a number of numbers. So the second and third are right.

Recommendation: http://www.cnblogs.com/roucheng/p/suanfa3.html

Microsoft School Recruit Questions

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.