51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 28410|回复: 75
打印 上一主题 下一主题

微软公司的面试问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2004-10-15 11:30:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
以下是微软公司的员工在面试时所遇到的问题。微软的顾问有时会得到一些特殊待遇,因此在面试时询问他们的问题并不真的算数,所以没有列在下面。  

  这些问题往往遵循以下一些基本主题:难题、运算、应用、头脑。  

  难题  

   
  ★为什么下水道的井盖是圆的?  

  ★美国有多少辆车?(一个常见的类似问题是:美国有多少家加油站?)  

  ★美国有多少个下水道井盖?  

  ★你让某些人为你工作了七天,你要用一根金条作为报酬。这根金条要被分成七块。你必须在每天的活干完后交给他们一块。如果你只能将这根金条切割两次,你怎样给这些工人分?  

  ★一列火车以每小时15英里的速度离开洛杉矶,朝纽约进发。另外一列火车以每小时20英里的速度离开纽约,朝洛杉矶进发。如果一只每小时飞行25英里的鸟同时离开洛杉矶,在两列火车之间往返飞行,请问当两列火车相遇时,鸟飞了多远?  

  ★假设一张圆盘像唱机上的唱盘那样转动。这张盘一半是黑色,一半是白色。假设你有数量不限的一些颜色传感器。要想确定圆盘转动的方向,你需要在它周围摆多少个颜色传感器?它们应该被摆放在什么位置?  

  ★假设时钟到了12点。注意时针和分针重叠在一起。在一天之中,时针和分针共重叠多少次?你知道它们重叠时的具体时间吗?  

  ★你有两个罐子,分别装着50个红色的玻璃球和50个蓝色的玻璃球。随意拿起一个罐子,然后从里面拿出一个玻璃球。怎样最大程度地增加让自己拿到红球的机会?利用这种方法,拿到红球的几率有多大?  

  ★中间只隔一个数字的两个奇数被称为奇数对,比如17和19。证明奇数对之间的数字总能被6整除(假设这两个奇数都大于6)。现在证明没有由三个奇数组成的奇数对。  

  ★一个屋子有一个门(门是关闭的)和3盏电灯。屋外有3个开关,分别与这3盏灯相连。你可以随意操纵这些开关,可一旦你将门打开,就不能变换开关了。确定每个开关具体管哪盏灯。  

  ★假设你有8个球,其中一个略微重一些,但是找出这个球的惟一方法是将两个球放在天平上对比。最少要称多少次才能找出这个较重的球?  

  ★假设你站在镜子前,抬起左手,抬起右手,看看镜中的自己。当你抬起左手时,镜中的自己抬起的似乎是右手。可是当你仰头时,镜中的自己也在仰头,而不是低头。为什么镜子中的影像似乎颠倒了左右,却没有颠倒上下?  

  ★ 你有4瓶药。每粒药丸的重量是固定的,不过其中有一瓶药受到了污染,药丸的重量发生了变化,每个药丸增加了一点重量。你怎样一下子测出哪瓶药是遭到污染的呢?  

  ★下面玩一个拆字游戏,所有字母的顺序都被打乱。你要判断这个字是什么。假设这个被拆开的字由5个字母组成:  

  1. 共有多少种可能的组合方式?  

  2. 如果我们知道是哪5个字母,那会怎么样?  

  3. 找出一种解决这个问题的方法。  

  ★有4个女人要过一座桥。她们都站在桥的某一边,要让她们在17分钟内全部通过这座桥。这时是晚上。她们只有一个手电筒。最多只能让两个人同时过桥。不管是谁过桥,不管是一个人还是两个人,必须要带着手电筒。手电筒必须要传来传去,不能扔过去。每个女人过桥的速度不同,两个人的速度必须以较慢的那个人的速度过桥。  

  第一个女人:过桥需要1分钟;  

  第二个女人:过桥需要2分钟;  

  第三个女人:过桥需要5分钟;  

  第四个女人:过桥需要10分钟。  

  比如,如果第一个女人与第4个女人首先过桥,等她们过去时,已经过去了10分钟。如果让第4个女人将手电筒送回去,那么等她到达桥的另一端时,总共用去了20分钟,行动也就失败了。怎样让这4个女人在17分钟内过桥?还有别的什么方法?  

  ★如果你有一个5夸脱的水桶和一个3夸脱的水桶,如何准确量出4夸脱的水?  

  ★你有一袋糖,有红色的,蓝色的,绿色的。闭上眼睛,拿出两块颜色一样的糖,你需要拿多少次才能确保有两块颜色相同的?  

  ★如果你有两个桶,一个装的是红色的颜料,另一个装的是蓝色的颜料。你从蓝色颜料桶里舀一杯,倒入红色颜料桶,再从红色颜料桶里舀一杯倒入蓝颜料桶。两个桶中红蓝颜料的比例哪个更高?通过算术的方式来证明这一点。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏

该用户从未签到

2#
 楼主| 发表于 2004-10-15 11:31:03 | 只看该作者
运算  

  ★链接表和数组之间的区别是什么?  

  ★做一个链接表,你为什么要选择这样的方法?  

   
  ★选择一种算法来整理出一个链接表。你为什么要选择这种方法?现在用O(n)时间来做。  

  ★说说各种股票分类算法的优点和缺点。  

  ★用一种算法来颠倒一个链接表的顺序。现在在不用递归式的情况下做一遍。  

  ★用一种算法在一个循环的链接表里插入一个节点,但不得穿越链接表。  

  ★用一种算法整理一个数组。你为什么选择这种方法?  

  ★用一种算法使通用字符串相匹配。  

  ★颠倒一个字符串。优化速度。优化空间。  

  ★颠倒一个句子中的词的顺序,比如将“我叫克丽丝”转换为“克丽丝叫我”,实现速度最快,移动最少。  

  ★找到一个子字符串。优化速度。优化空间。  

  ★比较两个字符串,用O(n)时间和恒量空间。  

  ★假设你有一个用1001个整数组成的数组,这些整数是任意排列的,但是你知道所有的整数都在1到1000(包括1000)之间。此外,除一个数字出现两次外,其他所有数字只出现一次。假设你只能对这个数组做一次处理,用一种算法找出重复的那个数字。如果你在运算中使用了辅助的存储方式,那么你能找到不用这种方式的算法吗?  

  ★不用乘法或加法增加8倍。现在用同样的方法增加7倍。
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2004-10-15 11:31:19 | 只看该作者
应用  

  ★如何将计算机技术应用于一幢100层高的办公大楼的电梯系统上?你怎样优化这种应用?工作日时的交通、楼层或时间等因素会对此产生怎样的影响?  

  ★你如何对一种可以随时存在文件中或从因特网上拷贝下来的操作系统实施保护措施,   
防止被非法复制?  

  ★你如何重新设计自动取款机?  

  ★假设我们想通过电脑来操作一台微波炉,你会开发什么样的软件来完成这个任务?  

  ★你如何为一辆汽车设计一台咖啡机?  

  ★ 如果你想给微软的Word系统增加点内容,你会增加什么样的内容?  

  ★你会给只有一只手的用户设计什么样的键盘?  

  ★你会给失聪的人设计什么样的闹钟?
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2004-10-15 11:31:36 | 只看该作者
头脑  

  ★如果你有一个许多部件可以拆卸的时钟,你将它一块块拆开,但是没有记住是怎样拆的。然后你将各个零件重新组装起来,最后发现有三个重要零件没有放进去。这时你如何重新组装这个时钟?  

   
  ★如果你需要学习一门新的计算机语言,你会怎样做?  

  ★假设由你负责设计比尔·盖茨的卫生间。当然,钱不成问题,但是你不可以和比尔谈。你会怎样做?  

  ★到目前为止,你遇到的最难回答的问题是什么?  

  ★如果微软公司说,我们愿意投资500万美元用来开发你提出的方案。那么你会做什么?为什么?  

  ★如果你将世界上所有的计算机制造商召集起来,告诉他们必须要做一件事,你会让他们做什么事?  

  ★如果你在五年内会得到一笔奖金,你认为会是因为什么?关注你的成绩的人会是谁?  

  ★你如何教自己的奶奶使用微软Excel表格系统?  

  ★为什么当我们在任何一家宾馆打开热水龙头时,热水会马上流出来?  

  ★你为什么想在微软工作?  

  ★假设你回到家,进入自己的房间,打开电灯开关,可是一点反应都没有——灯没有亮。这时,你在判断问题出在哪里时,会依次采取怎样的做法?
回复 支持 反对

使用道具 举报

该用户从未签到

5#
 楼主| 发表于 2004-10-15 11:39:49 | 只看该作者

据说属微软公司的面试题.

原题目描述:

已知两个数字为1~30的,甲知道两数只和,乙知道两数之积,甲问乙:“你知道是
那两个数吗?”乙说:“不知道”。乙问甲:“你知道是那两个数吗?”甲说:“也
不知道”。于是,乙说 :“那我知道了”随后甲也说:“那我也知道了”这两个数是'什么?

以下用VB。NET实现:

    Dim NUM, SUM, PRODUCT As Int32
    Dim Product1()() As Int32
    Dim i, m, n, Sum1(3)() As Int32

    Private Sub MyMain()
        Product1 = Nothing
        NUM = CInt(Me.TextBox1.Text)
        GetSum1()
        GetProduct1()
        For m = 1 To NUM
            For n = m To NUM
                If SumOnly(m, n) Or ProductOnly(m, n) Then GoTo NextItem '不好意思用了个GOTO
                SUM = m + n
                PRODUCT = m * n
                '甲的和产生的积中最多有(n -2)个是唯一积
                If SUMtoPRODUCT_N_2(SUM) < 2 Then GoTo NextItem
                '乙的积产生的和中有且只有一个满足1、不是唯一和 2、和产生的积中最多有(n -2)个是唯一积
                '并且其余的和均满足 1、不是唯一和 2、有n-1个唯一积
                If PROCUCTtoSUM(PRODUCT) Then
                    MsgBox(m.ToString() & "  " & n.ToString())
                End If
NextItem:   Next

        Next

    End Sub
    Private Sub GetSum1()
        '产生唯一和并保存在数组中
        ReDim Sum1(0)(1)
        Sum1(0)(0) = 1
        Sum1(0)(1) = 1
        ReDim Sum1(1)(1)
        Sum1(1)(0) = 1
        Sum1(1)(1) = 2
        ReDim Sum1(2)(1)
        Sum1(2)(0) = NUM - 1
        Sum1(2)(1) = NUM
        ReDim Sum1(3)(1)
        Sum1(3)(0) = NUM
        Sum1(3)(1) = NUM
    End Sub
    Private Function SumOnly(ByVal N1 As Int32, ByVal N2 As Int32) As Boolean
        '判断是否为唯一和
        Dim i As Int32
        For i = 0 To 3
            If N1 = Sum1(i)(0) AndAlso N2 = Sum1(i)(1) Then Return True
        Next
        Return False
    End Function
    Private Sub GetProduct1()
        '产生唯一积并保存在数组中
        Dim tmp(NUM * NUM)() As Int32
        For m = 1 To NUM '????????????????
            For n = m To NUM  '??????????????
                Dim meme() As Int32 = tmp(m * n)
                If meme Is Nothing Then
                    ReDim meme(2)
                Else
                    ReDim Preserve meme(meme.Length + 1)
                End If

                meme(meme.Length - 1) = m
                meme(meme.Length - 2) = n
                meme(0) += 1
                tmp(m * n) = meme
                meme = Nothing
            Next
        Next
        For i = 1 To NUM * NUM
            If Not tmp(i) Is Nothing AndAlso tmp(i)(0) = 1 Then
                For m = 1 To tmp(i).GetUpperBound(0) Step 2
                    If Product1 Is Nothing Then
                        ReDim Product1(0)
                        ReDim Product1(0)(1)
                    Else
                        ReDim Preserve Product1(Product1.Length)
                        ReDim Product1(Product1.Length - 1)(1)
                    End If
                    Product1(Product1.Length - 1)(0) = tmp(i)(m)
                    Product1(Product1.Length - 1)(1) = tmp(i)(m + 1)
                Next
            End If
        Next
    End Sub
    Private Function ProductOnly(ByVal N1 As Int32, ByVal N2 As Int32) As Boolean
        '判断是否为唯一积
        Dim i As Int32
        For i = 0 To Product1.GetUpperBound(0)
            If N1 = Product1(i)(1) AndAlso N2 = Product1(i)(0) Then Return True
            If N1 = Product1(i)(0) AndAlso N2 = Product1(i)(1) Then Return True
        Next
        Return False
    End Function
    Private Function SUMtoPRODUCT_N_2(ByVal SUM As Int32) As Int32
        '甲的和产生的积中最多有(n -2)个是唯一积
        Dim n As Int32 = CInt(SUM / 2 - 0.2)
        Dim i, m As Int32
        For i = 1 To n
            If ProductOnly(i, SUM - i) Then m += 1
        Next
        Return n - m
    End Function
    Private Function PROCUCTtoSUM(ByVal PRODUCT As Int32) As Boolean
        '乙的积产生的和中有且只有一个满足1、不是唯一和 2、和产生的积中最多有(n -2)个是唯一积
        '并且其余的和均满足 1、不是唯一和 2、有n-1个唯一积
        Dim tmp()(), i, m, n As Int32
        '1、分解积看能产生多少个和
        For i = 1 To CInt(Math.Sqrt(PRODUCT) - 0.4)
            If PRODUCT Mod i = 0 Then
                If tmp Is Nothing Then
                    ReDim tmp(0)
                    ReDim tmp(0)(2)
                Else
                    ReDim Preserve tmp(tmp.Length)
                    ReDim Preserve tmp(tmp.Length - 1)(2)
                End If
                tmp(tmp.Length - 1)(2) = PRODUCT / i
                tmp(tmp.Length - 1)(1) = i
                If Not SumOnly(tmp(tmp.Length - 1)(1), tmp(tmp.Length - 1)(2)) And SUMtoPRODUCT_N_2(i + PRODUCT / i) >= 2 Then
                    '和不为唯一和,且和产生的积中支多有n-2个是唯一积
                    tmp(tmp.Length - 1)(0) = 1
                End If
                If SumOnly(tmp(tmp.Length - 1)(1), tmp(tmp.Length - 1)(2)) Then
                    '唯一和
                    tmp(tmp.Length - 1)(0) = 3
                End If
                If Not SumOnly(tmp(tmp.Length - 1)(1), tmp(tmp.Length - 1)(2)) And SUMtoPRODUCT_N_2(i + PRODUCT / i) = 1 Then
                    '不是唯一和,但是有n-1个唯一积
                    tmp(tmp.Length - 1)(0) = 2
                End If
            End If
        Next
        Dim count As Int32 = 0
        For i = 0 To tmp.Length - 1
            If tmp(i)(0) = 0 Then Return False
            If tmp(i)(0) = 1 Then count += 1
        Next
        If count <> 1 Then Return False
        Return True
    End Function
回复 支持 反对

使用道具 举报

该用户从未签到

6#
 楼主| 发表于 2004-10-15 11:41:40 | 只看该作者

***怎么分苹果***(微软公司面试题)

***怎么分苹果***(微软公司面试题)
把1000 个苹果 分到10 个篮子 里
(当然苹果分到篮子里后就不能再动了,只能分一次)
要求:
用这10个篮子能够组成1-1000 任意一个数字
例如:你拿出了3 个篮子,苹果数分别为28,34,53 这样你组成了115
这个数字
(我只是给个例子,可千万别这么分)

答案思路:按照二进制的思想,如下分:
1,2,4,8,16,32,64,128,256,489

即可。
回复 支持 反对

使用道具 举报

该用户从未签到

7#
 楼主| 发表于 2004-10-15 11:42:30 | 只看该作者

微软公司的面试题(看看有没有资格进微软)

在很久以前,有一个国家,这个国家有一个小村庄有100户人家,每家养了一条狗。有一天村子里发现有疯狗,然后国王下令要杀死疯狗,但是狗的主人不能看出自家的狗是疯狗,只有别人却看的出,但是别人却不能对疯狗的主人说:你家的是疯狗。国王规定在每天的下午四点到六点开始杀疯狗。日子久这样一天一天的过去了,到了90天以后,村子里一片枪响,请问一共有几条疯狗???


思路:
   咔咔!!!~~~~假设第一天村子里只有一天疯狗,就是说99个人能看到一条疯狗,疯狗的主任能看到99条没疯的狗,到了杀狗的时间,疯狗的主人想:村子里肯定有一条疯狗,但是99人的狗都是不疯的,那自己的狗肯定是疯狗,就拿枪把自己的狗杀了。在假设第二天村子有两条疯狗,就是说有98个人能看到2条疯狗,疯狗的主人能看到98条不疯的狗和1条疯狗,不疯狗的主任能看到97条不疯的狗和2条疯狗,那肯定自己的不是疯狗。然后到了杀狗的时间,有98个人都不杀,剩下只能看到1条疯狗的主人想,村子里有2条疯狗,自己只能看到1条,那自己的肯定是疯狗了,看到1条疯狗的主人就拿枪把自己的狗杀了。一次类推。。。。。。最终的答案是村子里一共有90条疯狗(我表达能力不强,这么解释你们明白吗??)
回复 支持 反对

使用道具 举报

该用户从未签到

8#
 楼主| 发表于 2004-10-15 11:47:06 | 只看该作者

微软公司IT技术专家碰到的一次面试题

迈克和托德的薪水相差 $21 。迈克的薪水比托德多 $20 。迈克的薪水是多少?托德的薪水是多少? (答案中不包含小数点)

这个问题是微软公司IT技术专家史蒂夫?多布斯曾在一次面试上遇到的, 那次面试是多布斯所经历的最令人筋疲力尽的面试之一。这个问题对应聘电话技术支持这一职位到底有什么用呢?

“那时, 我实在看不出这个问题与我应聘的职位有何相关之处,”多布斯说。“但现在回顾起来, 我觉得它和技术支持领域的确有一些类同之处, 通常情况下,技术方面的问题总不能轻而易举的得到答案,有时你必须从新审视你的假设,从本质上讲,它们的基本规则是相同的。”

在那次面试中尽管多布斯得出了答案,他却并没有得到那份工作。“我告诉他们我计算这道题的全部思考过程,包括我怎样用排除法将相近的答案去掉,”他说。“当我说到算出这道题目的唯一方法是忘掉‘答案中不包括小数点’这一规则时, 他们似乎对我走出了陷阱感到非常满意” (算出来的结果是 $20.50 和 50美分。答案应该是整个的数字。)

金融业做人力资源的人士也很喜欢在面试中玩类似的游戏。他们认为投资者、银行家和其它金融方面的专家都必须是能在巨大压力下仍能够出色工作的人, 许多招聘者都认为在面试的时候给应试者出一道难题是测试他们是否具备良好应试心态的一个好方法。市场营销业人力资源的人士也很乐意给面试者一些坚难的挑战,例如,请为一个 19 世纪 50 年代的音频电话设计一个行销方案等等。

总的来看,在面试的时候,给应试者出一些看似与专业不相关题目,玩这种游戏的多是高科技企业,如dot-com招聘软件开发及工程师等职位。
回复 支持 反对

使用道具 举报

该用户从未签到

9#
 楼主| 发表于 2004-10-15 11:53:36 | 只看该作者

微软招聘总经理助理的3道面试题

1、某手机厂家由于设计失误,有可能造成电池寿命比原来设计的寿命短一半(不是冲放电时间),解决方案就是免费更换电池或给50元购买该厂家新手机的折换券。请给所有已购买的用户写信告诉解决方案。

  2、一高层领导在参观某博物馆时,向博物馆馆员小王要了一块明代的城砖作为纪念,按国家规定,任何人不得将博物馆收藏品变为私有。博物馆馆长需要如何写信给这位领导,将城砖取回。

  3、营业员小姐由于工作失误,将2万元的笔记本电脑以1.2万元错卖给李先生,王小姐的经理怎么写信给李先生试图将钱要回来?

  微软中国公司总裁唐骏说:“真可惜,我在很多场合都出过这三题,但到目前为止,还没有一个人能完全答对,有人答对了一题,所以他当上了我的助理。
回复 支持 反对

使用道具 举报

该用户从未签到

10#
 楼主| 发表于 2004-10-15 11:59:27 | 只看该作者

转载

当初还在读Chris Sells的《ATL Internals》,寻找勘误表时,找到了他的网站,然后发现了这些传说中的微软面试题,现在好像又添了不少新的题目:

Microsoft Interview Questions

这些题目确实是微软面试题么?我们是否可以请这里的微软员工来证实一下?

我们曾经想过是不是用这里的一些问题来考我们的应征程序员,但后来一想,搞微软技术的没几个不知道Chris Sells的,大概很多人都看过这些题目了,实在没意思,就放弃了。

Microsoft Interview Questions
The following are actual questions from actual interviews conducted by Microsoft employees on the main campus. Microsoft Consultants are sometimes allowed to have a life, so questions asked of them during interviews don't really count and aren't listed.

The questions tend to follow some basic themes:

Riddles
Algorithms
Applications
Thinkers

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
回复 支持 反对

使用道具 举报

该用户从未签到

11#
 楼主| 发表于 2004-10-15 12:04:48 | 只看该作者
.There are 4 women who want to cross a bridge. They all begin on the same side. You have 17 minutes to get all of them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown, etc. Each woman walks at a different speed. A pair must walk together at the rate of the slower woman's pace.
  Woman 1: 1 minute to cross
  Woman 2: 2 minutes to cross
  Woman 3: 5 minutes to cross
   Woman 4: 10 minutes to cross

For example if Woman 1 and Woman 4 walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If Woman 4 then returns with the flashlight, a total of 20 minutes have passed and you have failed the mission. What is the order required to get all women across in 17 minutes? Now, what's the other way?

.If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?
.You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same?
.If you have two buckets, one with red paint and the other with blue paint, and you take one cup from the blue bucket and poor it into the red bucket. Then you take one cup from the red bucket and poor it into the blue bucket. Which bucket has the highest ratio between red and blue? Prove it mathematically
回复 支持 反对

使用道具 举报

该用户从未签到

12#
 楼主| 发表于 2004-10-15 12:07:57 | 只看该作者
Algorithms
.What's the difference between a linked list and an array?
.Implement a linked list. Why did you pick the method you did?
.Implement an algorithm to sort a linked list. Why did you pick the method you did? Now do it in O(n) time.
.Describe advantages and disadvantages of the various stock sorting algorithms.
.Implement an algorithm to reverse a linked list. Now do it without recursion.
.Implement an algorithm to insert a node into a circular linked list without traversing it.
.Implement an algorithm to sort an array. Why did you pick the method you did?
.Implement an algorithm to do wild card string matching.
.Implement strstr() (or some other string library function).
.Reverse a string. Optimize for speed. Optimize for space.
.Reverse the words in a sentence, i.e. "My name is Chris" becomes "Chris is name My." Optimize for speed. Optimize for space.
.Find a substring. Optimize for speed. Optimize for space.
.Compare two strings using O(n) time with constant space.
.Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of the array only once. Describe an algorithm to find the repeated number. If you used auxiliary storage in your algorithm, can you find an algorithm that does not require it?
.Count the number of set bits in a number. Now optimize for speed. Now optimize for size.
.Multiple by 8 without using multiplication or addition. Now do the same with 7.
Add numbers in base n (not any of the popular ones like 10, 16, 8 or 2 -- I hear that Charles Simonyi, the inventor of Hungarian Notation, favors -2 when asking this question).
.Write routines to read and write a bounded buffer.
.Write routines to manage a heap using an existing array.
.Implement an algorithm to take an array and return one with only unique elements in it.
.Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. Now speed it up. Now test it.
.Implement an algorithm to print out all files below a given root node.
Given that you are receiving samples from an instrument at a constant rate, and you have constant storage space, how would you design a storage algorithm that would allow me to get a representative readout of data, no matter when I looked at it? In other words, representative of the behavior of the system to date.
.How would you find a cycle in a linked list?
.Give me an algorithm to shuffle a deck of cards, given that the cards are stored in an array of ints.
.The following asm block performs a common math function, what is it?
cwd xor ax, dx
sub ax, dx
.Imagine this scenario:
I/O completion ports are communictaions ports which take handles to files, sockets, or any other I/O. When a Read or Write is submitted to them, they cache the data (if necessary), and attempt to take the request to completion. Upon error or completion, they call a user-supplied function to let the users application know that that particular request has completed. They work asynchronously, and can process an unlimited number of simultaneous requests.
Design the implementation and thread models for I/O completion ports. Remember to take into account multi-processor machines.
.Write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value.
.Write a function to print all of the permutations of a string.
Implement malloc.
.Write a function to print the Fibonacci numbers.
.Write a function to copy two strings, A and B. The last few bytes of string A overlap the first few bytes of string B.
.How would you write qsort?
.How would you print out the data in a binary tree, level by level, starting at the top?
回复 支持 反对

使用道具 举报

该用户从未签到

13#
 楼主| 发表于 2004-10-15 12:11:06 | 只看该作者
Applications
How can computer technology be integrated in an elevator system for a hundred story office building? How do you optimize for availability? How would variation of traffic over a typical work week or floor or time of day affect this?
How would you implement copy-protection on a control which can be embedded in a document and duplicated readily via the Internet?
Define a user interface for indenting selected text in a Word document. Consider selections ranging from a single sentence up through selections of several pages. Consider selections not currently visible or only partially visible. What are the states of the new UI controls? How will the user know what the controls are for and when to use them?
How would you redesign an ATM? (怎样重新设计atm,和上边很相似)
Suppose we wanted to run a microwave oven from the computer. What kind of software would you write to do this?
What is the difference between an Ethernet Address and an IP address?
How would you design a coffee-machine for an automobile.
If you could add any feature to Microsoft Word, what would it be?
How would you go about building a keyboard for 1-handed users?
How would you build an alarm clock for deaf people?
回复 支持 反对

使用道具 举报

该用户从未签到

14#
 楼主| 发表于 2004-10-15 12:11:20 | 只看该作者
Thinkers
How are M&Ms made?
If you had a clock with lots of moving mechanical parts, you took it apart piece by piece without keeping track of the method of how it was disassembled, then you put it back together and discovered that 3 important parts were not included; how would you go about reassembling the clock?
If you had to learn a new computer language, how would you go about doing it?
You have been assigned to design Bill Gates bathroom. Naturally, cost is not a consideration. You may not speak to Bill.
What was the hardest question asked of you so far today?
If MS told you we were willing to invest $5 million in a start up of your choice, what business would you start? Why?
If you could gather all of the computer manufacturers in the world together into one room and then tell them one thing that they would be compelled to do, what would it be?
Explain a scenario for testing a salt shaker.
If you are going to receive an award in 5 years, what is it for and who is the audience?
How would you explain how to use Microsoft Excel to your grandma?
Why is it that when you turn on the hot water in any hotel, for example, the hot water comes pouring out almost instantaneously?
Why do you want to work at Microsoft?
Suppose you go home, enter your house/apartment, hit the light switch, and nothing happens - no light floods the room. What exactly, in order, are the steps you would take in determining what the problem was?
Interviewer hands you a black pen and says nothing but "This pen is red."
回复 支持 反对

使用道具 举报

该用户从未签到

15#
 楼主| 发表于 2004-10-15 12:18:10 | 只看该作者

Microsoft Interview Questions & Answers

I recently visited Microsoft's Silicon Valley campus and interviewed with the Hotmail group. If you've never had a Microsoft interview, realize that they are very different than the standard interview. You won't be asked any of those questions like, "What is your greatest weakness," or, "Where do you want to be in five years?" Rather, a Microsoft interview typically contains a number of brain teasers and coding questions. In fact, you can read interview questions from my internship interviews.

Here are the questions I was asked, accompanied with the answers right below the question! So, once you reach the end of the question, don't read any further unless you want to immediately know the answer! Anyway, here goes:

Question: How could you determine if a linked list contains a cycle in it, and, at what node the cycle starts?

Answer: There are a number of approaches. The approach I shared is in time N (where N is the number of nodes in your linked list). Assume that the node definition contains a boolean flag, bVisited.

struct Node
{
  ...
  bool bVisited;
};

Then, to determine whether a node has a loop, you could first set this flag to false for all of the nodes:

// Detect cycle
// Note: pHead points to the head of the list (assume already exists)
Node *pCurrent = pHead;
while (pCurrent)
{
  pCurrent->bVisited = false;
  pCurrent = pCurrent->pNext;
}
Then, to determine whether or not a cycle existed, loop through each node. After visiting a node, set bVisited to true. When you first visit a node, check to see if the node has already been visited (i.e., test bVisited == true). If it has, you've hit the start of the cycle!

bool bCycle = false;
pCurrent = pHead;
while (pCurrent && !pCycle)
{
  if (pCurrent->bVisited == true)
    // cycle!
    pCycle = true;
  else
  {
    pCurrent->bVisited = true;
    pCurrent = pCurrent->pNext;
  }
}
回复 支持 反对

使用道具 举报

该用户从未签到

16#
 楼主| 发表于 2004-10-15 12:19:18 | 只看该作者
A much better approach was submitted by 4Guys visitor George R., a Microsoft interviewer/employee. He recommended using the following technique, which is in time O(N) and space O(1).


Use two pointers.
// error checking and checking for NULL at end of list omitted
p1 = p2 = head;

do {
        p1 = p1->next;
        p2 = p2->next->next;
} while (p1 != p2);




p2 is moving through the list twice as fast as p1. If the list is circular, (i.e. a cycle exists) it will eventually get around to that sluggard, p1.

Thanks George!

Question: How would you reverse a doubly-linked list?

Answer: This problem isn't too hard. You just need to start at the head of the list, and iterate to the end. At each node, swap the values of pNext and pPrev. Finally, set pHead to the last node in the list.

Node * pCurrent = pHead, *pTemp;
while (pCurrent)
{
  pTemp = pCurrent->pNext;
  pCurrent->pNext = pCurrent->pPrev;
  pCurrent->pPrev = temp;
  
  pHead = pCurrent;

  pCurrent = temp;
}

Question: Assume you have an array that contains a number of strings (perhaps char * a[100]). Each string is a word from the dictionary. Your task, described in high-level terms, is to devise a way to determine and display all of the anagrams within the array (two words are anagrams if they contain the same characters; for example, tales and slate are anagrams.)

Answer: Begin by sorting each element in the array in alphabetical order. So, if one element of your array was slate, it would be rearranged to form aelst (use some mechanism to know that the particular instance of aelst maps to slate). At this point, you slate and tales would be identical: aelst.

Next, sort the entire array of these modified dictionary words. Now, all of the anagrams are grouped together. Finally, step through the array and display duplicate terms, mapping the sorted letters (aelst) back to the word (slate or tales).

Question: Given the following prototype:

int compact(int * p, int size);  


write a function that will take a sorted array, possibly with duplicates, and compact the array, returning the new length of the array. That is, if p points to an array containing: 1, 3, 7, 7, 8, 9, 9, 9, 10, when the function returns, the contents of p should be: 1, 3, 7, 8, 9, 10, with a length of 5 returned.

Answer: A single loop will accomplish this.

int compact(int * p, int size)
{
  int current, insert = 1;
  for (current=1; current < size; current++)
    if (p[current] != p[insert-1])
    {
      p[insert] = p[current];
      current++;
      insert++;
    } else
      current++;
}

Happy Programming!
回复 支持 反对

使用道具 举报

该用户从未签到

17#
 楼主| 发表于 2004-10-15 12:27:26 | 只看该作者

Microsoft Interview Questions

Interviewing at Microsoft used to be different from Interviwing at other companines. However, with the advent of a new economy and the Internet things have changed dramatically in the past few years.more and more companies are adopting microsoft interviewing philosophy and hence their questions. Here is a typical set of Interview questions asked for an entry level software Design Engineer(SDE) or Internship position.

1.If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?
2.If you are on a boat and you throw out a suitcase, will the level of water increase?
3.On an average, how many times would you have to open the Seattle phone book to find a specific name?
4.There are 3 ants at 3 corners of a triangle, they randomly start moving towards another corner. What is the probability that they don't collide?
5.If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? ( The answer to this is not zero!)
6.What new feature would you add to MSWORD if you were hired?
7.Why did you pick the school you graduated from?
8.Why do you want to work for Microsoft?
9.How many Gas stations are there in the US?
10.How would you weigh a plane without using scales?
11.How would you move Mt. Everest?
12.Two MIT math graduates bump into each other at Fairway on the upper west side. They hadn't seen each other in over 20 years.
The first grad says to the second: "how have you been?"
Second: "Great! I got married and I have three daughters now"
First: "Really? how old are they?"
Second: "Well, the product of their ages is 72, and the sum of their ages is the same as the number on that building over there.."
First: "Right, ok.. oh wait.. hmmmm.., I still don't know"
second: "Oh sorry, the oldest one just started to play the piano"
First: "Wonderful! my oldest is the same age!"


Problem: How old are the daughters? :
Why are beer cans tapered at the top and bottom?

Why is it that hot water in a hotel comes out instantly but at home it takes time?

How many times a day a clock's hands overlap?

Mike has $20 more than Todd. How much does each have given that combined they have $21 between them. You can't use fractions in the answer.(Hint: This is a trick question, pay close attention to the condition)

There are four dogs, each at the counter of a large square. Each of the dogs begins chasing the dog clockwise from it. All of the dogs run at the same speed. All continously adjust their direction so that they are always heading straight towards their clockwise neighbor. How long does it take for the dogs to catch each other? Where does this happen? (Hint: Dog's are moving in a symmetrical fashion, not along the edges of the square).
回复 支持 反对

使用道具 举报

该用户从未签到

18#
 楼主| 发表于 2004-10-15 12:30:23 | 只看该作者

Microsoft Interview Questions

1. The three types of DAO Dynaset,Snapshot,Table
2. Why do we use Option Explicit
3. Difference between Dim Object as object AND dim obj as myform
4. How do we make a poperty read only? Private Property Get(Read Only )
5. How do you declare an object in VBscript? Dim object
6. What is the equivalent of VBScript’s On Error In Jscript ??
7. How many data types are supported in Vbscript
8. MFC
9. Java
10. Active Server Pages
11. What are session variables??
12. In what languages in ASP written.
13. How do you create Virtual Root in IIS
14. How do you remotely administer MS IIS??
15. What is the key advantage of Windows NT Challenge/Response security?
16. What problems do the vendors of ODBC Technology face with ASP/ADO ?
18. How do you administer Connection Pooling in IIS 3.0
19. How do you administer Connection Pooling in IIS 4.0
20. What are the three Ado objects?? –Connection,command, recordset
21. Two Methods of retrieving SQL
22. How do you assign Construct the where clause without concatenating Field,
value pairs??
23. What cursor type do you use to retrieve multiple recordsets?
24. What action do you have to perform before retrieving data from the next
result set of a stored procedure ??
25. What are The three tags of a form tag in HTML form
26. What are The two tags for framesets
27. How do you create Drop Down Combos in HTML ? select Tag
28. In DHTML what is the difference between FontSize and Font Size ??
A: FontSize is a property, Font Size is a style
29. What is the tag Code Base and why do we use it?
30. How can you have different number of cells for each row of a table?

three file types in NT ? NTFS,Macintosh(HPFS), FAT
32. Describe a two tier Windows NT Domain?
33. Define and explain COM
34. What is IUnknown and what are its three parts??

35. Define Query Interface,Adref,Release
36. Do COM keep track of all the object references(Accounting)??
37. What is Marshalling
38. When is Marshalling not necessary??
回复 支持 反对

使用道具 举报

该用户从未签到

19#
发表于 2004-10-15 12:34:21 | 只看该作者
:s
回复 支持 反对

使用道具 举报

该用户从未签到

20#
 楼主| 发表于 2004-10-15 12:35:06 | 只看该作者

Why is a manhole cover round? A Microsoft interview question.

OK, so it probably isn't an "official" interview question (if there are any), but I have asked it during interviews in the past. For me, it is simply a way to help loosen up the interviewer and have some fun, but if the only answer I get is "I don't know, why is it?", then that gives me the impression that the person either isn't trying to really interview, or that they just aren't very creative.

So, why is a manhole cover round? Heck if I know, but here are some good answers that I've heard over the years:

Because the hole is round (duh!)
Because animals dig round holes, so it feels natural to humans too
Because a circle offsets the straight lines of a city
Because it is easier to roll the cover some distance than carry it
Because it won't fall into the hole - but, the same is true for an equilateral triangle
Because it is easier to pour hot metal into a circular mold than one with sharp corners
I suppose there are more, and there is probably some web site with the "correct" answer. But I like these because I can remember the individuals who have told them to me over the years. What's your answer?
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-27 05:54 , Processed in 0.077096 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表