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

 

question 11)

you want to loop through an array and stop when you come to the last element. being a good java programmer and forgetting everything you ever knew about c/c++ you know that arrays contain information about their size. which of the following can you use?

1)myarray.length();
2)myarray.length;
3)myarray.size
4)myarray.size();


question 12)

what best describes the appearance of an application with the following code?

import java.awt.*;
public class flowap extends frame{
public static void main(string argv[]){
    flowap fa=new flowap();
    fa.setsize(400,300);
    fa.setvisible(true);

}

flowap(){
        add(new button("one"));
        add(new button("two"));
        add(new button("three"));
        add(new button("four"));
    }//end of constructor



}//end of application

1) a frame with buttons marked one to four placed on each edge.
2) a frame with buutons marked one to four running from the top to bottom
3) a frame with one large button marked four in the centre
4) an error at run time indicating you have not set a layoutmanager

question 13)

how do you indicate where a component will be positioned using flowlayout?

1) north, south,east,west
2) assign a row/column grid reference
3) pass a x/y percentage parameter to the add method
4) do nothing, the flowlayout will position the component



question 14)

how do you change the current layout manager for a container

1) use the setlayout method
2) once created you cannot change the current layout manager of a component
3) use the setlayoutmanager method
4) use the updatelayout method


question 15)

which of the following are fields of the gridbagconstraints class?

1) ipadx
2) fill
3) insets
4) width

question 16)

what most closely matches the appearance when this code runs?

import java.awt.*;
public class complay extends frame{
public static void main(string argv[]){
complay cl = new complay();
}

complay(){
panel p = new panel();
p.setbackground(color.pink);
p.add(new button("one"));
p.add(new button("two"));
p.add(new button("three"));
add("south",p);
setlayout(new flowlayout());
setsize(300,300);
setvisible(true);
}
}

1) the buttons will run from left to right along the bottom of the frame
2) the buttons will run from left to right along the top of the frame
3) the buttons will not be displayed
4) only button three will show occupying all of the frame

question 17)

which statements are correct about the anchor field?

1) it is a field of the gridbaglayout manager for controlling component placement
2) it is a field of the gridbagconstraints class for controlling component placement
3) a valid setting for the anchor field is gridbagconstraints.north
4) the anchor field controls the height of components added to a container


question 18)

what will happen when you attempt to compile and run the following code?

public class bground extends thread{
public static void main(string argv[]){
bground b = new bground();
b.run();
}
public void start(){
for (int i = 0; i <10; i++){
system.out.println("value of i = " + i);
}
}
}

1) a compile time error indicating that no run method is defined for the thread class
2) a run time error indicating that no run method is defined for the thread class
3) clean compile and at run time the values 0 to 9 are printed out
4) clean compile but no output at runtime


question 19)

is the following statement true or false?
when using the gridbaglayout manager, each new component requires a new instance of the gridbagconstraints class.

1) true
2) false

question 20)

which most closely matches a description of a java map?

1) a vector of arrays for a 2d geographic representation
2) a class for containing unique array elements
3) a class for containing unique vector elements
4) an interface that ensures that implementing classes cannot contain duplicate keys


 

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

责任编辑:小草

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