您好,登錄后才能下訂單哦!
【IGT】 Paper Test For Campus Recruiting
注:分享出來,僅做個人知識點的查漏補缺以及鞭策自己更加努力地學習!(粗體紅字為鄙人做的答案,可能會有錯誤,還望能有人指出。)
Part 1:
1、which of these is a legal definition of a method named m assuming it throws IOExecption,and returns void .Also assume that the method does not take any arguments.Select the one correct answer.
A void m() throws IOExecption{}
B void m() throw IOExecption{}
C void m(void) throw IOExecption{}
D void m(){}throws IOExecption{}
2、which of the following is legal identifier name in java.
A %abcd
B 1abcd(第一個為數字1)
C package
D _a_long_name
(知識點說明:Java語言規定標識符是以字母、下劃線"_"或美元符號"$"開始,隨后可跟數字、字母、下劃線或美元符號的字符序列,當然不能用關鍵字作為標識符。)
3、what will happen when you attempt to compile and run the following code?
package igt;
public class igt {
public static void main(String[] args){
int i;
switch(i){
case 0:System.out.println(0);
case 1:System.out.println(1);break;
case 2:System.out.println(2);
case 3:System.out.println(3);break;
}
}
}
A 0
B 01
C 0123
D compile error
(知識點說明:關于java變量是否自動初始化問題--成員變量會被初始化,局部變量不會初始化。局部變量如果定義時沒有進行初始化,系統不會自動為其進行初始化,因而編譯時會出錯。如下圖所示:
4、what will be the output of the program?
public class test_4 {
static class A{
public int x = 10;
public int y = 20;
int f(){
return y;
}
}
static class B extends A{
public int x = 1;
public int y = 30;
int f(){
return y;
}
}
public static void main(String[] args){
A a = new B();
System.out.print(a.x+",");
System.out.println(a.f());
}
}
A 10,20
B 10,30
C 1,20
D 1,30
(實驗得出結果是B,不解中....)
5、what will be the output of the program?
public class test_5 extends Base{
static{
System.out.print("6");
}{
System.out.print("5");
}
public test_5(){
System.out.print("4");
}
public static void main(String[] args){
new test_5();
}
}
class Base{
static{
System.out.print("3");
}{
System.out.print("2");
}
public Base(){
System.out.print("1");
}
}
A 326514
B 361425
C 362154
D 362514
(實驗得出結果是C,不解中....)
Part 2:
6、please decribe the scenarios of using String StringBuffer StringBuilder,and what is the difference between StringBuffer and StringBuilder?
7、please explain the difference between checked exception and runtime exception and the usage of these two kinds of exception.
8、please give an example of self-defined class that could be sorted in Collections.sort() method
9、please list at least three design patterns and its usage in your daily development.
Part 3:
10、please implement a function to find the longest common sub-string of two given string.
for example:
string a: abcdefg12345
string b:cdef234
longest common sub-string:cdef
(字符串匹配問題常考查,需研究透徹!)
--------------------------未解問題,待續。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。