JAVA认证格林模拟试题二(下)
来源:优易学  2009-11-28 15:05:50   【优易学:中国教育考试门户网】   资料下载   IT书店
文章页内部300*250广告位

 

question 41)

given the following code

class base{}
public class mycast extends base{
static boolean b1=false;
static int i = -1;
static double d = 10.1;
public static void main(string argv[]){
mycast m = new mycast();
base b = new base();
//here
}
}


which of the following, if inserted at the comment //here will allow the code to compile and run without error

1) b=m;
2) m=b;
3) d =i;
4) b1 =i;


question 42)

which of the following statements about threading are true

1) you can only obtain a mutually exclusive lock on methods in a class that extends thread or implements runnable
2) you can obtain a mutually exclusive lock on any object
3) a thread can obtain a mutually exclusive lock on an object by calling a synchronized method on that object.
4) thread scheduling algorithms are platform dependent


question 43)

your chief software designer has shown you a sketch of the new computer parts system she is about to create. at the top of the hierarchy is a class called computer and under this are two child classes. one is called linuxpc and one is called windowspc.

the main difference between the two is that one runs the linux operating system and the other runs the windows system (of course another difference is that one needs constant re-booting and the other runs reliably). under the windowspc are two sub classes one called server and one called workstation. how might you appraise your designers work?


1) give the goahead for further design using the current scheme
2) ask for a re-design of the hierarchy with changing the operating system to a field rather than class type
3) ask for the option of windowspc to be removed as it will soon be obsolete
4) change the hierarchy to remove the need for the superfluous computer class.

question 44)
which of the following statements are true
1) an inner class may be defined as static
2) there are no circumstances where an inner class may be defined as private
3) a programmer may only provide one constructor for an anonymous class
4) an inner class may extend another class

question 45)
what will happen when you attempt to compile and run the following code
int output=10;boolean b1 = false;if((b1==true) && ((output+=10)==20)){    system.out.println("we are equal "+output);    }else    {    system.out.println("not equal! "+output);}
1) compile error, attempting to peform binary comparison on logical data type
2) compilation and output of "we are equal 10"
3) compilation and output of "not equal! 20"
4) compilation and output of "not equal! 10"

question 46)
given the following variables which of the following lines will compile without error?
string s = "hello";long l = 99;double d = 1.11;int i = 1;int j = 0;1) j= i <2) j= i<3) j=i<4)j=i<

question 47)
what will be output by the following line of code?
system.out.println(010|4);
1) 14
2) 0
3) 6
4) 12

question 48)
given the following variables
char c = 'c';int i = 10;double d = 10;long l = 1;string s = "hello";
which of the following will compile without error?
1)c=c+i;
2)s+=i;
3)i+=s;
4)c+=s;

question 49)
which of the following will compile without error?
1) file f = new file("/","autoexec.bat");
2) datainputstream d = new datainputstream(system.in);
3) outputstreamwriter o = new outputstreamwriter(system.out);
4) randomaccessfile r = new randomaccessfile("outfile");

question 50)
given the folowing classes which of the following will compile without error?
interface iface{}class cface implements iface{}class base{}public class obref extends base{    public static void main(string argv[]){        obref ob = new obref();        base b = new base();        object o1 = new object();        iface o2 = new cface();    }}
1)o1=o2;
2)b=ob;
3)ob=b;
4)o1=b;

上一页  [1] [2] [3] 下一页

责任编辑:小草

收藏此页】【 】【打印】【回到顶部
计算机文章页底部500*200广告
文章搜索:
 相关文章
计算机底部580*90广告
文章页右侧第一330*280广告
计算机文章页资讯推荐
热点资讯
文章页330尺寸谷歌广告位
热门课程培训