• 网络学院
  • 新手学堂
  • 操作系统
  • 网络技术
  • 软件应用
  • 办公软件
  • 编程技术
  • 网站架设
  • 数据库类
  • 平面设计
  • 多媒体类
  • 游戏资讯
  • 教学论文
  • 认证考试
Java认证模拟题及分析(3)
广告位
  站点:
  • 首 页
  • 最新软件
  • 最新文章
  • 国内软件
  • 国外软件
  • 汉化软件
  • 源码下载
  • 字体下载
Java认证模拟题及分析(3)
软件发布 Java认证模拟题及分析(3)
网络软件 系统工具 应用软件 联络聊天 图形图像 多媒体类 行业软件 游戏娱乐 编程开发 安全相关 教育教学 数码软件
热门软件: QQ 瑞星 pplive e话通 木马克星 千千静听 office2000 五笔字根 Photoshop 视频分割
返回首页 | 文章首页 | 认证考试 | JAVA认证 | JAVA题库 | Java认证模拟题及分析(3)

Java认证模拟题及分析(3)

 

添加时间: 2007-9-23 1:47:05  作者: JAVA题库  阅读次数:224   来源: http://www.d9soft.com

 

 

       

Question 29) 
What is the result of the following operation? 
System.out.println(4 3); 
1) 6 
2) 0 
3) 1 
4) 7 
Answer to Question 29 
-------------------------------------------------------------------------------- 
Question 30) 
public class MyClass1 { 
public static void main(String argv[]){ } 
/*Modifier at XX */ class MyInner {} 
} 
What modifiers would be legal at XX in the above code? 
1) public 
2) private 
3) static 
4) friend 
Answer to Question 30 
-------------------------------------------------------------------------------- 
Question 31) 
What will happen when you attempt to compile and run the following code? 
public class Holt extends Thread{ 
private String sThreadName; 
public static void main(String argv[]){ 
Holt h = new Holt(); 
h.go(); 
} 
Holt(){} 
Holt(String s){ 
sThreadName = s; 
} 
public String getThreadName(){ 
return sThreadName; 
} 
public void go(){ 
Holt first = new Holt("first"); 
first.start(); 
Holt second = new Holt("second"); 
second.start(); 
} 
public void start(){ 
for(int i = 0; i < 2; i ++){ 
System.out.println(getThreadName() +i); 
try{ 
Thread.sleep(100); 
} catch(InterruptedException e){System.out.println(e.getMessage());} 
} 
} 
} 
 

1) Compile time error 
2) Output of first0, second0, first0, second1 
3) Output of first0, first1, second0, second1 
4) Runtime error 
Answer to Question 31 

-------------------------------------------------------------------------------- 
Question 32) 
An Applet has its Layout Manager set to the default of FlowLayout. What code would be correct to change to another Layout Manager. 
1) setLayoutManager(new GridLayout()); 
2) setLayout(new GridLayout(2,2)); 
3) setGridLayout(2,2); 
4) setBorderLayout(); 
Answer to Question 32 
-------------------------------------------------------------------------------- 
Question 33) 
What will happen when you attempt to compile and run the following code?. 
class Background implements Runnable{ 
int i=0; 
public int run(){ 
while(true){

 
i++;
System.out.println("i="+i);
} //End while
return 1;
}//End run

}//End class


1) It will compile and the run method will print out the increasing value of i.
2) It will compile and calling start will print out the increasing value of i.
3) The code will cause an error at compile time.
4) Compilation will cause an error because while cannot take a parameter of true.


Answer to Question 33
--------------------------------------------------------------------------------

Question 34)

Which of the following statements about this code are true?

public class Morecombe{
public static void main(String argv[]){
Morecombe m = new Morecombe();
m.go(new Turing(){});
}
public void go(Turing t){
t.start();
}

}
class Turing extends Thread{
public void run(){
for(int i =0; i < 2; i++){
System.out.println(i);
}
}

}


1) Compilation error due to malformed parameter to go method
2) Compilation error, class Turing has no start method
3) Compilation and output of 0 followed by 1
4) Compilation but runtime error

Answer to Question 34
--------------------------------------------------------------------------------

Question 35)

What will be the result when you attempt to compile and run the following code?.

public class Conv{
public static void main(String argv[]){
Conv c=new Conv();
String s=new String("ello");
c.amethod(s);
}

public void amethod(String s){
char c=´H´;
c+=s;
System.out.println(c);
}
}


1) Compilation and output the string "Hello"
2) Compilation and output the string "ello"
3) Compilation and output the string elloH
4) Compile time error

Answer to Question 35
--------------------------------------------------------------------------------

Question 36)
Given the following code, what test would you need to put in place of the comment line?

//place test here

to result in an output of the string
Equal

public class EqTest{
public static void main(String argv[]){
EqTest e=new EqTest();
}

EqTest(){
String s=" Java ";
String s2="java";
//place test here {
System.out.println("Equal");
}else
{
System.out.println("Not equal");

}
}
}
1) if(s==s2)
2) if(s.equals(s2)
3) if(s.equalsIgnoreCase(s2))
4)if(s.noCaseMatch(s2))

Answer to Question 36

---------------------------------------
Question 37)
Given the following code

import java.awt.*;
public class SetF extends Frame{
public static void main(String argv[]){
SetF s=new SetF();
s.setSize(300,200);
s.setVisible(true);
}

}
How could you set the frame surface color to pink

1)s.setBackground(Color.pink);
2)s.setColor(PINK);
3)s.Background(pink);
4)s.color=Color.pink

Answer to Question 37
-------------------------------------------
Question 38)

How can you change the current working directory using an instance of the File class called FileName?
1) FileName.chdir("DirName")
2) FileName.cd("DirName")
3) FileName.cwd("DirName")
4) The File class does not support directly changing the current directory.

Answer to Question 38
-------------------------------------------
Question 39)
If you create a TextField with a constructor to set it to occupy 5 columns, what difference will it make if you use it with a proportional font (ie Times Roman) or a fixed pitch typewriter style font (Courier).

1)With a fixed font you will see 5 characters, with a proportional it will depend on the width of the characters
2)With a fixed font you will see 5 characters,with a proportional it will cause the field to expand to fit the text
3)The columns setting does not affect the number of characters displayed
4)Both will show exactly 5 characters

Answer to Question 39

Question 40)

Given the following code how could you invoke the Base constructor that will print out the string "base constructor";

class Base{
Base(int i){
System.out.println("base constructor");
}
Base(){
}
}

public class Sup extends Base{
public static void main(String argv[]){
Sup s= new Sup();
//One
}
Sup()
{
//Two
}

public void derived()
{
//Three
}
}

1) On the line After //One put Base(10);
2) On the line After //One put super(10);

3) On the line After //Two put super(10);
4) On the line After //Three put super(10);

Answer to Question 40

Question 41)  
Given the following code what will be output?  
public class Pass{  
static int j=20;  
public static void main(String argv[]){  
int i=10;  
Pass p = new Pass();  
p.amethod(i);  
System.out.println(i);  
System.out.println(j);  
}  
public void amethod(int x){  
x=x*2;  
j=j*2;  
}  
}  
1) Error: amethod parameter does not match variable  
2) 20 and 40  
3) 10 and 40  
4) 10, and 20  
Answer to Question 41  

--------------------------------------------------------------------------------  
Question 42)  
What code placed after the comment //For loop would result in the population of every element of the array ia[] with a value from variable i.?  
public class Lin{  
public static void main(String argv[]){  
Lin l = new Lin();  
l.amethod();  
}  
public void amethod(){  
int ia[] = new int[4];  
//Start For loop  
{  
ia[i]=i;  
System.out.println(ia[i]);  
}  
}  
}  

1) for(int i=0; i < ia.length() -1; i++)  
2) for (int i=0; i< ia.length(); i++)  
3) for(int i=1; i < 4; i++)  
4) for(int i=0; i< ia.length;i++)  
Answer to Question 42  

--------------------------------------------------------------------------------  
Question 43)  
What will be the result when you try to compile and run the following code?  
private class Base{  
Base(){  
int i = 100;  
System.out.println(i);  
}  
}  
public class Pri extends Base{  
static int i = 200;  
public static void main(String argv[]){  
Pri p = new Pri();  
System.out.println(i);  
}  
}  

1) Error at compile time  
2) 200  
3) 100 followed by 200  
4) 100  
Answer to Question 43  

--------------------------------------------------------------------------------  
Question 44)  
What will the following code print out?  
public class Oct{  
public static void main(String argv[]){  
Oct o = new Oct();  
o.amethod();  
}  
public void amethod(){  
int oi= 012;  
System.out.println(oi);  
}  
}  
1)12  
2)012  
3)10  
4)10.0  

Answer to Question 44

 

 

 

上下文章:

 

上一篇文章: SCJP考试真题和解析[2](3) 下一篇文章: SCJP模拟试题[1](1)

相关文章:

  • 深度分析:Oracle收购JBoss&BEA开源kodo
  • Oracle加入Grails开源计划提升Java生产力
  • ORACLE OCP认证的各门考试科目
  • 在IT行业中,借专家之眼看:Oracle认证
  • Oracle 丰富认证体系 新增资深专家的认证

相关软件:

  • PS模拟器 2.2
  • FC模拟器 V2.0
  • 机动车驾驶员理论考试模拟系统 V2007 全国通用版
  • 木马分析专家个人防火墙 2008 V0618
  • 木马分析专家 2008 V9.88 Build 0618
  • 长龙宽带上网WEB认证系统 V1.3.9.8

 

 

快速导航

  • 网络学院
  • 精品汇聚
  • 字体下载
  • 教程下载
  • ASP源码
  • PHP源码
  • Net源码
  • JSP 源码

JAVA认证分类导航

  • JAVA动态
  • JAVA指导
  • JAVA题库

本类经典文章推荐

  • SCJP模拟试题[2](2)
  • SCJP模拟试题[2](1)
  • SCJP考试真题和解析[1](2)
  • SCJP Mock Exam 3(1)
  • SCJP考试题310-025[5](1)
  • Java网络编程之URI、URL研究专题一
  • Java认证模拟题及分析(1)
  • SCJP模拟试题[1](3)
  • Java认证模拟题及分析(3)
  • SCJP考试真题和解析[2](3)

JAVA题库阅读排行

  • JAVA题库:考考你4
  • SCJP Mock Exam 2(2)
  • JAVA题库:考考你2
  • Java认证模拟题及分析(3)
  • Java认证模拟题及分析(1)
  • SCJP考试真题和解析[1](2)
  • JAVA题库:格林模拟试题一(上)(2)
  • SCJP模拟试题[2](3)
  • SCJP模拟试题[2](1)
  • SCJP考试真题和解析[1](1)

JAVA认证阅读总排行

  • JAVA题库:考考你4
  • SCJP Mock Exam 2(2)
  • JAVA题库:考考你2
  • Java认证模拟题及分析(3)
  • Java认证模拟题及分析(1)
  • SCJP考试真题和解析[1](2)
  • JAVA题库:格林模拟试题一(上)(2)
  • SCJP模拟试题[2](3)
  • SCJP模拟试题[2](1)
  • SCJP考试真题和解析[1](1)

广告位置

字母检索 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 回到顶部

关于我们 | 版权声明 | 免责条款 | 广告联系 | 软件发布 | 下载帮助 | 下载排行 | 网站地图 | 特别鸣谢 | 友情连接

copyright; 2005-2008 D9soft.com 第九软件网 版权所有