姓名: 联系电话: 电子邮件:
学历: 专业: 毕业时间:
中山大学软件工程师试题C
(满分100分,作答时间为120分钟)
单项选择题(每题2分,共40分)
1、给出如下代码:
class Test{
private int m;
public static void fun() {
// some code...
}
}
如何使成员变量m 被函数fun()直接访问? [ C ]
A、将private int m 改为protected int m
B、将private int m 改为 public int m
C、将private int m 改为 static int m
D、将private int m 改为 int m
2、Java中main()函数的返回值是什么? [ D ]
A、 String
B、int
C、char
D、void
3、已知如下代码:
1: class Example{
2: String str;
3: public Example(){
4: str= "example";
5: }
6: public Example(String s){
7: str=s;
8: }
9:}
10: class Demo extends Example{
11: }
12: public class Test{
13: public void f () {
14: Example ex = new Example("Good");
15: Demo d = new Demo("Good");
16: } }
哪句语句会导致错误? [ E ]
A、 line 3
B、line 6
C
、line 10
D、line 14
E、line 15
4、哪些是将一个十六进制值赋值给一个long型变量? [ D ]
A. long number = 345L;
B. long number = 0345;
C. long number = 0345L;
D. long number = 0x345L
5、下面的哪些叙述为真? [ D ]
A. equals()方法判定引用值是否指向同一对象。
B. == 操作符判定两个分立的对象的内容和类型是否一致。
C. equals()方法只有在两个对象的内容一致时返回true。
D. 类File重写方法equals()在两个分立的对象的内容和类型一致时返回true。
6、给出下面的代码片断:
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} (10);
11} }
12} }
第十行的声明将调用哪些方法? [ D ]
A. 第2行的方法
B. 第3行的方法
C. 第6行的方法
D. 第7行的方法
7、下面的哪些关键字通常用来对某段代码加锁,该标记使得对代码的访问是排他的? [ B ]
A. transient
B. synchronized
C. serialize
D. static
8、给出下面的代码: [ D ]
if (x>0) { ("first"); }
else if (x>-3) { ("second"); }
else { ("third"); }
x的取值在什么范围内时将打印字符串"second"?
A. x > 0
B. x > -3
C. x <= -3
D. x <= 0 & x > -3
9、关于垃圾收集的哪些叙述是对的? [ B ]
A. 程序开发者必须自己创建一个线程进行内存释放的工作。
B. 垃圾收集将检查并释放不再使用的内存。
C. 垃圾收集允许程序开发者明确指定并立即释放该内存。
D. 垃圾收集能够
中山大学ava软件工程师试题C 来自淘豆网www.taodocs.com转载请标明出处.