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

SCJP模拟试题[2](2)

 

添加时间: 2007-9-23 2:26:18  作者: JAVA题库  阅读次数:112   来源: http://www.d9soft.com

 

 

       

2. public void init(){
3. sz=10;
4. String tmp=getParameter("size");
5. if(tmp!=null X tmp.equals("BIG")) sz=20;
6. }

a). Replace X with '&'
b). Replace X with '&&'
c). Replace X with ''
d). Replace X with ''

-------------------------------------

Question 22:
Which of the following statements results in C containing the special "Not a Number" value?

a. float C=1234.0F/0.0F;
b. float C=(float)java.lang.Math.sqrt(-1.0);
c. float C=Float.MIN_VALUE/Float.MAX_VALUE;

--------------------------------------------

Question 23: [Check all correct answers]
You are writing a java class in a file named "MyClass.java", this class must be accessible by all classes in a large project. Which of the following would be correct class declarations?

a. private class MyClass extends Object
b. class myclass extends Object
c. public class MyClass
d. public class MyClass extends Object

------------------------------------------

Question 24: [Check all correct answers]
Once created, some Java objects are "immutable", meaning they can not have their contents changed. Which of the following classed produce immutable objects?

a. java.lang.Double
b. java.lang.StringBuffer
c. java.lang.Boolean
d. java.lang.Math

---------------------------------------
Question 25:
Given the following class definitions:
1. class BaseWidget extends Object{
2. String name="BaseWidget";
3. void speak(){System.out.println("I am a "+name);}
4. }
5. class TypeAWidget extends BaseWidget{
6. TypeAWidget(){name="TypeA";}
7. }

Which of the following code fragments will compile and execute without error?
a. Object A=new BaseWidget();
A.speak();

B.speak();
c. TypeAWidget C=new BaseWidget();
C.speak();

------------------------------------------

Question 26: [Check all correct answers]
Pick the keyword(s) which can NOT be used as modifiers in declaration of a method in a Java class.

a) private
b) friend
c) protected
d) static
e) synchronized
f) generic

-----------------------------------------

Question 27: [Check all correct answers]
Which of the following would be an illegal identifier for a Java method?

a) do_it_now
b) _Substitute
c) 9thMethod
d) $addMoney
e) %getPath

-------------------------------------------

Question 28:
Given the following code for the Demo class:

public class Demo{
private int[] count;
public Demo(){ count=new int[10];}
public void setCount(int ct,int n){ count[n]=ct;}
public void showCount(int n){
System.out.println("Count is "+count[n]);
}
public int getCount(int n){ return count[n];}
}

what would be the result of calling the showCount method with a parameter of 9 immediately after creating an instance of Demo?

a) A NullPointerException would be thrown, halting the program.
b) Standard output would show "Count is 0".
c) An ArrayIndexOutOfBoundsException would be thrown, halting the program.
d) Standard output would show "Count is null".

-------------------------------

Question 29:

What happens when we attempt to compile and run the following code?
1. public class Logic{
2. static long sixteen=0x0010;
3. static public void main(String args[]){
4. long N=sixteen>>4:
5. System.out.println("N= "+N);
6. }
7. }

a) The compiler will object to line 4 combining a long with an int.
b) The program will compile and run, producing the output "N=0".
c) The program will compile and run, producing the output "N=1".
d) A rutime exception will be thrown.

-------------------------------------

Question 30:
What will happen on trying to compile and run the following application?
1. public class Example{
2. public Boolean flags[]=new Boolean[4];

3. public static void main(String[] args){
4. Example E=new Example();
5. System.out.println("Flag 1 is "+E.flags[1]);
6. }
7. }

a) The text "Flag 1 is true" will be written to standard output.
b) The text "Flag 1 is false" will be written to standard output.
c) The text "Flag 1 is null" will be written to standard output.
d) The compiler will object to line 2.

 
--------------------------------------------

Question 31: [Check all correct answers]

Which of the following code fragments are legal Java code?

a) String A="abcdefg";
A-="cde";
b) String A="abcdefg";
A+="cde";
c) Integer J=new Integer(27);
J-=7;
d) Integer J=new Integer(27);
J--;

----------------------------------------------

Question 32:

Given the following code for the code for Demo class, where "XXXX" represents an access modifier:

public class Demo extends Base{
XXXX String userName;
public void setName(String s){ userName=s;}
public void showName(){
System.out.println("Name is "+userName):
}
public String getName(){ return userName; }
}


Select the modifier which would be used to give only classes in the default package or classes derived from Demo, direct access to the userName String variable.

a) public
b) blank (ie - the line would read "String userName :")
c) protected
d) private

---------------------------------------------
Question 33:

Given the following method in an application:

1. public String setFiletype(String fname){
2. int p=fname.indexOf('.');
3. if(p>0) fname=fname.substring(0,p);
4. fname+=".TXT";
5. return fname;
6. }

and given that another part of the class has a the following code:
7. String TheFile="Program.java";
8. File F=new File(setFileType(TheFile));
9. System.out.println("Created "+TheFile);
What will be printed by the statement in line 9?

a) "Created Program.java"
b) "Created Program.txt"
c) "Created Program.java.txt"

----------------------------------
Question 34:

What happens on trying to compile and run the following code?
1. public class EqualsTest{
2. public static void main(String args[]){
3. byte A=(byte)4096;

 

 

 

上下文章:

 

上一篇文章: SCJP模拟试题[2](1) 下一篇文章: SCJP模拟试题[2](3)

相关文章:

  • 史上最强的几道oracle面试题
  • 国外公司的Oracle DBA试题
  • 今年4月三级数据库笔试试题及答案
  • Oracle DBA 逻辑备份试题选
  • 国外某公司的Oracle DBA试题

相关软件:

  • PS模拟器 2.2
  • FC模拟器 V2.0
  • 机动车驾驶员理论考试模拟系统 V2007 全国通用版
  • 试题库管理系统 V5.1
  • PSP模拟器 V2.1
  • 秋风试题大题 V1.0

 

 

快速导航

  • 网络学院
  • 精品汇聚
  • 字体下载
  • 教程下载
  • 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 第九软件网 版权所有