2014 IGT Software Test Development engineer written examination (java-B1 version)
[IGT] Paper Test For Campus Recruiting
Note: share out, only do personal knowledge points to fill gaps and urge yourself to study harder! The answer given by the bold scarlet letter may be wrong, and I hope someone will point it out.)
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 (the first is the number 1)
C package
D _ a_long_name
(knowledge point description: the Java language stipulates that identifiers begin with letters, underscores "_" or the dollar sign "$", followed by a sequence of numbers, letters, underscores or dollar signs, of course, not with keywords. )
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
(knowledge note: on the question of whether java variables are initialized automatically-member variables are initialized, local variables are not initialized. If a local variable is not initialized when it is defined, the system will not initialize it automatically, so there will be errors at compile time. As shown in the following figure:
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) {
An 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
The result of the experiment is B, which is puzzling.
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
The result of the experiment is C, which is puzzling.
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
String matching problems are often examined and need to be studied thoroughly! )
Unsolved problem, to be continued.