逻辑推理题
1.此题源于1981年柏林的德国逻辑思考学院,98%的测验者无法解答此题。
有五间房屋排成一列;所有房屋的外表颜色都不一样;所有的屋主来自不同的国家;所有的屋主都养不同的宠物;喝不同的饮料;抽不同的香烟。
(1)英国人住在红色房屋里;(2)瑞典人养了一只狗;(3)丹麦人喝茶;(4)绿色的房子在白色的房子的左边;(5)绿色房屋的屋主喝咖啡;(6)吸 Pall Mall香烟的屋主养鸟;(7)黄色屋主吸Dunhill香烟;(8)位于最中间的屋主喝牛奶;(9)挪威人住在第一间房屋里;(10)吸Blend香烟的人住在养猫人家的隔壁;(11)养马的屋主在吸Dunhill香烟的人家的隔壁;(12)吸Blue Master香烟的屋主喝啤酒;(13)德国人吸Prince香烟;(14)挪威人住在蓝色房子隔壁;(15)只喝开水的人住在吸Blend香烟的人的隔壁
问:谁养鱼?
提示:首先确定
房子颜色:红、黄、绿、白、蓝 Color 1 2 3 4 5
国籍:英、瑞、丹、挪、德=> Nationality 1 2 3 4 5
饮料:茶、咖、奶、酒、水=> Drink 1 2 3 4 5
烟:PM、DH、BM、PR、混=> Tobacco 1 2 3 4 5
宠物:狗、鸟、马、猫、鱼=> Pet 1 2 3 4 5
然后有:
(9)=>N1=挪威
(14)=>C2=蓝
(4)=>如C3=绿,C4=白,则(8)和(5)矛盾,所以C4=绿,C5=白
剩下红黄只能为C1,C3
(1)=>C3=红,N3=英国,C1=黄
(8)=>D3=牛奶
(5)=>D4=咖啡
(7)=>T1=DH
(11)=>P2=马
那么:
挪威 ? 英国 ? ?
黄 蓝 红 绿 白
? ? 牛奶 咖啡 ?
DH ? ? ? ?
? 马 ? ? ?
(12)=>啤酒只能为D2或D5,BM只能为T2或T5=>D1=矿泉水
(3)=>茶只能为D2或D5,丹麦只能为N2或N5
(15)=>T2=混合烟=>BM=T5,
所以剩下啤酒=D5,茶=T2=>丹麦=D2
然后:
挪威 丹麦 英国 ? ?
黄 蓝 红 绿 白
矿泉水 茶 牛奶 咖啡 啤酒
DH 混合烟 ? ? BM
? 马 ? ? ?
(13)=>德国=N4,PR=T4
所以,瑞典=N5,PM=T3
(2)=>狗=P5
(6)=>鸟=P3
(10)=>猫=P1
得到:
挪威 丹麦 英国 德国 瑞典
黄 蓝 红 绿 白
矿泉水 茶 牛奶 咖啡 啤酒
DH 混合烟 PM PR BM
猫 马 鸟 ? 狗
所以,最后剩下的鱼只能由德国人养了。
2.
. . .
. . .
. . .
请仅用一笔画四根直线,将上图9个点全部连接。
3.对一批编号为1~100全部开关朝上(开)的灯进行以下操作:
凡是1的倍数反方向拨一次开关;2的倍数反方向又拨一次开关;3的倍数反方向又拨一次开关……
问:最后为关熄状态的灯的编号。
微软招聘总经理助理的三道面试题
1.某手机厂家由于设计失误,有可能造成电池寿命比原来设计的寿命短一半(不是冲放电时间),解决方案就是更换电池或给50元购买该厂家新手机的折换券。请给所有已购买的用户写信告诉解决方案。
2.一高层领导在参观某博物馆时,向博物馆馆员小王要了一块明代的城砖作为纪念,按国家规定,任何人不得将博物馆收藏品变为私有。博物馆馆长需要如何写信给这位领导,将城砖取回?
3.王小姐由于工作失误,将2万元的笔记本电脑以1.2万元错卖给李先生,王小姐的经理应该怎么写信给李先生将钱要回?
英文面试题目
1. Algorithms
* What’s the difference between a linked list and an array?
* Implement an algorithm to sort a linked list. Why did you pick the method you did?
* Implement an algorithm to sort an array. Why did you pick the method you did?
* Implement strstr() (or some other string library function).
* Reverse a string. Optimize for speed. Optimize for space.
* Count the number of set bits in a number. Now optimize for speed. Now optimize for size.
* 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.
* 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 print out the data in a binary tree, level by level, starting at the top?
2. 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 redesign an ATM?
* Suppose we wanted to run a microwave oven from the computer. What kind of software would you write to do this?
* How would you design a coffee-machine for an automobile.
3. Thinkers
* How are M&Ms made?
* If you had to learn a new computer language, how would you go about doing it?
* 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?
微软亚洲技术支持中心面试题目
1.进程和线程的差别。
2.Heap与stack的差别。
3.Windows下的内存是如何管理的?
4.介绍.Net和.Net的安全性。
5.客户端如何访问.Net组件实现Web Service?
6.C/C++编译器中虚表是如何完成的?
7.谈谈COM的线程模型。然后讨论进程内/外组件的差别。
8.谈谈IA32下的分页机制。
9.给两个变量,如何找出一个带环单链表中是什么地方出现环的?
10.在IA32中一共有多少种办法从用户态跳到内核态?
11.如果只想让程序有一个实例运行,不能运行两个。像winamp一样,只能开一个窗口,怎样实现?
12.如何截取键盘的响应,让所有的‘a’变成‘b’?
13.Apartment在COM中有什么用?为什么要引入?
14.存储过程是什么?有什么用?有什么优点?
15.Template有什么特点?什么时候用?
16.谈谈Windows DNA结构的特点和优点。
微软研究院笔试题目
1.#include <stdio.h>
#include <String.h>
class CBuffer
{
char * m_pBuffer;
int m_size;
publc:
CBuffer()
{
m_pBuffer=NULL;
}
~CBuffer()
{
Free();
}
void Allocte(int size)
{
m_size=size;
m_pBuffer= new char[size];
}
private:
void Free()
{
if(m_pBuffer!=NULL)
{
delete m_pBuffer;
m_pBuffer=NULL;
}
}
public:
void SaveString(const char* pText) const
{
strcpy(m_pBuffer, pText);
char* GetBuffer() const
{
return m_pBuffer;
}
};
void main (int argc, char* argv[])
{
cBuffer buffer1;
buffer1.SaveString(“Microsoft”);
printf(buffer1.GetBuffer());
}
}
找出Allocate, SaveString, main的错误。
2.打印“Welcome MSR Asia”
#include <stdio.h>
#include <string.h>
char * GetName (void)
{
//To return “MSR Asia” String
char name[]=“MSR Asia”;
return name;
}
void main(int argc, char* argv[])
{
char name[32];
//Fill in zeros into name
for(int i=0;i<=32;i++)
{
name[1]=‘/0‘;
}
//copy “Welcome” to name
name=“Welcome”;
//Append a blank char
name[8]=”;
//Append string to name
strcat(name,GetName());
//print out
printf(name);
}
找出程序中的错误。
3.#include <stdio.h>
class A
{
public:
void FuncA()
{
printf(“FuncA called/n”);
}
virtual void FuncB()
{
printf(“FuncB called/n”);
}
};
class B: public A
{
public:
void FuncA()
{
A::FuncA();
printf(“FuncAB called/n”);
}
virtual void FuncB()
{
printf(“FuncBB called/n”);
}
};
void main(void)
{
B b;
A *pa;
pa=&b;
A *pa2=new A;
b.FuncA();
b.FuncB();
pa->FuncA();
pa->FuncB();
pa2->FuncA();
pa2->FuncB();
delete pa2;
}
What is the output of the above program?
4.#include <stdio.h>
#include <string.h>
int FindSubString(char* pch)
{
int count=0;
char* p1=pch;
while(*p1!=‘/0’)
{
if(*p1==p1[1]-1)
{
p1++;
count++;
}
else
{
break;
}
}
int count2=count;
while(*p1!=‘/0’)
{
if(*p1!==p1[1]+1)
{
p1++;
count2--;
}
else
{
break;
}
if(count2==0)
return count;
return 0;
}
void ModifyString(char* pText)
{
char* p1=pText;
char* p2=p1;
while(*p1!=‘/0’)
{
int count=FindSubString(p1);
if(count>0)
{
*p2++=*p1;
sprintf(p2, “%I”, count);
while(*p2!= ‘/0’)
{
p2++;
}
p1+=count+count+1;
}
else
{
*p2++=*p1++;
}
}
}
void main(void)
{
char text[32]=“XYBCDCBABABA”;
ModifyString(text);
printf(text);
}
In the main() function, after ModifyString(text) is called, what’s the value of ‘text’?
1.此题源于1981年柏林的德国逻辑思考学院,98%的测验者无法解答此题。
有五间房屋排成一列;所有房屋的外表颜色都不一样;所有的屋主来自不同的国家;所有的屋主都养不同的宠物;喝不同的饮料;抽不同的香烟。
(1)英国人住在红色房屋里;(2)瑞典人养了一只狗;(3)丹麦人喝茶;(4)绿色的房子在白色的房子的左边;(5)绿色房屋的屋主喝咖啡;(6)吸 Pall Mall香烟的屋主养鸟;(7)黄色屋主吸Dunhill香烟;(8)位于最中间的屋主喝牛奶;(9)挪威人住在第一间房屋里;(10)吸Blend香烟的人住在养猫人家的隔壁;(11)养马的屋主在吸Dunhill香烟的人家的隔壁;(12)吸Blue Master香烟的屋主喝啤酒;(13)德国人吸Prince香烟;(14)挪威人住在蓝色房子隔壁;(15)只喝开水的人住在吸Blend香烟的人的隔壁
问:谁养鱼?
提示:首先确定
房子颜色:红、黄、绿、白、蓝 Color 1 2 3 4 5
国籍:英、瑞、丹、挪、德=> Nationality 1 2 3 4 5
饮料:茶、咖、奶、酒、水=> Drink 1 2 3 4 5
烟:PM、DH、BM、PR、混=> Tobacco 1 2 3 4 5
宠物:狗、鸟、马、猫、鱼=> Pet 1 2 3 4 5
然后有:
(9)=>N1=挪威
(14)=>C2=蓝
(4)=>如C3=绿,C4=白,则(8)和(5)矛盾,所以C4=绿,C5=白
剩下红黄只能为C1,C3
(1)=>C3=红,N3=英国,C1=黄
(8)=>D3=牛奶
(5)=>D4=咖啡
(7)=>T1=DH
(11)=>P2=马
那么:
挪威 ? 英国 ? ?
黄 蓝 红 绿 白
? ? 牛奶 咖啡 ?
DH ? ? ? ?
? 马 ? ? ?
(12)=>啤酒只能为D2或D5,BM只能为T2或T5=>D1=矿泉水
(3)=>茶只能为D2或D5,丹麦只能为N2或N5
(15)=>T2=混合烟=>BM=T5,
所以剩下啤酒=D5,茶=T2=>丹麦=D2
然后:
挪威 丹麦 英国 ? ?
黄 蓝 红 绿 白
矿泉水 茶 牛奶 咖啡 啤酒
DH 混合烟 ? ? BM
? 马 ? ? ?
(13)=>德国=N4,PR=T4
所以,瑞典=N5,PM=T3
(2)=>狗=P5
(6)=>鸟=P3
(10)=>猫=P1
得到:
挪威 丹麦 英国 德国 瑞典
黄 蓝 红 绿 白
矿泉水 茶 牛奶 咖啡 啤酒
DH 混合烟 PM PR BM
猫 马 鸟 ? 狗
所以,最后剩下的鱼只能由德国人养了。
2.
. . .
. . .
. . .
请仅用一笔画四根直线,将上图9个点全部连接。
3.对一批编号为1~100全部开关朝上(开)的灯进行以下操作:
凡是1的倍数反方向拨一次开关;2的倍数反方向又拨一次开关;3的倍数反方向又拨一次开关……
问:最后为关熄状态的灯的编号。
微软招聘总经理助理的三道面试题
1.某手机厂家由于设计失误,有可能造成电池寿命比原来设计的寿命短一半(不是冲放电时间),解决方案就是更换电池或给50元购买该厂家新手机的折换券。请给所有已购买的用户写信告诉解决方案。
2.一高层领导在参观某博物馆时,向博物馆馆员小王要了一块明代的城砖作为纪念,按国家规定,任何人不得将博物馆收藏品变为私有。博物馆馆长需要如何写信给这位领导,将城砖取回?
3.王小姐由于工作失误,将2万元的笔记本电脑以1.2万元错卖给李先生,王小姐的经理应该怎么写信给李先生将钱要回?
英文面试题目
1. Algorithms
* What’s the difference between a linked list and an array?
* Implement an algorithm to sort a linked list. Why did you pick the method you did?
* Implement an algorithm to sort an array. Why did you pick the method you did?
* Implement strstr() (or some other string library function).
* Reverse a string. Optimize for speed. Optimize for space.
* Count the number of set bits in a number. Now optimize for speed. Now optimize for size.
* 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.
* 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 print out the data in a binary tree, level by level, starting at the top?
2. 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 redesign an ATM?
* Suppose we wanted to run a microwave oven from the computer. What kind of software would you write to do this?
* How would you design a coffee-machine for an automobile.
3. Thinkers
* How are M&Ms made?
* If you had to learn a new computer language, how would you go about doing it?
* 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?
微软亚洲技术支持中心面试题目
1.进程和线程的差别。
2.Heap与stack的差别。
3.Windows下的内存是如何管理的?
4.介绍.Net和.Net的安全性。
5.客户端如何访问.Net组件实现Web Service?
6.C/C++编译器中虚表是如何完成的?
7.谈谈COM的线程模型。然后讨论进程内/外组件的差别。
8.谈谈IA32下的分页机制。
9.给两个变量,如何找出一个带环单链表中是什么地方出现环的?
10.在IA32中一共有多少种办法从用户态跳到内核态?
11.如果只想让程序有一个实例运行,不能运行两个。像winamp一样,只能开一个窗口,怎样实现?
12.如何截取键盘的响应,让所有的‘a’变成‘b’?
13.Apartment在COM中有什么用?为什么要引入?
14.存储过程是什么?有什么用?有什么优点?
15.Template有什么特点?什么时候用?
16.谈谈Windows DNA结构的特点和优点。
微软研究院笔试题目
1.#include <stdio.h>
#include <String.h>
class CBuffer
{
char * m_pBuffer;
int m_size;
publc:
CBuffer()
{
m_pBuffer=NULL;
}
~CBuffer()
{
Free();
}
void Allocte(int size)
{
m_size=size;
m_pBuffer= new char[size];
}
private:
void Free()
{
if(m_pBuffer!=NULL)
{
delete m_pBuffer;
m_pBuffer=NULL;
}
}
public:
void SaveString(const char* pText) const
{
strcpy(m_pBuffer, pText);
char* GetBuffer() const
{
return m_pBuffer;
}
};
void main (int argc, char* argv[])
{
cBuffer buffer1;
buffer1.SaveString(“Microsoft”);
printf(buffer1.GetBuffer());
}
}
找出Allocate, SaveString, main的错误。
2.打印“Welcome MSR Asia”
#include <stdio.h>
#include <string.h>
char * GetName (void)
{
//To return “MSR Asia” String
char name[]=“MSR Asia”;
return name;
}
void main(int argc, char* argv[])
{
char name[32];
//Fill in zeros into name
for(int i=0;i<=32;i++)
{
name[1]=‘/0‘;
}
//copy “Welcome” to name
name=“Welcome”;
//Append a blank char
name[8]=”;
//Append string to name
strcat(name,GetName());
//print out
printf(name);
}
找出程序中的错误。
3.#include <stdio.h>
class A
{
public:
void FuncA()
{
printf(“FuncA called/n”);
}
virtual void FuncB()
{
printf(“FuncB called/n”);
}
};
class B: public A
{
public:
void FuncA()
{
A::FuncA();
printf(“FuncAB called/n”);
}
virtual void FuncB()
{
printf(“FuncBB called/n”);
}
};
void main(void)
{
B b;
A *pa;
pa=&b;
A *pa2=new A;
b.FuncA();
b.FuncB();
pa->FuncA();
pa->FuncB();
pa2->FuncA();
pa2->FuncB();
delete pa2;
}
What is the output of the above program?
4.#include <stdio.h>
#include <string.h>
int FindSubString(char* pch)
{
int count=0;
char* p1=pch;
while(*p1!=‘/0’)
{
if(*p1==p1[1]-1)
{
p1++;
count++;
}
else
{
break;
}
}
int count2=count;
while(*p1!=‘/0’)
{
if(*p1!==p1[1]+1)
{
p1++;
count2--;
}
else
{
break;
}
if(count2==0)
return count;
return 0;
}
void ModifyString(char* pText)
{
char* p1=pText;
char* p2=p1;
while(*p1!=‘/0’)
{
int count=FindSubString(p1);
if(count>0)
{
*p2++=*p1;
sprintf(p2, “%I”, count);
while(*p2!= ‘/0’)
{
p2++;
}
p1+=count+count+1;
}
else
{
*p2++=*p1++;
}
}
}
void main(void)
{
char text[32]=“XYBCDCBABABA”;
ModifyString(text);
printf(text);
}
In the main() function, after ModifyString(text) is called, what’s the value of ‘text’?