单选题:
1 Class Teacher and Student are subclass of class Person
Person p
Teacher t
Student s
p t and s are all nonnull
if(t instanceof Person) { s (Student)t }
What is the result of this sentence
A It will construct a Student object
B The expression is legal
C It is illegal at compilation
D It is legal at compilation but possible illegal at runtime
2 Given the following code
public class Person{
int arr[] new int[10]
public static void main(String a[]) {
Systemoutprintln(arr[1])
}
}
Which statement is correct
A When compilation some error will occur
B It is correct when compilation but will cause error when running
C The output is zero
D The output is null
3 Given the following code fragment
1) String str null
2) if ((str null) && (strlength() > 10)) {
3) Systemoutprintln(more than 10)
4) }
5) else if ((str null) & (strlength() < 5)) {
6) Systemoutprintln(less than 5)
7) }
8) else { Systemoutprintln(end) }
Which line will cause error
A line 1
B line 2
C line 5
D line 8
4 Given the following code
public class Test {
void printValue(int m){
do { Systemoutprintln(The value is+m)
}
while( m > 10 )
}
public static void main(String arg[]) {
int i10
Test t new Test()
tprintValue(i)
}
}
Which will be output
A The value is 8
B The value is 9
C The value is 10
D The value is 11
5 Which statements about the garbage collection are true
A The program developer must create a thread to be responsible for free the memory
B The garbage collection will check for and free memory no longer needed
C The garbage collection allow the program developer to explicity and immediately free the memory
D The garbage collection can free the memory used java object at expect time
6 Which statement of assigning a long type variable to a hexadecimal value is correct
A long number 345L
B long number 0345
C long number 0345L
D long number 0x345L
7 Which of the following answer is correct to express the value 8 in octal number
A 010
B 0x10
C 08
D 0x8
8 1) class Person {
2) public void printValue(int i int j) {*…* }
3) public void printValue(int i){** }
4) }
5) public class Teacher extends Person {
6) public void printValue() {** }
7) public void printValue(int i) {**}
8) public static void main(String args[]){
9) Person t new Teacher()
10) tprintValue(10)
11) }
12) }
Which method will the statement on line 10 call
A on line 2
B on line 3
C on line 6
D on line 7
9 Which keyword should be used to enable interaction with the lock of an object The flag allows exclusive access to that object
A transient
B synchronized
C serialize
D static
10 Which is the return type of the method main()
A int
B void
C boolean
D static
11 Given the following code
if (x>0) { Systemoutprintln(first) }
else if (x>3) { Systemoutprintln(second) }
else { Systemoutprintln(third) }
Which range of x value would print the string second
A x > 0
B x > 3
C x < 3
D x < 0 & x > 3
12 A member variable defined in a class can be accessed only by the classes in the same package Which modifier should be used to obtain the access control
A private
B no modifier
C public
D protected
13 A class design requires that a member variable cannot be accessible directly outside the class Which modifier should be used to obtain the access control
A public
B no modifier
C protected
D private
14 Given the following code
class Person {
String namedepartment
public void printValue(){
Systemoutprintln(name is +name)
Systemoutprintln(department is +department)
}
}
public class Teacher extends Person {
int salary
public void printValue(){
doing the same as in the parent method printValue()
including print the value of name and department
Systemoutprintln(salary is +salary)
}
}
Which expression can be added at the doing the same as part of the method printValue()
A printValue()
B thisprintValue()
C personprintValue()
D superprintValue()
二选
1 Given the following expression about List
List l new List(6true)
Which statements are ture
A The visible rows of the list is 6 unless otherwise constrained
B The maximum number of characters in a line will be 6
C The list allows users to make multiple selections
D The list can be selected only one item
2 public class Parent {
public int addValue( int a int b) {
int s
s a+b
return s
}
}
class Child extends Parent {
}
Which methods can be added into class Child
A int addValue( int a int b ){ do something}
B public void addValue (){ do something}
C public int addValue( int a ){ do something}
D public int addValue( int a int b )throws MyException {do something}
3 Which of the following statements about variables and scope are true
A Local variables defined inside a method are destroyed when the method is exited
B Local variables are also called automatic variables
C Variables defined outside a method are created when the object is constructed
D A method parameter variable continues to exist for as long as the object is needed in which the method is defined
4 Which of the following statements about declaration are true
A Declaration of primitive types such as boolean byte and so on does not allocate memory space for the variable
B Declaration of primitive types such as boolean byte and so on allocates memory space for the variable
C Declaration of nonprimitive types such as String Vector and so on does not allocate memory space for the object
D Declaration of nonprimitive types such as String Vector ans so on allocates memory space for the object
5 Given the following code fragment
1) public void create() {
2) Vector myVect
3) myVect new Vector()
4) }
Which of the following statements are true
A The declaration on line 2 does not allocate memory space for the variable myVect
B The declaration on line 2 allocates memory space for a reference to a Vector object
C The statement on line 2 creates an object of class Vector
D The statement on line 3 creates an object of class Vector
E The statement on line 3 allocates memory space for an object of class Vector
6 Which declarations of identifiers are legal
A persons
B TwoUsers
C *point
D this
E _endline
7 Which of the following fragments might cause errors
A String s Gone with the wind
String t good
String k s + t
B String s Gone with the wind
String t
t s[3] + one
C String s Gone with the wind
String standard stoUpperCase()
D String s home directory
String t s directory
8 Which are syntactically valid statement at point x
class Person {
private int a
public int change(int m){ return m }
}
public class Teacher extends Person {
public int b
public static void main(String arg[]){
Person p new Person()
Teacher t new Teacher()
int i
point x
}
}
A i m
B i b
C i pa
D i pchange(30)
E i tb
9 Which are not Java keywords
A TRUE
B sizeof
C const
D super
E void
10 Which statements about inheritance are true
A In Java programming language only allows single inheritance
B In Java programming language allows a class to implement only one interface
C In Java programming language a class cannot extend a class and implement a interface together
D In Java programming language single inheritance makes code more reliable
11 Which are not Java primitive types
A short
B Boolean
C unit
D float
12 Use the operators << >> which statements are true
A 0000 0100 0000 0000 0000 0000 0000 0000<<5 gives
1000 0000 0000 0000 0000 0000 0000 0000
B 0000 0100 0000 0000 0000 0000 0000 0000<<5 gives
1111 1100 0000 0000 0000 0000 0000 0000
C 1100 0000 0000 0000 0000 0000 0000 0000>>5 gives
1111 1110 0000 0000 0000 0000 0000 0000
D 1100 0000 0000 0000 0000 0000 0000 0000>>5 gives
0000 0110 0000 0000 0000 0000 0000 0000
13 The variable result is boolean Which expressions are legal
A result true
B if ( result ) { do something }
C if ( result 0 ) { so something }
D result 1
14 Which of the following statements are legal
A long l 4990
B int i 4L
C float f 11
D double d 344
E double t 09F
15 public void test() {
try { oneMethod()
Systemoutprintln(condition 1)
} catch (ArrayIndexOutOfBoundsException e) {
Systemoutprintln(condition 2)
} catch(Exception e) {
Systemoutprintln(condition 3)
} finally {
Systemoutprintln(finally)
}
}
Which will display if oneMethod run normally
A condition 1
B condition 2
C condition 3
D finally
16 String s hello
String t hello
char c[] {'h''e''l''l''o'}
Which return true
A sequals(t)
B tequals(c)
C st
D tequals(new String(hello))
E tc
三叙述题题5分总分20分
1 Struts否Java种构造类型?请描述Java中作
2 MVC英文全称什?请描述MVCjava开发带处
3描述TomcatJBoss区
4谈谈final finally finalize区
5Anonymous Inner Class (匿名部类) 否extends(继承)类否implements(实现)interface(接口)
6Static Nested Class Inner Class
7Collection Collections区
8什时候assert
9String s new String(xyz)创建String Object
10Mathround(115)等於少 Mathround(115)等於少
11short s1 1 s1 s1 + 1什错 short s1 1 s1 + 1什错
12sleep() wait() 什区
13OverloadOverride区Overloaded方法否改变返回值类型
14errorexception什区
15List Set Map否继承Collection接口
16abstract classinterface什区
17abstractmethod否时static否时native否时synchronized
18接口否继承接口 抽象类否实现(implements)接口 抽象类否继承实体类(concrete class)
19线程进入象synchronized方法线程否进入象方法
20象作参数传递方法方法改变象属性返回变化结果里底值传递引传递
四
1 团队合作精神理解?
2 做什项目?
3 认开发软件专业知识需什?
4 发展计划
5请展软件技术未发展
文档香网(httpswwwxiangdangnet)户传
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档