Intern interview prepare

c++ STL standard template library
其实STL就是一个模板,一个程序员写好一个类,以后可以复用,不用再写。

Careercup 很好的查题目的网站


总结一下去Broadcom 和 Moto面试的题
这次面试比较失败
Broadcom 两个多小时的面试题,有些记不清了,应该当时写的。

记得最清楚的就是阿三哥问我的那道题:
1. which language do you prefer, describe the difference between and C++ and Java
我的回答是Java is more Objective oriented, it does not have pointer, it's platform independent, it's easy to use and has friendly IDE (对方笑了,明显不是重点)
说完后,他说这些都不是重点, 我疑惑。 重点应该是: garbage allocation, C++ 没有这个机制,需要手动收回memory(这个问题很重要,manager 问了类似的问题)

2. Fred 问我的问题: 解释一下Semaphore, (一开始没懂) 写一个程序 用semaphore 实现,有的threads want to write to that buffer other threads want to read from that buffer (OS 写过啊,可是当时想不起来了)
During the R/W, there may be context switch, so there may be RAW hazard.

3. a string which contains characters such as "aafjkczddfcccbbdae", think of a way to find the character which appears most of the time, which has the highest frequency.(没想出来)

4. change that string to ordered string such as "aaabbbbccccc" the question is the same as above.

5. Java 是pass by reference or pass by value? pass by reference except for some primitive type such as: int, float

6. Give you a and a , try to find the copy of that file, 一开始傻了,以为文件名一样,后来想不可能,应该只是里面数据一样. 决定compare line by line,对方说可以但是对答案不满意,
the complexity is too high, hint: hash map。 恍然大悟, 直接做hash map 就好了 complexity O(n), 但是我想到如果有conflict 怎么办?上课学过啊,用open addressing or double hashing。对方说不好。 我想如果hash value 都一样了,只好compare line by line,最终也明白正确答案

7.设计一个function 可以判断whether the integer value is the square of another integer value. Hint: 二分法 O(log2(n))

8 翻转bit 111110000 变成 000011111

9. LAN , CSMA 怎样解决 collision, 怎样判断is a collision. 解决可以用generate random time to send message

10. stack heap 区别,主要意思是函数中的value 存在哪里

11.int fn(void){
struct abc x;
x=malloc (struct abc);// 这两句有问题, 找错误,在malloc 上面
read abc f1
read abc fn
if (abc.age>120){
return -1; //有问题,不知道
}
else
save abc(file)


}

评论

此博客中的热门博文

Embedded System interview Question

MicroKernel & Exokernel 操作系统未来可能的发展

中国城市房地产分析