Sun java认证考试真题答案

时间:2024-09-25 10:44:04 毅霖 SUN认证 我要投稿
  • 相关推荐

Sun java认证考试真题答案

  SUN认证是给网络设计界建立的一套认证标准,Sun公司推出了Java以及Solaris技术认证方案。以下是小编整理的关于Sun java认证考试真题答案,希望大家认真阅读!

Sun java认证考试真题答案

  Sun java认证考试真题答案

  1. What gets printed when the following program

  is compiled and run?

  class Test {

  public static void main(String args[]) {

  int i;

  do {

  i++;

  } while (i < 0);

  System.out.println(i);

  }

  }

  Select 1 correct answer:

  A. The program does not compile as i is not initialized.

  B. The program compiles but does not run.

  C. The program compiles and runs but does not print anything.

  D. The program prints 0.

  E. The program prints 1.

  答案:A:如果没有初始化便使用基本变量类型,会导致编译时异常,程序不能编译。

  2. What gets printed when the following program

  is compiled and run?

  public class XYZ {

  public static void main(String args[]) {

  int i,j,k;

  for (i = 0; i < 3; i++)

  {

  for(j=1; j < 4; j++)

  {

  for(k=2; k<5; k++)

  {

  if((i == j) && (j==k))

  System.out.println(i);

  } } } } }

  Select 1 correct answer:

  A. 0

  B. 1

  C. 2

  D. 3

  E. 4

  答案:C

  3. 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 ed at the comment //Here

  will allow the code to compile and run without error?

  Select 2 correct answers:

  A. b = m;

  B. m = b;

  C. d = i;

  D. b1 = i;

  解析:A 从子类型到父类型的转换是扩展引用转换,不需要在运行时采取特殊的动作,不会在运行时抛出异常。

  B 从超类型到子类型的转换是收缩引用转换,需要在运行时执行测试,以查明实际的引用值是否是新类型的合法值.如果不是, 则会抛出ClassCascException 。在这里,b本身不是MyCast类型的值,因此会导致运行时异常。

  C 从int到double的转换是扩展基本转换,基本类型之间的扩展转换永远不会导致运行时异常。但从int或long到float,或者是从long到double都可能导致精度丢失。

  D 不允许进行int和boolean之间的类型转换

  答案:A、C

  4. Given the following 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();

  }

  }

  Select 3 correct answers:

  A. o1 = o2;

  B. b = ob;

  C. ob = b;

  D. o1 = b;

  解析:A 任何对象都可以赋给Object类型的对象,正确

  B 子类赋给超类是扩展引用转换,可以进行

  C 收缩引用转换,错误

  D 扩展引用转换,可以进行

  答案 A B D

  5. What is the result of compiling and running the following code?

  1 public class Test {

  2 static int total = 10;

  3 public static void main (String args []) {

  4 new Test();

  5 }

  6 public Test () {

  7 System.out.println("In test");

  8 System.out.println(this);

  9 int temp = this.total;

  10 if (temp > 5) {

  11 System.out.println(temp);

  12 }

  13 }

  14 }

  Select 1 correct answer:

  A. The class will not compile

  B. The compiler reports an error at line 2

  C. The compiler reports an error at line 9

  D. The value 10 is one of the printed elements

  E. The class compiles but generates a runtime error

  答案:D 由于test类没有override toString方法,故在调用println(this)时会直接显示类的有关信息。

  6. Carefully examine the following code:

  public class StaticTest {

  static { System.out.println("Hi there"); }

  public void print() {

  System.out.println("Hello");

  }

  public static void main(String args []) {

  StaticTest st1 = new StaticTest();

  st1.print();

  StaticTest st2 = new StaticTest();

  st2.print();

  }}

  When will the string "Hi there" be printed?

  Select 1 correct answer:

  A. Never

  B. Each time a new instance is created

  C. Once, when the class is first loaded into the JVM

  D. Only when the static method is called explicitly

  答案 C

  Java虚拟机规范约定,类的初始化发生在首次主动使用时。静态变量和静态初始化块的先后,实际上取决于它们在类中出现的先后顺序。

  Sun认证Java程序员(SCJP)考试科目

  考试方式: 全英文试题,以电脑作答,在授权的Prometric考试中心参加考试

  考试科目:Sun Certified Programmer for Java 2 Platform 1.2

  考试编号:310-025

  考试题型:59道选择题及简答题

  及格标准:答对61%(36题)以上

  时限:120分钟

  费用:1500元

  考试科目:Sun Certified Programmer for Java 2 Platform 1.4

  考试编号:310-035

  考试题型:59道选择题及简答题

  及格标准:答对61%(36题)以上

  时限:120分钟

  费用:1500元

  考试科目

  SCJP的四个科目310-025、310-035、310-055、310-056的区别如下:

  Sun Certified Programmer for Java 2 Platform 1.2(310-025)表明你掌握了JDK1.2的知识。

  Sun Certified Programmer for Java 2 Platform 1.4(310-035)表明你掌握了JDK1.4的知识。

  Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0(310-055)表明你掌握了JDK1.5的知识。

  Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 Upgrade Exam(310-056)是从JDK1.2或JDK1.4升级到JDK1.5的考试。

  证书查询

  一、具体操作流程:

  1、自考试通过后一个月左右,证书从美国Sun总公司到达Sun北京培训中心。

  2、工作人员根据人名单进行数据库输入工作。

  3、将收到的证书与名单进行核对。

  4、核对无误后将发送一封邮件给考生索取中文信息。

  具体中文信息大概包括以下几点内容:

  (1)中文姓名 (5)考试号

  (2)考试日期 (6)联系电话

  (3)考试类别 (7)详细中文地址 (邮政编码)

  (4)电子邮件

  5、收到考生详细中文信息后将证书寄出。

  二、如果考试后两个月仍未收到证书或者索取中文信息的邮件,此时你可以进行你的证书查询。

  1、将个人中英文资料发邮件至:amity.xu@sunservices.com.cn

  2、收到你的邮件后,工作人员会先在遗留证书中查询。

  3、确定没有你的证书后,会将你全部的个人详细资料发送邮件给美国总部,他们将会继续查询工作,并以电子邮件的方式和你进行联系。

  4、收到美国的电子邮件后,即可按照他们要求的方式提供资料或者其他信息,他们将会在最短的时间内进行您证书的补办事宜。

  此一环节中所需的信息如下:

  (1)中文姓名 (拼音姓名)

  (2)考试日期

  (3)考试类别

  (4)考试号

  (5)电子邮件

  (6)联系电话

  (7)详细中文地址 (邮政编码)

  注:在您通过考试后的第二个月即可开始证书查询,证书查询时间为每周一至周四下午13:30-18:00

《Sun java认证考试真题答案.doc》
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:
点击下载文档

【Sun java认证考试真题答案】相关文章:

2017年Java认证考试真题及答案03-26

sun java认证考试介绍03-19

Sun Java认证考试科目03-19

sun java认证考试报考指南03-19

SUN JAVA认证介绍12-18

Sun Java认证考试教材教辅03-19

Sun认证Java开发员考试介绍03-25

sun认证考试:Java.io的使用01-08

sun java认证报考指南03-08

在线咨询

Sun java认证考试真题答案

  SUN认证是给网络设计界建立的一套认证标准,Sun公司推出了Java以及Solaris技术认证方案。以下是小编整理的关于Sun java认证考试真题答案,希望大家认真阅读!

Sun java认证考试真题答案

  Sun java认证考试真题答案

  1. What gets printed when the following program

  is compiled and run?

  class Test {

  public static void main(String args[]) {

  int i;

  do {

  i++;

  } while (i < 0);

  System.out.println(i);

  }

  }

  Select 1 correct answer:

  A. The program does not compile as i is not initialized.

  B. The program compiles but does not run.

  C. The program compiles and runs but does not print anything.

  D. The program prints 0.

  E. The program prints 1.

  答案:A:如果没有初始化便使用基本变量类型,会导致编译时异常,程序不能编译。

  2. What gets printed when the following program

  is compiled and run?

  public class XYZ {

  public static void main(String args[]) {

  int i,j,k;

  for (i = 0; i < 3; i++)

  {

  for(j=1; j < 4; j++)

  {

  for(k=2; k<5; k++)

  {

  if((i == j) && (j==k))

  System.out.println(i);

  } } } } }

  Select 1 correct answer:

  A. 0

  B. 1

  C. 2

  D. 3

  E. 4

  答案:C

  3. 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 ed at the comment //Here

  will allow the code to compile and run without error?

  Select 2 correct answers:

  A. b = m;

  B. m = b;

  C. d = i;

  D. b1 = i;

  解析:A 从子类型到父类型的转换是扩展引用转换,不需要在运行时采取特殊的动作,不会在运行时抛出异常。

  B 从超类型到子类型的转换是收缩引用转换,需要在运行时执行测试,以查明实际的引用值是否是新类型的合法值.如果不是, 则会抛出ClassCascException 。在这里,b本身不是MyCast类型的值,因此会导致运行时异常。

  C 从int到double的转换是扩展基本转换,基本类型之间的扩展转换永远不会导致运行时异常。但从int或long到float,或者是从long到double都可能导致精度丢失。

  D 不允许进行int和boolean之间的类型转换

  答案:A、C

  4. Given the following 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();

  }

  }

  Select 3 correct answers:

  A. o1 = o2;

  B. b = ob;

  C. ob = b;

  D. o1 = b;

  解析:A 任何对象都可以赋给Object类型的对象,正确

  B 子类赋给超类是扩展引用转换,可以进行

  C 收缩引用转换,错误

  D 扩展引用转换,可以进行

  答案 A B D

  5. What is the result of compiling and running the following code?

  1 public class Test {

  2 static int total = 10;

  3 public static void main (String args []) {

  4 new Test();

  5 }

  6 public Test () {

  7 System.out.println("In test");

  8 System.out.println(this);

  9 int temp = this.total;

  10 if (temp > 5) {

  11 System.out.println(temp);

  12 }

  13 }

  14 }

  Select 1 correct answer:

  A. The class will not compile

  B. The compiler reports an error at line 2

  C. The compiler reports an error at line 9

  D. The value 10 is one of the printed elements

  E. The class compiles but generates a runtime error

  答案:D 由于test类没有override toString方法,故在调用println(this)时会直接显示类的有关信息。

  6. Carefully examine the following code:

  public class StaticTest {

  static { System.out.println("Hi there"); }

  public void print() {

  System.out.println("Hello");

  }

  public static void main(String args []) {

  StaticTest st1 = new StaticTest();

  st1.print();

  StaticTest st2 = new StaticTest();

  st2.print();

  }}

  When will the string "Hi there" be printed?

  Select 1 correct answer:

  A. Never

  B. Each time a new instance is created

  C. Once, when the class is first loaded into the JVM

  D. Only when the static method is called explicitly

  答案 C

  Java虚拟机规范约定,类的初始化发生在首次主动使用时。静态变量和静态初始化块的先后,实际上取决于它们在类中出现的先后顺序。

  Sun认证Java程序员(SCJP)考试科目

  考试方式: 全英文试题,以电脑作答,在授权的Prometric考试中心参加考试

  考试科目:Sun Certified Programmer for Java 2 Platform 1.2

  考试编号:310-025

  考试题型:59道选择题及简答题

  及格标准:答对61%(36题)以上

  时限:120分钟

  费用:1500元

  考试科目:Sun Certified Programmer for Java 2 Platform 1.4

  考试编号:310-035

  考试题型:59道选择题及简答题

  及格标准:答对61%(36题)以上

  时限:120分钟

  费用:1500元

  考试科目

  SCJP的四个科目310-025、310-035、310-055、310-056的区别如下:

  Sun Certified Programmer for Java 2 Platform 1.2(310-025)表明你掌握了JDK1.2的知识。

  Sun Certified Programmer for Java 2 Platform 1.4(310-035)表明你掌握了JDK1.4的知识。

  Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0(310-055)表明你掌握了JDK1.5的知识。

  Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 Upgrade Exam(310-056)是从JDK1.2或JDK1.4升级到JDK1.5的考试。

  证书查询

  一、具体操作流程:

  1、自考试通过后一个月左右,证书从美国Sun总公司到达Sun北京培训中心。

  2、工作人员根据人名单进行数据库输入工作。

  3、将收到的证书与名单进行核对。

  4、核对无误后将发送一封邮件给考生索取中文信息。

  具体中文信息大概包括以下几点内容:

  (1)中文姓名 (5)考试号

  (2)考试日期 (6)联系电话

  (3)考试类别 (7)详细中文地址 (邮政编码)

  (4)电子邮件

  5、收到考生详细中文信息后将证书寄出。

  二、如果考试后两个月仍未收到证书或者索取中文信息的邮件,此时你可以进行你的证书查询。

  1、将个人中英文资料发邮件至:amity.xu@sunservices.com.cn

  2、收到你的邮件后,工作人员会先在遗留证书中查询。

  3、确定没有你的证书后,会将你全部的个人详细资料发送邮件给美国总部,他们将会继续查询工作,并以电子邮件的方式和你进行联系。

  4、收到美国的电子邮件后,即可按照他们要求的方式提供资料或者其他信息,他们将会在最短的时间内进行您证书的补办事宜。

  此一环节中所需的信息如下:

  (1)中文姓名 (拼音姓名)

  (2)考试日期

  (3)考试类别

  (4)考试号

  (5)电子邮件

  (6)联系电话

  (7)详细中文地址 (邮政编码)

  注:在您通过考试后的第二个月即可开始证书查询,证书查询时间为每周一至周四下午13:30-18:00