《.NET程序员面试宝典》未出版的28.4

上传人:碎****木 文档编号:229367445 上传时间:2021-12-25 格式:DOCX 页数:12 大小:98.23KB
返回 下载 相关 举报
《.NET程序员面试宝典》未出版的28.4_第1页
第1页 / 共12页
《.NET程序员面试宝典》未出版的28.4_第2页
第2页 / 共12页
《.NET程序员面试宝典》未出版的28.4_第3页
第3页 / 共12页
亲,该文档总共12页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《《.NET程序员面试宝典》未出版的28.4》由会员分享,可在线阅读,更多相关《《.NET程序员面试宝典》未出版的28.4(12页珍藏版)》请在金锄头文库上搜索。

1、28.4关于表格面试例题 1:如下表,10 个盒子,分别装一些数字。美国体育网络 A公司 2021 年规律测试题63921129148661Box#12345678910Start12Add: (number in box 4) + (number in box 2) , put result into box 7.盒 4 数+盒 2 数之和置于盒 7Add: (number in box 7) + (number in the box whose number is in box 6) , put result into box 6.盒 7 数+盒号为盒 63E nd数的数之和置于盒 6Mu

2、ltiply: (number in box 6) * (number in the box 1) put result into box 5.盒 6 数盒号为盒 6 数的数之积置于盒 5 中 What number is now in box 5? 盒 5 中数是多少解析:流程步骤如下:(1) 盒 4 数+盒 2 数之和置于盒 7,即 2+3=5,盒 7 数现在为 5。(2) 盒 7 数为 5,盒 6 数为 2,盒 2 数为 3。盒 7 数+盒 2 数之和置于盒 6,即 5+3=8,盒 6 数现在为 8。第 28 章规律测试(3) 盒 6 数为 8,盒 1 数为 6,盒 6 数盒 1 数之积

3、置于盒 5,即 68=48,盒 5 数现在为 48。答案:48。353面试例题 2:如下表,8 个盒子,分别装一些数字。美国体育网络 A公司 2021 年规律测试题Box#12345678372151240Start1234N oYesE ndPut: (number in box 8) into box 1. 盒 8 数置于盒 1 Add: (number in box 1) + (number in the box2) , putresult into box 1.盒 1 数+盒 2 数之和置于盒 1Change Instruction 2: Increase the second box

4、-number mentioned in it, by 1.转变步骤 2:提高其次个提及的盒号码+1Is The second box number mentioned in Instruction 2, greater than (number in box 7)?步骤 2 中其次个提及的盒号码盒 7 数What number is now in box 1? 盒 1 数为多少? 解析:流程步骤如下:(1) 盒 8 数置于盒 1,盒 8 数为 0,所以盒 1 数为 0。(2) 盒 1 数+盒 2 数之和置于盒 1,即 0+7=7,盒 1 数现在为 7。(3) 转变步骤 2:提高其次个提及的盒

5、号码+1,其次个提及的盒号码为盒 2,现在改为盒 3。(4) 看其次个提及的盒号码是否大于盒7 数,盒 7 数字为 4,盒号码 3 还不大于盒 7 数。(5) 盒 1 数+盒 3 数之和置于盒 1,即 7+2=9,盒 1 数现在为 9。(6) 转变步骤 2:提高其次个提及的盒号码+1,其次个提及的盒号码为盒 3,现在改为盒 4。(7) 看其次个提及的盒号码是否大于盒7 数,盒 7 数字为 4,盒号码 4 还不大于盒 7 数。(8) 盒 1 数+盒 4 数之和置于盒 1,即 9+1=10,盒 1 数现在为 10。(9) 转变步骤 2:提高其次个提及的盒号码+1,其次个提及的盒号码为盒 4,现在改

6、为盒 5。(10) 看其次个提及的盒号码是否大于盒7 数,盒 7 数字为 4,盒号码 5 大于盒 7 数。答案:10。面试例题 3:如下表,12 个盒子,分别装一些数字。美国体育网络A 公司 2021 年规律测试题Box 123456789101112211Start12-93-212496314Substract: (number in box 10) -1, put result into box 10.盒 10 数-1 后置于盒 10Put (number in box 9) into box 1.盒 9 数置于盒 1Is the first box-number mentioned i

7、n Instruction 2, an even3number?在Instruction 2提及的第一个盒号码是偶数吗?N o4Take as your next instruction, the one whose number isYesin the box whose number is in box 8.将下面这个作为步骤:5步骤数为盒号码为盒 8 数的数。Yes6789N oE ndChange Instruction 2:Decrease thefirst box-number mentioned in it, by 1. 转变步骤2:将第一个提及的盒号码-1Add: (numbe

8、r in box 10) + (number in the box 4) , putresult into box 10. 盒 10 数+盒 4 数后置于盒 10 Change Instruction 2: Decrease the first box-numbermentioned in it, by 1. And increase the second box-numbermentioned in it, by number in box 11. 转变步骤 2:将第 1个提及的盒号码-1,将第 2 个提及的盒号码+盒 11 数Is the last box-number mentioned

9、 in Instruction 2, equal to (number in box 12) ? 步骤 2 中最终一个提及的盒号码=盒 12 数?Take as your next Instruction, the one before Instruction 3.将下面这个作为步骤:步骤数为步骤 3 前的那个。What number is now in?Box 3? Box 10? 解析:流程步骤如下:(1) 盒 10 数-1 置于盒 10,盒 10 数原为 3,所以盒 10 数为 2。(2) 盒 9 数置于盒 1,盒 1 数现在为 6;(3) 步骤 2 中提到的第一个盒号码是偶数吗?步骤

10、2 中提到的第一个盒号码是盒 9,非偶数。(4) 由于非偶数执行步骤 4,步骤数为盒号码为盒 8 数的数。盒 8 数为 9,盒 9 数为 6。也是执行步骤 6,步骤 6 是将盒 10 数+盒 4 数后置于盒 10;盒 10 数为 2,盒 4 数为 3,累加后盒 10 数为 5。(5) 转变步骤 2:将第一次提到的盒号码减 1;步骤 2 第一次提到的盒号码 9-1 为盒 8。(6) 盒 10 数+盒 4 数后置于盒 10;盒 10 数为 5,盒 4 数为 3,累加后盒 10 数为 8。(7) 转变步骤 2:将第 1 个提及的盒号码-1,步骤 2 第一次提到的盒号码 8-1 为盒 7。将第 2 个

11、提及的盒号码+盒 11 数。步骤 2 第 2 次提到的盒号码 1+盒 11 数 1=盒 2。(8) 看步骤 2 中最终一个提及的盒号码=盒 12 数?步骤 2 中最终一个提及的盒号码为盒 2,盒 12 数为 4。故两者不等。第 28 章规律测试(9) 将下面这个作为步骤:步骤数为步骤3 前的那个。即执行步骤2:盒 7 数置于盒 2。答案:盒 3 没有变动,仍为-9。盒 10 为 8。面试例题 4:The object of the following flow-chart is to rearrange in boxes 1,2 and 3 in such a fashion that, at

12、 the end:该流程图的目标是重组盒 1,2,3 以到达如下目标美国体育网络 A 公司 2021 年规律测试题Box 3 will always contain the largest mumber. 盒 3 数最大Box 1 will always contain the smallest mumber. 盒 1 数最小 However, this flow-chart is INCORRECT, and it stands, it will notaccomplish the desired purpose.然而,此流程图并不正确,假设按此算Start法,将无法到达目的Which on

13、e instruction must be changed to correct the1YesN oflow-chart.哪一个指令必需修正才能到达目标23Is (Number in box 1) less than (Number in box 2)?盒 1 数盒 2 数?4Put (number in box 1) into box 4.盒 1 数置于盒 45YesN oPut (number in box 2) into box 1.盒 2 数置于盒 16Put (number in box 4) into box 2. 盒 4 数置于盒 273548E nd第 28 章规律测试Is

14、(Number in box 3) less than (Number in box 2)?盒 3 数盒 2 数? Put (number in box 2) into box 4.盒 2 数置于盒 4Put (number in box 3) into box 2.盒 3 数置于盒 2 Put (number in box 4) into box 3.盒 4 数置于盒 3解析:假设对规律程序比较生疏,可以看到问题消灭在 Instruction 5, 由于假设盒 3 数盒 2 数就直接End,盒 3 数就不行能最大了。此题实际上分为两块,Instruction 2,3,4 作为一块,用来计算盒1,盒2 中较小的数,并交换位置,盒 4 的用处是作为中转空间;Instruction 6,7,8作为一块,用来计算盒2,盒 3 中较大的数,并交换位置,盒 4 的用处是作为中转空间。只要保证盒 1盒 2,且盒 2盒 3

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 教育/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号