展讯笔试
9.19在天南楼,宣讲会+笔试,总共招几十个人,去参加笔试的人几乎有七八百的样子,再次感受到找工作的艰难。题目不多,涉及到的知识面也比较窄,但仍有好多不确定的。
1. 编程题
找出两个字符串中的最大公共子串,如“abcdef”和“abgdef”,则输出为cdef
public class LongS { public static void main(String[] args){ LongS ls = new LongS(); String a = "abcdef"; String b = "abbcdef"; String r = ls.getS(a, b); System.out.println(r); } public String getS(String a, String b){ char[] s1 = a.toCharArray(); char[] s2 = b.toCharArray(); int len1 = s1.length; int len2 = s2.length; int max = 0; int pos = 0; int count = 0; for(int i = 0; i < len1; i ++){ count = 0; int temp = i; int flag = 0; for(int j = 0; j < len2 && temp < len1; j ++){ if(s1[temp] == s2[j]){ temp ++; count ++; flag = 1; }else{ if(flag == 1) break; } } if(max < count){ max = count; pos = i; } } return a.substring(pos, pos + max); } }
2. 考察equals()和 == 的区别
equals比较引用是否相等,==比较值是否相等。
3. 有500个排好序的元素,用折半查找法进行查找时,最大比较次数为(7, 6, 8, 9)
4. 考察宏,String多少个对象,equals(), ==区别,关键字volatile
5. const关键字含义
(1)char *const p;
(2)char const *p;
(3)const char *p;
(4)const char *p const;
6. 有一种体育竞赛共含M个项目,有运动员A, B, C参加,在每一项目中,第一,第二,第三名分别得X, Y, Z分,其中X, Y, Z为正整数且X > Y > z。最后A得22分,B与C均得9分,B在百米赛中取得第一。求M的值,并问在跳高比赛中谁得第二名。
笔试完后第二天中午收到面试通知,奇怪的是同屋的几个人做的几乎一模一样,结果只有两个人收到面试通知,不知为啥。。9.21开始面试,等了一个多小时,地点竟然是在19楼,各种乱,很不正式,等待的过程中,很想直接走人。终于轮到我,面了15分钟左右,就被鄙视,还劝我转行。。。蛋疼。
问的题很基础,自我介绍,介绍项目,数据库什么是事务,什么是触发器,当执行写数据到一半时,服务器突然荡掉,若重启,事务是否回滚。数据结构怎么样?写个单链表逆转。