C/C++笔试题(9)

 

Intel笔试面试题目

  智力题

1.每天中午从法国塞纳河畔的勒阿佛有一艘轮船驶往美国纽约,在同一时刻纽约也有一艘轮船驶往勒阿佛。已知横渡一次的时间是77夜,轮船匀速航行,在同一航线,轮船近距离可见。
  请问今天中午从勒阿佛开出的船会遇到几艘从纽约来的船?


  2.巴拿赫病故于 1945 8 31 。他的出生年份恰好是他在世时某年年龄的平方,问:他是哪年出生的?
  答案:
  设他在世时某年年龄为x,则x的平方<1945,且x为自然数。其出生年份x的平方            ;他在世年龄1945   ;x  1945的平方根   ;44.1,则x应为44或略小于此的数。而x      ;44时,x      ;44×43     ;1892,算得其在世年龄为1945      ;1892       ;53;又x    ;43时,x       ;43×42    ;1806,得其在世年龄为1945    ;1806     ;       x再取小,其在世年龄越大,显然不妥。故x&#61501;44,即他出生于1892年,终年53岁。
  3
   (图形描述:一个各边相等的十字图案)
  上图中各边相等,要求:用最少的分割,拼成一个正方形。


笔试题目


  10
  #include “stdafx.h”
  
#include <iostream.h>
  
struct bit
  
{ int a:3;
  
int b:2;
  
int c:3;
  
};
  
int main(int argc, char* argv[])
  
{ bit s;
  
char *c = (char*)&s;
  
*c = 0x99;
  
cout << s.a <<endl <<s.b<<endl<<s.c<<endl;
  
return 0;
  
}
  
Output:?
  11

  挑bug,在linux下运行:
  #include <stdio.h>
  
char *reverse(char* str)
  
{
  
int len=0, i=0;
  
char *pstr=str, *ptemp,*pd;
  
while(*++pstr)
  
len++;
  
pstr--;
  
//ptemp=(char*)malloc(len+1);
  
ptemp=(char*)malloc(len+1);
  
pd=ptemp;
  
while(len--){
  
*ptemp=*pstr;
  
ptemp++;
  
pstr--;
  
i++;
  
}
  
*ptemp=*pstr;
  
ptemp++;
  
*ptemp=‘/ 0’ ;
  
return pd;
  
}
  
main()
  
{
  
char string[40]= “Hello World!”;
  
char *pstr=string;
  
printf(“%s”, pstr);
  
printf(“%s”, reverse(pstr));
  
}
  

 

 

Intel 2004北京笔试题
  问答题
  1.你觉得C程序中为什么会有main(),有没有想过exitreturn,或什么都不做也可以让程序正常终止?
  2TOTAL个人围一圈,从1开始数到N,谁数到N出圈,下一个人继续从1开始数,返回最后一个出局的人。
  #define TOTAL 15;
  
int xxxx(int N)
  
{
   int ring[TOTAL] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1} //全是
1
  
int nextstart = 0, counter=0;
  
for (i =1; i<TOTAL; i++){
  
counter = 0;
  
while(counter <N) {
  
if (_______________)
  
( ;)
  
else
  
(____________;)
  
}
  
ring[nextstart]=0
  
}
  
return nextstart +1;
  
}

IBM笔试题目


  字母矩阵题目(15分钟)
  给你一个矩阵:
   (一) (二) (三) (四) (五)
   1 a b c d e
  
2 b c a e d
   3 c
b e a d
   4 c
e d b a
  
5 e d a c b
  回答以下问题。

  (1)将第一行和第四行交换后,第一行第四个字母下面的左边的下面的右边的字母是 。(简单)
  (2)将所有出现在d左边的字母从矩阵中删掉。将所有出现在a左边的c字母从矩阵中删掉。如果矩阵中剩下的字母的种类的数目大于3,答案为原矩阵中左上方至右下方对角线上出现两次的字母。如果矩阵中剩下的字母的种类的数目小于或者等于3,答案为原矩阵中右上至左下对角线上出现4次的字母是
  (3)将所有的a4替换,所有的d2替换,哪一列的总和 最大
  1 2 3 4 第五列
  (4)从左上角的字母开始,顺时针沿矩阵外围,第4次出现的字母是
  a b c d e
  (5)沿第5列从上到下,接着沿第3列从下到上,接着沿第4列从上到下,接着沿第1列从下到上,接着沿第2列从上到下,第1个出现5次的字母是

  a b c d e
  (6)从左上角的字母开始,顺时针沿矩阵外围,第4次出现的字母是以下哪个

  a b c d e

智力题


  1.有50家人家,每家一条狗。有一天警察通知,50条狗当中有病狗,行为和正常狗不一样。每人只能通过观察别人家的狗来判断自己家的狗是否生病,而不能看自己家的狗,如果判断出自己家的狗病了,就必须当天一枪打死自己家的狗。结果,第一天没有枪声,第二天没有枪声,第三天开始一阵枪响,问:一共死了几条狗?

 1.死了3条(第几天枪响就有几条)。
  简单分析:从有一条不正常的狗开始,显然第一天将会听到一声枪响。这里的要点是你只需站在那条不正常狗的主人的角度考虑。
  有两条的话思路继续,只考虑有两条不正常狗的人,其余人无需考虑。通过第一天他们了解了对方的信息。第二天杀死自己的狗。换句话说每个人需要一天的时间证明自己的狗是正常的。有三条的话,同样只考虑那三个人,其中每一个人需要两天的时间证明自己的狗是正常的狗。


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

214,或者47


  3.一个经理有三个女儿,三个女儿的年龄加起来等于13,三个女儿的年龄乘起来等于经理自己的年龄。有一个下属已知道经理的年龄,但仍不能确定经理的三个女儿的年龄,这时经理说只有一个女儿的头发是黑的,然后这个下属就知道了经理的三个女儿的年龄。请问三个女儿的年龄分别是多少?为什么?
  3答案:分别是229  ???
  简单分析:

  1 1 11 11 伪穷举,呵呵
  1 2 10 20
  
1 3 9 27
  
1 4 8 32
  
1 5 7 35
  
1 6 6 36
  2 2 9 36在所有的可能性中,只有这两个相同,如果经理的年龄为其他,则他下属就可以确定              三个人分别为几岁了,所以只有两种可能:166或者229。如果是166的话,那么两个同样大的6岁的孩子应该都是黑头发, 所以只有229比较合理,大的那个是黑头发,另外两个是黄毛丫头

  2 3 8 40
  
2 4 7 56
  
2 5 6 60
  
3 3 7 42
  
3 4 6 72
  
3 5 5 75
  4 4 5 80


 
<<IBM>>

63.怎样用最快的方法判断链表是否有环?

用两个指针来遍历这个单向链表,第一个指针p1,每次走一步;第二个指针p2,每次走两步;  p2 指针追上 p1的时候,就表明链表当中有环路了。

 

64.c++中引用和指针有什么不同?指针加上什么限制等于引用?

 

65.做的项目,遇到的困难,怎样解决?

 

66.在房里有三盏灯,房外有三个开关,在房外看不见房内的情况,你只能进门一次,你用什么

方法来区分那个开关控制那一盏灯.

 

67.有两根不均匀分布的香,每根香烧完的时间是一个小时,你能用什么方法来确定一段15

钟的时间.

 

68.一个经理有三个女儿,三个女儿的年龄加起来等于13,三个女儿的年龄乘起来等于经理自

己的年龄,有一个下属已知道经理的年龄,但仍不能确定经理三个女儿的年龄,这时经理说只

有一个女儿的头发是黑的,然后这个下属就知道了经理三个女儿的年龄.请问三个女儿的年

龄分别是多少?为什么?

 

69.操作符重载

class CMyObject:pulic CObject

{

Public:

CMyObject();

CMyObject &operator=(const CMyObject &my);

private:

CString strName;

int nId:

};

请重载赋值操作符

 

 

70.链表

Struct structList

{

int value;

structList *pHead;

}

Struct LinkedList *pMyList;

请编写删除链表的头、尾和第n个节点的程序

 

 

71.Socket API制作一个聊天程序,通讯协议使用tcp/ip。要求有简单界面即可,支持多

人聊天。

 

 

72.如果有过工作经验,请说明在先前公司的工作以及离职原因(如无,请说明毕业后的个

人展望)


  

社会招聘笔试题


  1.一个粗细均匀的长直管子,两端开口,里面有4个白球和4个黑球,球的直径、两端开口的直径等于管子的内径,现在白球和黑球的排列是wwwwbbbb,要求不取出任何一个球,使得排列变为bbwwwwbb
  2.一只蜗牛从井底爬到井口,每天白天蜗牛要睡觉,晚上才出来活动,一个晚上蜗牛可以向上爬3尺,但是白天睡觉的时候会往下滑2尺,井深10尺,问蜗牛几天可以爬出来?
  3.在一个平面上画1999条直线最多能将这一平面划分成多少个部分?
  4.在太平洋的一个小岛上生活着土人,他们不愿意被外人打扰,一天,一个探险家到了岛上,被土人抓住,土人的祭司告诉他,你临死前还可以有一个机会留下一句话,如果这句话是真的,你将被烧死,是假的,你将被五马分尸,可怜的探险家如何才能活下来?
  5.怎样种四棵树使得任意两棵树的距离相等。
  627个小运动员在参加完比赛后,口渴难耐,去小店买饮料,饮料店搞促销,凭三个空瓶可以再换一瓶,他们最少买多少瓶饮料才能保证一人一瓶?
  7.有一座山,山上有座庙,只有一条路可以从山上的庙到山脚,每周一早上8点,有一个聪明的小和尚去山下化缘,周二早上8点从山脚回山上的庙里,小和尚的上下山的速度是任意的,在每个往返中,他总是能在周一和周二的同一钟点到达山路上的同一点。例如,有一次他发现星期一的830和星期二的830他都到了山路靠山脚的3/4的地方,问这是为什么?
  8.有两根不均匀分布的香,每根香烧完的时间是一个小时,你能用什么方法来确定一段15分钟的时间?
  英文面试题目
  1. Describe your greatest achievement in the past 4-5 years?
  
2. What are your short & long term career objectives? What do you think is the most ideal job for you?
  
3. Why do you want to join IBM? What do you think you can contribute to IBM?
  

 

宝洁公司(P&G)面试题目


  宝洁公司招聘题号称由高级人力资源专家设计,无论您如实或编造回答,都能反应您某一方面的能力。核心部分的题目如下:
  Please provide concise examples that will help us better understand your capabilities.
  
1. Describe an instance where you set your sights on a high/demanding goal and saw it through completion.
  
2. Summarize a situation where you took the initiative to get others going on an important task or issue, and played a leading role to achieve the results you wanted.
  
3. Describe a situation where you had to seek out relevant information, define key issues, and decide on which steps to take to get the desired results.
  
4. Describe an instance where you made effective use of facts to secure the agreement of others.
  
5. Give an examples of how you worked effectively with people to accomplish an important result.
  
6. Describe a creative/innovative idea that you produced which led to a significant contribution to the success of an activity or project.
  
7. Provide an example of how you assessed a situation and achieved good results by focusing on the most important priorities.
  
8. Provide and example of how you acquired technical skills and converted them to practical application
  解答范例:

  1. Demnding Goal: To design a musical and dramatic show to celebrate the centennial Anniversary of Tianjin University.
  
The person who reach this goal: Chairman of Tianjin University Student Union What I learned from this observation: It is not necessary for a true leader to be an expert in such or such field of his career. But he must possessthe charismatic and the capacity to drive different people, who have diverging opinions, or even conflicting interests, to proceed togother to the sameorganizational goal.
  
2. The activity I initiated: To organize a group to sing English anthems on Charistmas Eve, visit all domitories in university and send christmas gifts on behalf of our English Association The desired result: To broaden the students’ horizons about Western culture.
  
My leading role: Combine the representatitives’ suggestions with my idea and draw the decision on:
  
* What songs to play?
  
* Who could attend the choir?
  
* Which spots we performed on?
  
The result: Many students said that they felt the warmness we sent to them and they hoped we would hold such activities next Charistmas.
  
3. Background: I organized the first activity after the establishment of the Management School English Association.
  
The desired result: To help the freshmen and the sophomores with their English while publicizing our group.
  
Key issue:
  
* What aspect of the students’ English abilities needed refining? Relevant Information:
  
* What kind of entertainment was popular among students and also offered chances for them to learn English most effectively?
  
* Which foreign teacher was suitable for this position?
  
* When was our member free?
  
* Whch place was convenient for most attendances?
  
* Other related factors, such as the availibility of facilities and the layout of the spots.
  
4. Background: I advanced a plan to found an English Garden in collaboration with fraternal association in neighboring university.
  
The disagreement:
  
* The authority of our school may dissent.
  
* The cost was expensive, and we had no enough human resoure to carry on this project.
  
* There were too many English corners. Another one was unneccessaty. The facts I made use:
  
* Our dean approved this proposal.
  
* Our partner was willing to provide financial assistantship. And our members volunteered to design the details of the plan and implement it.
  
* The poll showed that the current English corners did not meet the students’ requirement and lacked uniqueness. The result: Others were convinced and we founded the English Garden successfully.
  
5. Background: In the military training, we hold a Military Songs Competition.
  
Working procedure:
  
Design: I cooperated with my collegues to figure out the climax of the performance, the musical accompaniment of the songs and the whole arrnagement ofthe narrative poem.
  
Rehearsal: I worked together with those who were in charge of the lights, sounds and scenes to create the perfect artistic effect.
  
On stage: I reminded my fellows with gestures and eye expressions. Also, we coped with an emergency coherently.
  
The result: Our military team won the second prize in this competition.
  
6. Activity: To hold the Perspective Entrepreneur Contest.
  
The innovative idea I produced: To simulat a board meeting of a company, in which our candidates debated the feasibility of selling modern fitness equipment according to the market information they collected.
  
The result: The contest was hold based on my proposal.
  
7. Background: On one morning when our promotion month first began, I found that the inventories in some department stores were not adequate.
  
My assessment of the situation: The four promoting stores were not very far from each other, and the time they opened was not the same. It was possible to fetch some stock from another store and made up for it later.
  
The priorities: To satisfy the stocking demand of the store which had the largest number of customers.
  
8. Background: In the inverstigation of customers’ opinions about the taste of a new kind of beer, I found that the questionnaire form was out of date and limited the freedom of the responsers’ choices.
  
Technical skills: The scientific arrangement of questionnaire form
  
The result: With the help the converted form, our company obtained more objective and effective information.
    

 阿尔卡特(中国)的面试题目


  全部用C语言完成:
  1.自己定义数据结构,写出程序:在一个单向链表中,往I位置插入一个节点。

Typedef struct LNode{

Elemtype data;

Struct Lnode *next;

} LNode,*LinkList;

bool ListInsert(LinkList &L,int I,ElemType e)

{

   p=L;  j=0;

while(p&&j<i){p=p->next; ++j;} //寻找第i个节点

if(!p||j>i) return false;

s=(LinkList)malloc(sizeof(LNode));

s->data=e;  s->next=p->next;

p->next=s;

}
  2.自己定义数据结构,写出程序:二叉树的前序遍历。

  3.不允许使用系统时间,写出一个随机数生成函数。

Google


  这次是连环游戏,每一题的答案将在下一题中用到。
  1{first 10-digit prime found in consecutive digits e}.com.
  e中出现的连续的第一个10个数字组成的质数。

  27427466391.com
  
Congratulations,Youve made it to level 2. Go to www.Linux.org and enter Bobsyouruncle as the login and the answer to this equation as the password.
  f(1)= 7182818284
  
f(2)= 8182845904
  
f(3)= 8747135266
  
f(4)= 7427466391
  
f(5)=__________
  update:提示:f(1)
f(4)e中连续的10个数字满足总和等于49的前4个,f(5)当然是让你搜索第5个咯,编个小程序吧。
  答案:5966290435
  3
www.Linux.org
  4www.google.com/labjobs/
  via:
  
Google recruits eggheads with mystery billboard
  
Mysterious Billboard May Be Google Recruitment Ad
  
Myserious billboard
  
Google is behind mystery geek trap
  写一句俳句来描述搜索流量季节性预测的可能方法。

  用三种颜色为一个二十面体涂颜色,每面都要覆盖,你能够用多少种不同的涂法?你将选择哪三种颜色?
  这是一个我们故意留给你你空白,请填充一些你喜欢的东西。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值