这是什么面试测试题?夸张了一些!!

BillSmiph 2005-11-17 12:42:08
今天同学去一家公司面试,回来一脸的垂头丧气,我问他怎么了?
他说,那家公司出的面试测试题太难了,做不出来,自己没信心了。
我看了一下,确实比较夸张……
有这么考人的么?
顺便贴试题上来,看看有没有谁来看看
<html>
<head>
<title>*中国XX集团XX有限责任公司*(XX部XX岗位)面试测试题</title>
<style>
<!--
BODY {
SCROLLBAR-FACE-COLOR: #dee3e7;
FONT-SIZE: 12px;
MARGIN: 15px 15px 15px 0px;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
SCROLLBAR-SHADOW-COLOR: #dee3e7;
COLOR: #333333;
SCROLLBAR-3DLIGHT-COLOR: #d1d7dc;
SCROLLBAR-ARROW-COLOR: #006699;
SCROLLBAR-TRACK-COLOR: #efefef;
SCROLLBAR-DARKSHADOW-COLOR: #98aab1
}
//-->
</style>
</head>
<body>
<div align="left">
<fieldset>
<legend><font color="red">程序实现详细要求</font></legend>
<font color="blue">
01.点击按钮生成随机数N;<br>
02.按钮响应函数creat_n();<br>
03.定义生成数N的长度Nlength(Nlength为偶数);<br>
04.定义生成数N中最大的元素Nmax,所有元素<=Nmax;<br>
05.可指定其中3个元素;<br>
06.生成数N每2位作为一个元素N(1),N(2),…,N(Nlength/2);<br>
07.生成数N中每个元素由小至大顺序排列,且不重复;如22,25,43,51,62,…<br>
08.新生成的随机数N自动加入为“随机数列表”的最后一个随机数;<br>
09.新生成的随机数N不得与“随机数列表”任何一个随机数相同;<br>
10.新生成的随机数N中的前3个元素与前一个随机数的前3个随机数不得相同;<br>
11.统计列表中每个元素出现的几率;
</font>
</fieldset>
<fieldset>
<legend>随机数列表</legend>
<select name="list" size="10" align="left">
<option>0318192021</option>
<option>0204071622</option>
<option>0306151821</option>
<option>0204111821</option>
<option>0203040911</option>
<option>1315161922</option>
<option>0510151617</option>
<option>0616172021</option>
<option>0102081015</option>
<option>0818192122</option>
</select>
<div align="left">
设定生成数的长度:<input type="text" name="Nlength" size="3" id="Nlength">
<br>
设定生成数的最大元素:<input type="text" name="Nmax" size="3" id="Nmax">
<br>
设定生成数的某3个元素:
<input type="text" name="Na" size="3" id="Na">
<input type="text" name="Na" size="3" id="Nb">
<input type="text" name="Na" size="3" id="Nc">
<br>
<input type="submit" value="生成新随机数" name="B1" onclick="creat_n()"><input type="text" name="newram" size="20" id="N">
</div>
</fieldset>
<hr color="green">
...全文
530 28 打赏 收藏 转发到动态 举报
写回复
用AI写文章
28 条回复
切换为时间正序
请发表友善的回复…
发表回复
BillSmiph 2005-12-05
  • 打赏
  • 举报
回复
贴出来原本是看看谁会去做的,原来真的有人看到问题就解决阿!
好消息:同学应聘成功了!
后来的消息说,
其实那公司要求的只是思路,
并不一定做完
据说是因为当时一起应聘的很多人直接放弃……
shuangren 2005-11-18
  • 打赏
  • 举报
回复
拿回去可以做出来,但当场肯定做不出来,偶习惯依赖参考手册,没有手册在旁边,那些函数的名字都记不全。
所以偶真的不适应限时考试。
不知道有没有人跟我的情况类似?
JK_10000 2005-11-18
  • 打赏
  • 举报
回复
也有可能只小于0
参考书是在本机:C:\Program Files\Microsoft Visual Studio\Common\IDE\IDE98\MSE\2052\JSCRIPT5.CHM
害我以前还总要去考虑这种情况:

查了一下java.lang.Math.random():
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
JK_10000 2005-11-18
  • 打赏
  • 举报
回复
我的参考书(是jscript,没有查javascript的参考书)上这么说:

描述
返回介于 0 和 1 之间的伪随机数。
语法
Math.random( )
说明
产生的伪随机数介于 0 和 1 之间(含 0 和 1)。在第一次加载 JScript 时随机数发生器自动产生 。
xuzuning 2005-11-18
  • 打赏
  • 举报
回复
Math.random( )

说明
产生的伪随机数介于 0 和 1 之间(含 0,不含 1),也就是,返回值可能为0,但总是小于1。在第一次加载 JScript 时随机数发生器自动产生 。


*****


alert(parseInt(0.9999)); //out 0
JK_10000 2005-11-18
  • 打赏
  • 举报
回复
xuzuning(唠叨) 的代码里这一句有可能产生一个比nmax还大1的数,尽管可能性比较小
t = parseInt(Math.random()*nmax)+1;
JK_10000 2005-11-18
  • 打赏
  • 举报
回复
感觉是个不错的题目
考的东西比较全面
基本功,编程经验,个人思维能力,代码质量,工作效率,debug效率。。等等
都可以得到很好的体现

不足之处是:
对于是知道洗牌、抽牌算法的人来说,实在是捡了太大的便宜。
光这个算法,如果自己写,
花的时间多少是个问题,
代码质量上有很大的弹性空间

xuzuning 2005-11-18
  • 打赏
  • 举报
回复
经管这个题目不适合做“面试”,但还是一个很好的题目。有时间做做还是很好的!
以下解答接在上面的解答之后
08.新生成的随机数N自动加入为“随机数列表”的最后一个随机数
var list = document.getElementById("list");
list.options[list.options.length] = new Option(n);

11.统计列表中每个元素出现的几率
//重新提取随机数列表
get_random_list();
//为简化书写建立到显示区域的联系并初始化显示区域
ar = new Array();
for(i=1; i<100; i++) {
id = i;
if(i < 10) id = '0'+i;
ar[id] = document.getElementById(id);
ar[id].value = '';
}
//统计
var cnt = 0;
for(i=0; i<random_sub_list.length; i++) {
t = random_sub_list[i];
for(j=0; j<t.length; j++) {
cnt++;
ar[t[j]].value++;
}
}
//计算百分比
for(i in ar)
if(ar[i].value != '')
ar[i].value = (ar[i].value/cnt*100).toFixed(2);
}


********

注意,这个题目有错误:
显示统计值的文本框缺少编号为00、10、20、30、40、50、60、70、80、90的对象
而“随机数列表”中存在
0318192021 的20
0616172021 的20
0102081015 的10
虽然有可能不准出现00(题中未说明)
但是不允许个位为0是必须声明的!因为这涉及到随机树产生的算法


kenwoodking 2005-11-18
  • 打赏
  • 举报
回复
看到xuzuning(唠叨)更新的题解,真要叹服了:迅速好快啊……
moodboy1982 2005-11-17
  • 打赏
  • 举报
回复
哈,兄弟,你怎么发两个贴子,问一样的问题呀?
kc_ren 2005-11-17
  • 打赏
  • 举报
回复
楼上 把题想的太复杂了 自己提高了难度
BillSmiph 2005-11-17
  • 打赏
  • 举报
回复
谁来试试看?
BillSmiph 2005-11-17
  • 打赏
  • 举报
回复
<fieldset>
<center>
<legend>统计每个元素出现的几率</legend>
01:<input type="text" name="01" size="3" id="01">%<font color="red">||</font>
11:<input type="text" name="11" size="3" id="11">%<font color="red">||</font>
21:<input type="text" name="21" size="3" id="21">%<font color="red">||</font>
31:<input type="text" name="31" size="3" id="31">%<font color="red">||</font>
41:<input type="text" name="41" size="3" id="41">%<font color="red">||</font>
51:<input type="text" name="51" size="3" id="51">%<font color="red">||</font>
61:<input type="text" name="61" size="3" id="61">%<font color="red">||</font>
71:<input type="text" name="71" size="3" id="71">%<font color="red">||</font>
81:<input type="text" name="81" size="3" id="81">%<font color="red">||</font>
91:<input type="text" name="91" size="3" id="91">%<font color="red">||</font>
<br>
02:<input type="text" name="02" size="3" id="02">%<font color="red">||</font>
12:<input type="text" name="12" size="3" id="12">%<font color="red">||</font>
22:<input type="text" name="22" size="3" id="22">%<font color="red">||</font>
32:<input type="text" name="32" size="3" id="32">%<font color="red">||</font>
42:<input type="text" name="42" size="3" id="42">%<font color="red">||</font>
52:<input type="text" name="52" size="3" id="52">%<font color="red">||</font>
62:<input type="text" name="62" size="3" id="62">%<font color="red">||</font>
72:<input type="text" name="72" size="3" id="72">%<font color="red">||</font>
82:<input type="text" name="82" size="3" id="82">%<font color="red">||</font>
92:<input type="text" name="92" size="3" id="92">%<font color="red">||</font>
<br>
03:<input type="text" name="03" size="3" id="03">%<font color="red">||</font>
13:<input type="text" name="13" size="3" id="13">%<font color="red">||</font>
23:<input type="text" name="23" size="3" id="23">%<font color="red">||</font>
33:<input type="text" name="33" size="3" id="33">%<font color="red">||</font>
43:<input type="text" name="43" size="3" id="43">%<font color="red">||</font>
53:<input type="text" name="53" size="3" id="53">%<font color="red">||</font>
63:<input type="text" name="63" size="3" id="63">%<font color="red">||</font>
73:<input type="text" name="73" size="3" id="73">%<font color="red">||</font>
83:<input type="text" name="83" size="3" id="83">%<font color="red">||</font>
93:<input type="text" name="93" size="3" id="93">%<font color="red">||</font>
<br>
04:<input type="text" name="04" size="3" id="04">%<font color="red">||</font>
14:<input type="text" name="14" size="3" id="14">%<font color="red">||</font>
24:<input type="text" name="24" size="3" id="24">%<font color="red">||</font>
34:<input type="text" name="34" size="3" id="34">%<font color="red">||</font>
44:<input type="text" name="44" size="3" id="44">%<font color="red">||</font>
54:<input type="text" name="54" size="3" id="54">%<font color="red">||</font>
64:<input type="text" name="64" size="3" id="64">%<font color="red">||</font>
74:<input type="text" name="74" size="3" id="74">%<font color="red">||</font>
84:<input type="text" name="84" size="3" id="84">%<font color="red">||</font>
94:<input type="text" name="94" size="3" id="94">%<font color="red">||</font>
<br>
05:<input type="text" name="05" size="3" id="05">%<font color="red">||</font>
15:<input type="text" name="15" size="3" id="15">%<font color="red">||</font>
25:<input type="text" name="25" size="3" id="25">%<font color="red">||</font>
35:<input type="text" name="35" size="3" id="35">%<font color="red">||</font>
45:<input type="text" name="45" size="3" id="45">%<font color="red">||</font>
55:<input type="text" name="55" size="3" id="55">%<font color="red">||</font>
65:<input type="text" name="65" size="3" id="65">%<font color="red">||</font>
75:<input type="text" name="75" size="3" id="75">%<font color="red">||</font>
85:<input type="text" name="85" size="3" id="85">%<font color="red">||</font>
95:<input type="text" name="95" size="3" id="95">%<font color="red">||</font>
<br>
06:<input type="text" name="06" size="3" id="06">%<font color="red">||</font>
16:<input type="text" name="16" size="3" id="16">%<font color="red">||</font>
26:<input type="text" name="26" size="3" id="26">%<font color="red">||</font>
36:<input type="text" name="36" size="3" id="36">%<font color="red">||</font>
46:<input type="text" name="46" size="3" id="46">%<font color="red">||</font>
56:<input type="text" name="56" size="3" id="56">%<font color="red">||</font>
66:<input type="text" name="66" size="3" id="66">%<font color="red">||</font>
76:<input type="text" name="76" size="3" id="76">%<font color="red">||</font>
86:<input type="text" name="86" size="3" id="86">%<font color="red">||</font>
96:<input type="text" name="96" size="3" id="96">%<font color="red">||</font>
<br>
07:<input type="text" name="07" size="3" id="07">%<font color="red">||</font>
17:<input type="text" name="17" size="3" id="17">%<font color="red">||</font>
27:<input type="text" name="27" size="3" id="27">%<font color="red">||</font>
37:<input type="text" name="37" size="3" id="37">%<font color="red">||</font>
47:<input type="text" name="47" size="3" id="47">%<font color="red">||</font>
57:<input type="text" name="57" size="3" id="57">%<font color="red">||</font>
67:<input type="text" name="67" size="3" id="67">%<font color="red">||</font>
77:<input type="text" name="77" size="3" id="77">%<font color="red">||</font>
87:<input type="text" name="87" size="3" id="87">%<font color="red">||</font>
97:<input type="text" name="97" size="3" id="97">%<font color="red">||</font>
<br>
08:<input type="text" name="08" size="3" id="08">%<font color="red">||</font>
18:<input type="text" name="18" size="3" id="18">%<font color="red">||</font>
28:<input type="text" name="28" size="3" id="28">%<font color="red">||</font>
38:<input type="text" name="38" size="3" id="38">%<font color="red">||</font>
48:<input type="text" name="48" size="3" id="48">%<font color="red">||</font>
58:<input type="text" name="58" size="3" id="58">%<font color="red">||</font>
68:<input type="text" name="68" size="3" id="68">%<font color="red">||</font>
78:<input type="text" name="78" size="3" id="78">%<font color="red">||</font>
88:<input type="text" name="88" size="3" id="88">%<font color="red">||</font>
98:<input type="text" name="98" size="3" id="98">%<font color="red">||</font>
<br>
09:<input type="text" name="09" size="3" id="09">%<font color="red">||</font>
19:<input type="text" name="19" size="3" id="19">%<font color="red">||</font>
29:<input type="text" name="29" size="3" id="29">%<font color="red">||</font>
39:<input type="text" name="39" size="3" id="39">%<font color="red">||</font>
49:<input type="text" name="49" size="3" id="49">%<font color="red">||</font>
59:<input type="text" name="59" size="3" id="59">%<font color="red">||</font>
69:<input type="text" name="69" size="3" id="69">%<font color="red">||</font>
79:<input type="text" name="79" size="3" id="79">%<font color="red">||</font>
89:<input type="text" name="89" size="3" id="89">%<font color="red">||</font>
99:<input type="text" name="99" size="3" id="99">%<font color="red">||</font>
<br>
</fieldset>
</center>
</body>
</html>
BillSmiph 2005-11-17
  • 打赏
  • 举报
回复
我是觉得很奇怪
那家公司当时说的是
3个小时答卷,
另外1小时调试结果
ok的话第二天就可以上班
也可以带回去做,
一星期内完成的话再面试……
我同学回来了,没做出来
我看我3个小时肯定完不成……
xuzuning 2005-11-17
  • 打赏
  • 举报
回复
看人挑担不吃力!都说很容易,不妨做做看。面试时遇到这样的题,也只有“投降”了

写了点(近3小时),大家看看。对了,还有第8、11没有做

<script>
//检查值是否在数组中
function in_array(value, array) {
for(var i=0; i<array.length; i++)
if(value == array[i]) return true;
return false;
}

//把字符串按2个字符一组切割成数组
function slice(s) {
var ar = new Array();
for(var i=0; i<s.length; i+=2)
ar.push(s.substr(i, 2));
return ar;
}

//提取随机数列表
function get_random_list() {
var i;
var list = document.getElementById("list");
random_list = new Array();
for(i=0; i<list.length; i++)
random_list[i] = list.options[i].text;
random_sub_list = new Array();
for(i=0; i<random_list.length; i++) {
random_sub_list[i] = slice(random_list[i]);
}
}

//生成新随机数
function creat_n() {
//设定的生成数长度
nlength = document.getElementById("Nlength").value;
if(nlength == '') {
alert('必须有生成数长度');
document.getElementById("Nlength").focus();
return false;
}
if(nlength % 2 != 0) {
alert('生成数长度必须是偶数');
document.getElementById("Nlength").focus();
return false;
}

//设定的生成数的最大元素
nmax = document.getElementById("Nmax").value;
if(nmax == '') {
alert('必须有生成数的最大元素');
document.getElementById("Nmax").focus();
return false;
}

//设定的生成数的某3个元素
na = document.getElementById("Na").value;
if(na != '' && na < '01') {
alert('不能为空');
document.getElementById("Na").focus();
return false;
}
nb = document.getElementById("Nb").value;
if(nb != '' && nb < '01') {
alert('不能为空');
document.getElementById("Nb").focus();
return false;
}
nc = document.getElementById("Nc").value;
if(nc != '' && nc < '01') {
alert('不能为空');
document.getElementById("Nc").focus();
return false;
}

//提取随机数列表备用
get_random_list();

//开始生成随机数
var i, t, ar, p;
var err = 0;
while(1) {
ar =new Array();
p = 0;
if(na != '') {
ar.push(na);
p++;
}
if(nb != '') {
ar.push(nb);
p++;
}
if(nc != '') {
ar.push(nc);
p++;
}
len = nlength/2 - p;
for(i=0; i<len; i++) {
do {
t = parseInt(Math.random()*nmax)+1;
if(t < 10)
t = '0'+t;
}while(in_array(t, ar));
ar.push(t);
}
ar.sort();
n = ar.join('');
t = random_list[random_list.length-1];
if(! in_array(n, random_list) && n.substr(0, 6) != t.substr(0, 6))
break;
if(err++ > 100) {
alert('计算超时');
return;
}
}
document.getElementById("N").value = n;
}
</script>
dh20156 2005-11-17
  • 打赏
  • 举报
回复
仔细看看题目还是比较容易的说。要求对数组操作比较熟悉。
faisun 2005-11-17
  • 打赏
  • 举报
回复
不难,就是有点烦.
kc_ren 2005-11-17
  • 打赏
  • 举报
回复
一点也不难啊 很快的 没有什么技术问题
rawjim 2005-11-17
  • 打赏
  • 举报
回复
对于应届毕业生来说,确实有点麻烦。
对于有Javascript开发经验的人,是很easy的。如果叫我做,预计时间是40至90分钟。
  • 打赏
  • 举报
回复
他给多少马泥,4000以下不给他答。
加载更多回复(8)

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧