今年的thoughtworks公司面试题 大家一起来研究研究吧
打了超多字 累死俺了 今年的thoughtworks公司面试题 大家一起来研究研究吧题目1:编号为123456789的火车经过如下轨道从左边入口处移到右边出口处(每车只能进临时轨道M一次)
-----------------------------------------------------
987654321
-------------------\ /-----------------------------
| |
| |
| |
| |
| |
|M|
| |
| |
| |
| |
|_|
按照从左向右的顺序,下面的结果不可能是______
A 123876549
B 321987654
C 321456798
D 789651234
题目2:如果M只能容纳4列车。上面选项因该选哪个______
题目3:3 3 8 8用四则运算符得出24
题目4:C#编程实现:可变长有序数组的插入(无重复数据节点)
题目5:数a和b,如何空间消耗最小交换a b中的数
题目6:For the following description about OOP, which is right?
1 An object can inherit the feature of another object;
2 A sub class can contain dditional attribute or behaviors.
3 Encapsulation is used to hide as MUCH as possible about the inner working of the interface.
4 Encapsulation prevents the program from becoming independent
5 polymorphism allows the methods have different signature but with same name.
A 12
B 14
C 23
D 35
E 45
题目7:Function club is used to simulate guest in a club. With 0 guests initially
and 50 as max occupancy, when guests beyond limitation, they need to wait outside;
when some guests leave the waiting list will decrease. The function will print out
number of guests in the club and waiting outside. The function declaration as follows:
void club(int x);
positive x stands for guests arrived, nagative x stands for guests left from
within the club
For example, club (40) prints 40,0; and then club (20) prints 50,10; and then club (-5) prints 50,5; and then club (-30) prints 25,0; and then club (-30) prints N/A; since it is impossible input.
To make sure this function works as defined, we have following set of data to pass into
the function and check the result are correct.
a 60
b 20 50 -10
c 40 -30
d 60 -5 -10 -10 10
e 10 -20
f 30 10 10 10 -60
g 10 10 10
h 10 -10 10
A a d e g
B c d f g
C a c d h
D b d g h
E c d e f
--------------------编程问答-------------------- 我靠 图咋变成这样了????????? 那个是这样才队的
题目1:编号为123456789的火车经过如下轨道从左边入口处移到右边出口处(每车只能进临时轨道M一次)
-----------------------------------------------------
987654321
-------------------\ /-----------------------------
| |
| |
| |
| |
| |
|M|
| |
| |
| |
| |
|_|
--------------------编程问答-------------------- up --------------------编程问答-------------------- dddddddddddddddddddddddddddddddddddddd --------------------编程问答-------------------- 我都看不懂 --------------------编程问答-------------------- 第1个是个数据结构的问题。我转科升本科的考试中就有这样的问题。。。。 --------------------编程问答-------------------- 8*8/3+3=24
C#编程实现:可变长有序数组的插入(无重复数据节点)
把原来的拷贝到list中。然后插入后,再拷贝到一个数组中!!
题目5:数a和b,如何空间消耗最小交换a b中的数
a=a*b;
b=a/b
a=a/b
就用2个空间就解决了。 --------------------编程问答-------------------- 楼上的
8*8/3+3=24 ?? 这个咋对阿 --------------------编程问答-------------------- //这个题也出。。。
8/(3-8/3)=24 --------------------编程问答-------------------- 题目5最好还是用异或的办法解决 <以下解析参考程序员面试宝典一书>
简而言之,用异或语句比较容易,不用担心超界问题。
如果采用
a=a+b;
b=a-b;
a=a-b;
这样做的缺点就是如果a b都是比较大的两个数 a=a+b时 就会超界
而采用
a=a^b;
b=a^b;
a=a^b;
无需担心超界面试例题 这样就比较好
这个做的原理是按位异或运算,按位异或运算符“^”是双目运算符。其功能是参与运算的两数各对应的二进位相异或,当两对应的二进位相异时,结果为1。参与运算数仍以补码出现,例如9^5可写成算式如下:
00001001^00000101 00001100 (十进制为12)
main(){
int a=9;
a=a^5;
printf("a=%d\n",a);}
00001001^00000101 得到 00001100
00001001^00001100 得到 00000101
00000101^00000101 得到 00001001
--------------------编程问答-------------------- 题目1和2貌似在考出栈和入栈,题目1选择D,题目2选择C,题目3的四则式为:8/(3-8/3)=24 --------------------编程问答-------------------- 第一题应该是D
A:挨个过去就可以了123876549
B 123依次进轨道,然后从轨道出来321,456789依次进轨道,然后从轨道出来987654,这样就成了321987654
C 123依次进轨道,然后从轨道出来321,4567逐个移动到右边,89进轨道,再出来就OK了(321456798)
D 789在前,则123456必须全部先进轨道,789过去后,65从轨道中出来,这样就成了78965,剩下1234必须先回到左边,然后需要再进一次轨道才能满足这样的顺序,故789651234不可行
第一题应该还是D
不知道1、2题目有什么区别,还是楼主没有把这个题目表述清楚。
3、8/(3-8/3)=24
程序方面的东西还在学习,就不发表个人意见了。
--------------------编程问答-------------------- 我是楼住 楼上的 1 2题区别是 1题 M轨道可以放无限车 2题M轨道可以最多放4辆车 --------------------编程问答--------------------
这个不对么。我觉得很对呀!!!
8*8=64
64/3=21
21+3=24 --------------------编程问答--------------------
up 这个 64/3=21 --------------------编程问答-------------------- dddddddddddddddddddddddddd --------------------编程问答-------------------- mark
补充:.NET技术 , C#