道、问题-2013微软暑期实习笔试题及答案 -by小雨

文章结束给大家来个程序员笑话:[M]

    这份2013年软微暑期练习生应聘笔试题来自网上资料,我将其抄出来便于读阅和保存。比较2012年暑期练习生应聘笔试题,2013年的目题水了多许,几个brain teaser都是往年见惯的,还有考核MVC模式这类工作中才会到遇的问题,无语。不过还是找工作找练习的同学们议建先自己做一遍,然后再找寻谜底。尾末也附有我自己的一份谜底,那道MVC的目题就直接略过了。如果您有不一致的谜底,欢送跟贴留言交流哈。

 

    2013 Microsoft Campus Intern Hiring Written Test

    1. Which of the following convension(s) support(s) support variable length parameter (e.g. printf)? (3 Points)
A. cdecl
B. stdcall
C. pascal
D. fastcall

    2. What's the output of the following code? (3 Points)

class A
{
public:
    virtual void f()
    {
        cout << "A::f()" << endl;
    }
    void f() const
    {
        cout << "A::f() const" << endl;
    }
};

class B: public A
{
public:
    void f()
    {
        cout << "B::f()" << endl;
    }
    
    void f() const
    {
        cout << "B::f() const" << endl;
    }
};

void g(const A *a)
{
    a->f();
}

int main()
{
    A *a = new B();
    a->f();
    g(a);
    delete a;
}
A. B::f() B::f() const
B. B::f() A::f() const
C. A::f() B::f() const
D. A::f() A::f() const

    3. What is the difference between a linked list and an array? (3 Points)
A. Search complexity when both are sorted
B. Dynamically add/remove
C. Random access efficiency
D. Data storage type

    4. About the Thread and Process in Windows, which description(s) is (are) correct? (3 Points)
A. One application in OS must have one Process, but not a necessary to have one Thread
B. Thre process could have its own Stack but the thread only could share the Stack of its parent Process
C. Thread must belong to a Process
D. Thread could change its belonging Process

    5. What is the output of the following code? (3 Points)

{
    int x = 10;
    int y = 10;
    x = x++;
    y = ++y;
    
    printf("%d, %d\n", x, y);
}
A. 10, 10
B. 10, 11
C. 11, 10
D. 11, 11

    6. For the following Java or C# code (3 Points)

    int[][] myArray3 =
        new int[3][] {
            new int[3]{5, 6, 2},
            new int[5]{6, 9, 7, 8, 3},
            new int[2]{3, 2}
        };
What will
myArray3[2][2]
return?
A. 9
B. 2
C. 6.
D. overflow

    7. Please choose the right statement about const usage: (3 Points)
A. const int a; // const integer
B. int const a; // const integer
C. int const *a; // a pointer which point to const integer
D. const int *a; // a const pointer which point to integer
E. int const *a; // a const pointer which point to integer

    8. Given the following code: (3 Points)

#include <iostream>
class A
{
public:
    long a;
};

class B: public A
{
public:
    long b;
}

void seta(A *data, int idx)
{
    data[idx].a = 2;
}

int _tmain(int argc, _TCHAR *argv[])
{
    B data[4];
    
    for (int i = 0; i < 4; ++i)
    {
        data[i].a = 1;
        data[i].b = 1;
        seta(data, i);
    }
    
    for (int i = 0; i < 4; ++i)
    {
        std::cout << data[i].a << data[i].b;
    }
    
    return 0;
}
What is the correct result?
A. 11111111
B. 12121212
C. 11112222
D. 21212121

    9. 1 of 1000 bottles of water is poisoned which will kill a rat in 1 week if the rat drunk any amount of the water. Given the bottles of water have no visual difference, how many rates are needed at least to find the poisoned one in 1 week? (5 Points)
A. 9
B. 10
C. 32
D. 999
E. None of the above

    10. Which of following statement(s) eaual(s) value 1 in C programming language? (5 Points)
A. the return value of main function if program ends normally
B. return (7 & 1);
C. char *str = "microsoft"; return str == "microsoft";
D. return "microsoft" == "microsoft";
E. None of the above

    11. If you computed 32 bit signed integers F and G from 32 bit signed integer X using F = X/2 and G = (X >> 1), and if you found F != G, this implies that (5 Points)
A. There's a compiler error
B. x is odd
C. X is negative
D. F - G = 1
E. G - F = 1

    12. How many rectangles you can find from 3 * 4 grid? (5 Points)
A. 18
B. 20
C. 40
D. 60
E. None of the above is correct

    13. One line can split of a surface to 2 parts, 2 lines can split a surface to 4 parts. Given 100 lines, no two parallel lines, no three lines join at same point, how many parts can 100 lines split? (5 Points)
A. 5051
B. 5053
C. 5510
D. 5511

    14. Which of the following sorting algorithm(s) is(are) stabe sorting? (5 Points)
A. bubble sort
B. quicksort
C. heap sort
D. merge sort
E. Selection sort

    15. Model-View-Contrller (MVC) is an architectural pattern that is frequently used in web applications. Which of the following statement(s) is(are) correct? (5 Points)
A. Models often represent data and the business logics needed to manipulate the data in the application
B. A View is a (visual) representation of its model. It renders the model into a form suitable for interaction, typically a user interface element
C. A controller is the linke between a user and the system. It accepts input from the user and instructs the model and a view to perform actions based on that input
D. The common practice of MVC in web applications is, the model receives GET or POST input from user and decides what to do with it, handing over to controller and which hand control to views (HTML-generating components)

    16. We can recover the binary tree if given the output of (5 Points)
A. Preorder traversal and inorder traversal
B. Preorder traversal and postorder traversal
C. Inorder traversal and postorder traversal
D. Postorder traversal

    17. Given a string with n characters, suppose all the characters are different from each other, how many substrings do we have? (5 Points)
A. n + 1
B. n^2
C. n(n+1)/2
D. 2^n-1
E. n!

    18. Given the following database table, how many rows will the following SQL statement update? (5 Points)
update Books set NumberofCopies = NumberOfCopies + 1 Where AuthorID
in
Select AutorID from Books
group by AuthorID
having sum(NumberOfCopies) <= 8

    

BookIDTitleCategoryNumberOfCopiesAuthorID
1SQL Server 2008MS31
2SharePoint 2007MS22
3SharePoint 2010MS42
5DB2IBM103
7SQL Server 2012MS61

 

    A. 1
B. 2
C. 3
D. 4
E. 5

    19. What is the sortest path between S and node T, given the graph below? Note: the numbers represent the lengths of the connected nodes (13 Points)

    [Sorry Cannot draw the graph]

    20. Given a set of N balls and one of which is defective (weighs less than others), you are allowed to weigh with a balance 3 times to find the defective. Which of the following are possible N? (13 Points)
A. 12
B. 16
C. 20
D. 24
E. 28

 

    Reverse select to view my answers
==============
1. A 2. B 3. BCD 4. AC 5. D
6. D 7. ABC 8. D (No correct answer) 9. _ 10. B
11. C 12. D 13. A 14. AD 15. _
16. AC 17. E 18. B 19. _ 20. ABCD

    ==============

文章结束给大家分享下程序员的一些笑话语录: 刹车失灵
有一个物理学家,工程师和一个程序员驾驶着一辆汽车行驶在阿尔卑斯山脉 上,在下山的时候,忽然,汽车的刹车失灵了,汽车无法控制地向下冲去, 眼看前面就是一个悬崖峭壁,但是很幸运的是在这个悬崖的前面有一些小树 让他们的汽车停了下来, 而没有掉下山去。 三个惊魂未定地从车里爬了出来。
物理学家说, “我觉得我们应该建立一个模型来模拟在下山过程中刹车片在高 温情况下失灵的情形”。
工程师说, “我在车的后备厢来有个扳手, 要不我们把车拆开看看到底是什么 原因”。
程序员说,“为什么我们不找个相同的车再来一次以重现这个问题呢?”


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值