微软2014校园招聘笔试试题(2)

(5 Points)
A、Improve memory access pattern to decrease cache misses.
B、Use special instructions(e.g. vector instructions) to replace compiler generated assembly code.
C、Change an algorithm from recursive implementation to iterative implementation.

D、Loop unwinding.

16、Which regular expression(s) matches the sentence "www.microsoft.com" ? (5 Points)
A、^\w+\.\w+\.\w+$
B、[w]{0,3}.[a-z]*.[a-z]+
C、.[c-w.]{3,10}[.][c-w.][.][a]|.+

D、[w][w][w][microsoft]+[com]+
E、\w*

17、In the image below , if the function is designed to multiply two positive numbers which line number in the image contains the biggest functional bug(assume no overflow)?

(5 Points)

微软2014校园招聘笔试试题


A、Line 1
B、Line 2
C、Line 3
D、Line 4
E、Line 5

18、Which of the following can be referred to as attack method(s)?

Select all that apply.(5 Points)
A、Vulnerability scan
B、SQL Injection
C、Drive-by downloading

D、Brute force

19、A table CANNOT have one or more of the following index configurations.(5 Points)
A、No indexes
B、A clustered index
C、clustered index and many non-clustered indexes
D、Many clustered index

20、Which of the following is(are) true about providing security to database servers ? Select all that apply.(5 Points)
A、Do not host a database server on the same server as your web server
B、Do not host a database server on a server based system
C、Do not use blank password for SA account

D、Employ a centralized administration model

第二部分測试时间为60分钟。满分50分。请务必在回答问题前细致阅读变成题目。您能够选用C、C++、C#或者Java 当中不论什么一种编程语言。而且保证您的代码能够正确编译和有正确的结果。另外,请一定要注意您的代码的质量。
21、Given a singly linked list L: (L0 , L1 , L2...Ln-1 , Ln). Write a program to reorder it so that it becomes(L0 , Ln , L1 , Ln-1 , L2 , Ln-2...).

struct Node { int val_; Node* next; };

Notes:
1、Space Complexity should be O(1) 
2、Only the ".next" field of a node is modifiable.
代码:

//转载请标明出处,原文地址: struct Node { int val_; Node* next; }; Node* reverse_list(Node* phead) //链表反转 { Node *temp ,*curr , *pre , *reverse_head; pre = NULL; curr = phead; while(curr->next) { temp = curr->next; curr->next = pre; pre = curr; curr = temp; } curr->next = pre; reverse_head = curr; return reverse_head; } Node* Merge(Node* slow , Node* fast) { if(fast == NULL) return slow; if(slow == NULL) return fast; Node *head , *result; result = NULL; int i = 0; while(slow && fast) { if(0 == i) { if(NULL == result) { head = result = slow; slow = slow->next; } else { result->next = slow; slow = slow->next; result = result->next; } } else { if(NULL == result) { head = result = fast; fast = fast->next; } else { result->next = fast; fast = fast->next; result = result->next; } } i ^= 1; }//while if(slow) { result->next = slow; } if(fast) { result->next = fast; } return head; } Node* reorder_list(Node* phead) { Node *r_head , *slow , *fast; r_head = slow = fast = phead; while(fast->next != NULL && fast->next->next != NULL) { slow = slow->next; fast = fast->next->next; } if(slow->next == NULL) return r_head; fast = slow->next; slow->next = NULL; slow = phead; fast = reverse_list(fast); //链表的后半部分反转 r_head = Merge(slow , fast); //链表归并 return r_head; }


转载请标明出处。原文地址:



微软2014校园招聘笔试试题


微软2014校园招聘笔试试题


微软2014校园招聘笔试试题


微软2014校园招聘笔试试题


微软2014校园招聘笔试试题


微软2014校园招聘笔试试题


微软2014校园招聘笔试试题


微软2014校园招聘笔试试题


微软2014校园招聘笔试试题

转载请标明出处。原文地址: struct Node { int val_; Node* next; }; //将链表分成前后两部分。前一个链表长度 >= 后一链表长度 Node* list_half(Node* head) { Node* half = NULL; Node* fast = head, *slow = head; while(fast && fast->next && fast->next->next) { slow = slow->next; fast = fast->next->next; } if(slow) { half = slow->next; slow->next = NULL; } return half; } //反转后一个链表 Node* list_reverse(Node* head) { if(NULL == head) return NULL; Node* prev, *curr, *reverse_head, *temp; prev = NULL, curr = head; while(curr->next) { temp = curr->next; curr->next = prev; prev = curr; curr = temp; } curr->next = prev; reverse_head = curr; return reverse_head; } //合并两个链表 Node* list_merge(Node* first, Node* second) { Node* head = first; Node* temp; while(second) { temp = first->next; first->next = second; second = second->next; first->next->next = temp; first = temp; } return head; } Node* list_reorder(Node *head) { Node* half = list_half(head); Node* half_head = list_reverse(half); head = list_merge(head, half_head); return head; }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/d1795fe21cdce7b93aa3bcbff8fcd994.html