今年的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
-------------------------------
引别人的回答:
第一题应该是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
程序方面的东西还在学习,就不发表个人意见了。
转载于:https://blog.51cto.com/ahead51/771704