[ 登录注册 ]

面经笔经

一个网友贴出来的趋势科技的笔试题(感谢这个网友)

2016/05/13 09:48 [db:作者] 返回上一页

比试时间是2个小时 前面的智力题和后面的网络题都没记住 只记住了几道而已 大家做做看吧
题目1:(这题我没看懂英文)
There is binary search tree which is used to store characters ‘A’, ‘B’,
‘C’,'D’,'E’,'F’,'G’,'H’,which of the following is post-order tree walk
result? (有一个二叉搜索树用来存储字符’A', ‘B’, ‘C’,'D’,'E’,'F’,'G’,'H’下
面哪个(些)结果是后序树遍历结果)
A. ADBCEGFH
B. BCAGEHFD
C. BCAEFDHG
D. BDACEFHG
E. All of above

题目2:
At time 0, process A has arrived in the system, in that order; at time
30, both progress B and C have just arrived; at time 90, both progress D
and E have also arrived.The quantum or timeslice is 10 units.
(在0时刻,进程A进入系统,按照这个顺序,在30时刻,进程B和进程C也抵达;在90时刻,进程D和进程E也抵达。一个时间片是10个单元)
Process A requires 50 units of time in the CPU;
Process B requires 40 units of time in the CPU;
Process C requires 30 units of time in the CPU;
Process D requires 20 units of time in the CPU;
Process E requires 10 units of time in the CPU;
进程A需要占用CPU50个单元;
进程B需要占用CPU40个单元;
进程C需要占用CPU30个单元;
进程D需要占用CPU20个单元;
进程E需要占用CPU10个单元;
Which of the process will be the LAST to complete, if scheduling policy
is preemptive SJF (Short Job First).please describe the principle.
(如果按照短作业优先级的方法,哪个进程最后结束。请描述原理)

题目3: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
(club函数用来模拟一个俱乐部的顾客。初始化情况下是0个顾客,俱乐部最大规模只能有50个顾客,当用户超过了最大规模,他们必须等在外面。当一些顾客离开了等待队列将减少。这个club函数将打印在俱乐部里面的顾客人数,和外面的等待人数。函数声明如下:
void club(int x);正数x代表客人来了,负数x代表客人离开了俱乐部)
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.
(举例而言,club (40)打印40,0;接着club (20)打印50,10;接着club (-5)打印50,5;接着club (-30)打印25,0;接着club (-30)打印N/A;因为这是不可能实现的。)
Please write the void club(int x) with c++;
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.
(请用c++编程实现club函数。为了确保函数工作正常,我们使用下列数据来测试函数是否正常,你认为该选哪个选项)

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

题目4:The following C++ code tries to count occurence of each ASCII charcater
in given string and finally print out the occurrency numbers:(下面C++代码用来统计每个ASCII字符的出现次数,最后给出出现数值)
void histogram(char* src)
{
int i;
char hist[256];
for (i=0;i <256;i++)
{
hist[i]=0;
}
while(*src!=’\0′)
{
hist[*src]++;
}
for(i=0;i <=256;i++)
{
printf(“%d\n”, hist[i]);
}
}
If there may be some issue in the code above, which line(s) would be
(如果上面代码有错,将在哪行出现)
A 1 and 3
B 3 and 7
C 9
D 5 and 7
E 4 and 8

题目5:(说实话这道题我没看懂)
Consider the grammar (如下语法)
S–> aSbS|bSaS|V (S是变量)
where V means a terminator for grammar.(V是一个语法的终止符)
which statement(s) below is(are) corrects?(下列哪种说法是正确的)
1 This grammar is not an ambiguous grammar (这个语法不是一个含糊的语法)
2 Sentence ‘abba’ can be constructed by only one parse tree(语句abba能被构造成一个分析树)
3 This grammar construct sentence contain any ‘a’ (1 and more) and any ‘b’ (1 and more)(这个语法构造句包含一个或多个a和1个或多个b)
4 The grammar equals to regular expression “(a|b)?(a|b)+”(这个语法等于正则表达式(a|b)?(a|b)+)
A 1? B 2 3? C 3? D 1 3? E 2 4

题目6:
struct data
{
unsigned char x;
unsigned short y;
unsigned int z;
}
已知变量var类型为struct data;程序在32位上编,不考虑对齐,请补齐下面汇编语
言,以完成相应C语言功能
var.x=0;
LEA EBX, var
XOR EAX, ______
MOV [EBX], ______
var.y = (unsigned short) (var.z+1)
MOV ECX, ______
INC ECX
MOV ______, ______
var.z = var.y-1;
MOV DX, ______
AND EDX, ______
DEC, EDX
MOV ______, EDX

题目7:下列程序中能编译通过么?如果不能该如何修改使其通过。
是定义#define VOID_P 1 还是 #defineVOID_P 0,mem才能得到正确地址。
#include? <iostream>
#define VOID_P 0
#if VOID_P
void allocm(void *pout, unsigned long size)
{
pout = malloc(size);
}
#else
void allocm(void **pout, unsigned long size)
{
*pout = malloc(size);
}
#elseif

int main(int argc, char *argv[]){
void *mem = 0;
#if VOID_P
allocm(mem, 100);
#else
allocm(&mem, 100);
#endif
return 0;

}

题目8:请编C++实现:函数可变长有序数组的插入(无重复数据节点)
int *head = NULL;
int Insert = (int **pHead, int n);

//参数:*pHead 数组首地址 n 插入数值
//返回值: 0成功, 1失败

查看原帖


文章来源:http://www.bozhiyue.com/mianshiti/mianjingbijing/2016/0513/96201.html
评论
发表评论