• 微软暑期实习生笔试 4.6日


    感觉这次笔试比上次网易的好一点,可是还是很多都不会,这里有同学整理的试题:红色石头博客CSDN

    1.关于支持不定数量参数的方法(supportvariable parameters)有哪些?cdecl,stdcall,pascal,fastcall

    解析:

    cdecl: c declaration. 表示C语言默认的函数调用方法:所有参数从右到左依次入栈(printf),这些参数由调用者清除,称为手动清栈。被调用函数不会要求调用者传递多少参数,调用者传递过多或者过少的参数,甚至完全不同的参数都不会产生编译阶段的错误。

    stdcall: StandardCall,是C++的标准调用方式:所有参数从右到左依次入栈,如果是调用类成员的话,最后一个入栈的是this指针。这些堆栈中的参数由被调用的函数在返回后清除,使用的指令是 retnX,X表示参数占用的字节数,CPU在ret之后自动弹出X个字节的堆栈空间。称为自动清栈。函数在编译的时候就必须确定参数个数,并且调用者必须严格的控制参数的生成,不能多,不能少,否则返回后会出错。

    PASCAL 是Pascal语言函数调用方式,也可以在C/C++中使用,参数压栈顺序从左到右。返回时的清栈方式与_stdcall相同

    fastcall是编译器指定的快速调用方式。由于大多数的函数参数个数很少,使用堆栈传递比较费时。因此_fastcall通常规定将前两个(或若干个)参数由寄存器传递,其余参数还是通过堆栈传递。不同编译器编译的程序规定的寄存器不同。返回方式和_stdcall相当。

    C中不加说明默认函数为_cdecl方式(C中也只能用这种方式),、_cdecl是C和C++程序的缺省调用方式,但是C++默认的调用方式可以在IDE环境中设置。每一个调用它的函数都包含清空堆栈的代码,所以产生的可执行文件大小会比调用_stdcall函数的大。函数采用从右到左的压栈方式。注意:对于可变参数的成员函数,始终使用__cdecl的转换方式。

    2 看代码写结果的(c++),有子类继承父类,有虚方法,然后选择程序的输出,体现程序执行的顺序。网友提供代码,代码省略,详见红色石头博客。

    解析:非虚函数调用父类,虚函数调用子类,

    3 What is the difference between a linked list and an array

    解析:我觉得ABCD都不同。。这道题的难点是英语的精确理解,不知道选项说的是不是中文中的那个意思。。

    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. The Process could have its own Stack but the thread only could share the Stack of its parent Process

       C. Thread must belongs to a Process

       D. Thread could change its belonging Process

    解析:

    Each process provides the resources needed to execute a program. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.

    A thread is the entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources. In addition, each thread maintains exception handlers, a scheduling priority, thread local storage, a unique thread identifier, and a set of structures the system will use to save the thread context until it is scheduled. The thread context includes the thread's set of machine registers, the kernel stack, a thread environment block, and a user stack in the address space of the thread's process. Threads can also have their own security context, which can be used for impersonating clients.

     

    8.代码题,一个对象数组,然后对属性进行操作,选择输出值

    解析:题写错了。。seta函数中的第一个参数是A类型的,这样只有一个成员变量,所以运行结果是22221111. 最近看虚函数、类挺多的,以为还能答对,结果硬是忽略了参数类型。

     

    10.Which of the following statement(s) equal(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

    14.稳定的排序方法?(冒泡排序、快排、对排序、希尔排序、归并排序)

    Which of the following sorting algorithm(s) is(are) stable sorting?(5 Points)

       A. bubble sort

       B. quick sort

       C. heap sort

       D. merge sort

       E. Selection sort

    15.关于MVC中M、V、C的职责描述

    Model-View-Controller(MVC) is an architectural pattern that 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 link 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)

       E. None of the above

    昨天考完还没感觉,今天认真分析了题目,觉得我和微软是不是本来就无缘。。。我复习到的偏偏没有考,考到的复习过的题目也做的很搓。微软的计分方式让我答题畏手畏脚的,很不舒服。发现考试和我上高中犯一个毛病:看题好马虎。。

    20道题中,程序设计有8道题(1,2,5,6,7,8,10,11),智力题有4道题(9,12,13,17),数据结构有2道题(3,16),系操作系统有1道题(4),设计模式1道题(15),数据库1题(18),算法3题(14,19,20)

     

  • 相关阅读:
    iOS面试题
    iOS-block
    iOS开发设计模式
    iOS-宏定义
    正则表达式(转)
    iOS-textfield控制光标开始位置
    initWithNibName&initWithCoder &awakeFromNib&UIView常见属性方法
    iOS应用生命周期
    iOS-app发布新版本步骤
    iOS从App跳转至系统设置菜单各功能项
  • 原文地址:https://www.cnblogs.com/18fanna/p/3007402.html
Copyright © 2020-2023  润新知