当前位置:文档之家› 软件工程师笔试试题(Java)库及答案

软件工程师笔试试题(Java)库及答案

Ctest ok and abc
Dtest ok and gbc
5.要从文件" file.dat"文件中读出第10个字节到变量C中,下列哪个方法适合?
AFileInputStream in=new FileInputStream("file.dat");
in.skip(9); int c=in.read();
Cserialize
Dstatic
9.下列哪些语句关于内存回收的说明是正确的?
A程序员必须创建一个线程来释放内存;
B内存回收程序负责释放无用内存
C内存回收程序允许程序员直接释放内存
D内存回收程序可以在指定的时间释放内存对象
10.下列代码哪几行会出错:
1) public void modify() {
Cline 7
Dline 8
三、简答题(40分)
1.请对Structs的架构进行描述。
2.Servlet有性能安全问题吗?如何使用?
3.为什么会使用同步控制?其优缺点是什么?
4.Hibernate的组建方式?如何配置?映射是如何实现的?有几种对应关系?
5.应用开发有哪些种模式?至少写出5种。并请介绍singleon模式的工作方式。
set.add(new A());
set.add(new A());
System.out.println(set.size());
}
}
5.下列程序的运行结果是
class A{
class Dog{
private String name;
private int age;
public int step;
Dog(String s,int a) {
public class Example{
String str=new String("good");
char[]ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example();
ex.change(ex.str,ex.ch);
软件工程师笔试试题(JAVA)
一、填空题(10分)
1.执行下列代码后的结果是什么? int x,a=2,b=3,c=4; x=++a+b+++c++;
2.包包含了Collection的接口和类的API
3.main方法的声明格式包括
4.下列程序中构造了一个SET并且调用其方法add(),输出结果是
public class A{
DList myList=new List();
2.paint()方法使用哪种类型的参数?
AGraphics
BGraphics2D
CString
DColor
3.指出正确的表达式
Abyte=128;
BBoolean=null;
Clong l=0xfffL;
Ddouble=0.9239d;
4.指出下列程序运行的结果
System.out.print(ex.str+" and ");
Sytem.out.print(ex.ch);
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
}
Agood and abc
Bgood and gbc
name=s;
age=a;
step=0;
}
public void run(Dog fast) {
fast.step++;
}
}
public static void main (String args[]){
A a=new A();
Dog d=a.new Dog("Tom",3);
d.step=25;
d.run(d);
BFileInputStream in=new FileInputStream("file.dat");
in.skip(10); int c=in.read();
CFileInputStream in=new FileInputStream("file.dat");
int c=in.read();
DRandomAccessFile in=new RandomAccessFile("file.dat");
System.out.println(d.step);
}
}
二、选择题 (20分)
1.欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?
AArrayList myList=new Object();
BList myList=new ArrayList();
CArrayList myList=new List();
6.HashMap与Hashtable的区别。
7.EJB的几种类型?
8.在你实施过的项目中哪些是成功的?你认为成功的要素是什么?
public static void main(String a[])
{
System.out.println(arr[1]);
}
}
那个语句是正确的?
A编译时将产生错误;
B编译时正确,运行时将产生错误;
C输出零;
D输出空。
8.哪个关键字可以对对象加互斥锁?
Atransient
Bsynchronized
public int hashCode(){return 1;}
public Boolean equals(Object b){return true}
public static void main(String args[]){
Set set=new HashSet();
set.add(new A());
2) int I, j, k;
3) I = 100;
4) while ( I > 0 ) {
5) j = I * 2;
6) System.out.println (" The value of j is " + j );
7) k = k + 1;
8) I--;
9) }
10) }
Aline 4
Bline 6
in.skip(9); int c=in.readByte();
6.容器被重新设置大小后,哪种布局管理器的容器中的组件大小不随容器大小的变化而改变?
ACardLayout
BFlowLayout
CBorderLayout
DGridLayout
7.给出下面代码:
public class Person{
static int arr[] = new int[ቤተ መጻሕፍቲ ባይዱ0];
相关主题