Sun pattern test and answer

zhaozj2021-02-11  161

New Sun Certified Programmer for The Java 2 Platform Sample Questions1. Given:

Public class arraytest {public static void main (string [] args) {object [] OV; string [] sa = {"green", "blue", "red"}; ov = sa; system.out.println (" COLOR = " OV [1]);}} What is the result?

Fails to Compile Prints Color = Blue Prints Color = Green Generates an Exception At Runtime 2. Given:

Public class outerclass {private double d1 = 1.0; // insert code here}

You NEED TO INSERT An Inner Class Declaration At Line 3. Which Two Inner Class Declarations Are Valid? (Choose Two)

class InnerOne {public static double methoda () {return d1;}} public class InnerOne {static double methoda () {return d1;}} private class InnerOne {double methoda () {return d1;}} static class InnerOne {protected double Methoda () {Return D1;}}

Abstract class innerone {public abstract double methoda ();} 3. Given:

Public class x {public void m (object x) {x = new integer (99); integer y = (integer) x; y = null; system.out.println ("x is" x);}}

WHEN is The Integer Object, CREATED IN LINE 3, ELIGIBLE for GARBAGE COLLECTION?

NEVER JUST AFTER LINE 4 JUST AFTER LINE 5 JUST AFTER LINE 6 (That IS, AS THE Method Returns) WHEN THE CALLING METHOD SETS The Argument It Passed Into this Method To Null4. Which is a Valid Identifier?

False Default_Object A-Class 5. Which Two Are Equivalent? (Choose Two)

12> 4 12/4 12 * 4 12 >> 2 12/2 ^ 2 12 >>> 16. Which Two Demonstrate A "HAS A" RELATIONSHIP? (Choose two.)

public interface Person {} public class Employee extends Person {} public interface Shape {} public interface Rectangle extends Shape {} public interface Colorable {} public class Shape implements Colorable {} public class Species {} public class Animal {private Species species;} Interface Component {} Class Container Implements Component {Private Component [] Children;} 7. Given Double Pi = Math.pi; Which Two Are Valid Ways To Round Pi to An Int? (Choose Two)

INT P = Pi; INT P = Math.Round (Pi); int P = (int) Math.Round (pi); int P = (int) math.min (pi 0.5d);

INT P = (int) Math.floor (PI 0.5D); 8. Which Two Statements Are True for the class java.util.treeset? (choose two.)

The elements in the collection are ordered. The collection is guaranteed to be immutable. The elements in the collection are guaranteed to be unique. The elements in the collection are accessed using a unique key. The elements in the collection are guaranteed to be synchronized Return To the top

SUN CERTIFIED PROGRAMMER FOR THE JAVA PLATFORM, JDK 1.1Note: The certification exam for the jdk 1.1 will be retired January 31, 2001. If you plan to pursue this certification you will need to register by this date As of February 1, 2001,. Sun will only offer certification exams for the Java 2 Platform The following samples will help you understand the types of questions you can expect to see when taking the Certified Programmer for the Java Platform, JDK 1.1 examination:. Prometric exam number 310-022 (number 310-023 for IBM candidates) .1. Which code fragments would correctly identify the number of arguments passed via the command line to a Java application, excluding the name of the class that is being invoked?

INT count = args.lendth; int count = args.length - 1; int count = 0; while (args [count]! = null) count ; int count = 0; While (! (args [count] .Equals ( ""))) count ;?? 2. Which are keywords in Java (select all that apply) sizeof abstract native NULL BOOLEAN 3. Which are correct class declarations Assume in each case that the text constitutes the entire contents of a File Called Fred.java ON A System with a Case-Significant File System. Select All That Apply.

Public class fred {

Public INT x = 0;

Public fred (int x) {

THIS.X = X;

}

PUBLIC CLASS FRED

Public INT x = 0;

Public fred (int x) {

THIS.X = X;

}

PUBLIC CLASS FRED EXTENDS MyBaseClass, myotherbaseclass {

Public INT x = 0;

Public fred (int xval) {

x = xval;

}

} protected class fred {

PRIVATE INT X = 0;

Private fred (int xval) {

x = xval;

}

Import java.awt. *;

Public class fred extends Object {

INT X;

Private fred (int xval) {

x = xval;

}

} 4. A class design requires that a particular member variable must beaccessible for direct access by any subclasses of this class, but otherwise not by classes which are not members of the same package. What should be done to achieve this?

The variable should be marked public The variable should be marked private The variable should be marked protected The variable should have no special access modifier The variable should be marked private and an accessor method provided5. Which correctly creates an array of five empty Strings (select all That apply?

String a [] = new string [5]; for (int i = 0; i <5; a [i ] = ""); string a [] = {"", "", ",", "," "}; String a [5]; string [] a = new string [5]; for (int i = 0; i <5; a [i ] = null); string [5] a; 6. Which cannot BE Added to a Container? An applet a company a Container a menu a panel

SUN CERTIFIED PROGRAMMER FOR THE JAVA 2 PLATFORMSun Educational Services provides sample questions as a means for cand idates to understand the types of questions that you can expect when taking the Sun Certified Programmer for the Java ™ 2 Platform exa mination: Prometric exam number 310-025 .

Given:

Public class arraytest {public static void main (string [] args) {object [] OV; string [] sa = {"green", "blue", "red"}; ov = sa; system.out.println (" COLOR = " OV [1]);}} What is the result?

Fails to Compile Prints Color = Blue Prints Color = Green Generates an Exception At Runtime 2. Given:

Public class outerclass {private double d1 = 1.0; // insert code here}

You NEED TO INSERT An Inner Class Declaration At Line 3. Which Two Inner Class Declarations Are Valid? (Choose Two)

class InnerOne {public static double methoda () {return d1;}} public class InnerOne {static double methoda () {return d1;}} private class InnerOne {double methoda () {return d1;}} static class InnerOne {protected double Methoda () {Return D1;}}

Abstract class innerone {public abstract double methoda ();} 3. Given:

Public class x {public void m (object x) {x = new integer (99); integer y = (integer) x; y = null; system.out.println ("x is" x);} }when is THE INTEGER OBJECT, CREATED IN LINE 3, ELIGIBLE for GARBAGE COLLECTION?

NEVER JUST AFTER LINE 4 JUST AFTER LINE 5 JUST AFTER LINE 6 (That IS, AS THE Method Returns) WHEN THE CALLING METHOD SETS The Argument It Passed Into this Method To Null4. Which is a Valid Identifier?

False Default_Object A-Class 5. Which Two Are Equivalent? (Choose Two)

12> 4 12/4 12 * 4 12 >> 2 12/2 ^ 2 12 >>> 16. Which Two Demonstrate A "HAS A" RELATIONSHIP? (Choose two.)

public interface Person {} public class Employee extends Person {} public interface Shape {} public interface Rectangle extends Shape {} public interface Colorable {} public class Shape implements Colorable {} public class Species {} public class Animal {private Species species;} Interface Component {} Class Container Implements Component {Private Component [] children;

7. Given Double Pi = Math.pi; Which Two Are Valid Ways to Round Pi To An Int? (Choose Two)

INT P = Pi; INT P = Math.Round (Pi); int P = (int) Math.Round (pi); int P = (int) math.min (pi 0.5d);

INT P = (int) Math.floor (PI 0.5D); 8. Which Two Statements Are True for the class java.util.treeeset? (choo se two.)

The elements in the collection are ordered. The collection is guaranteed to be immutable. The elements in the collection are guaranteed to be unique. The elements in the collection are accessed using a unique key. The elements in the collection are guaranteed to be synchronized Return To the top

SUN CERTIFIED PROGRAMMER FOR THE JAVA PLATFORM, JDK 1.1Note: The certification exam for the jdk 1.1 will be retired January 31, 2001. If you plan to pursue this certification you will need to register by this date As of February 1, 2001,. Sun will only offer certification exams for the Java 2 Platform The following samples will help you understand the types of questions you can expect to see when taking the Certified Programmer for the Java Platform, JDK 1.1 examination:. Prometric exam number 310-022 (number . 310-023 for IBM candidates) .1 Which code fragments would correctly identify the number of arguments passed via the command line to a Java application, excluding the name of the class that is being invoked int count = args.length;? int count = Args.Length - 1; int count = 0; While (args [count]! = null) count ; int count = 0; while (! (args [count] .Equals ("))) COUNT ; 2. Which is known for "SELECT All That Apply?

sizeof abstract native NULL BOOLEAN 3. Which are correct class declarations? Assume in each case that the text constitutes the entire contents of a file called Fred.java on a system with a case-significant file system. Select all that apply.

Public class fred {

Public INT x = 0;

Public fred (int x) {

THIS.X = X;

}

PUBLIC CLASS FRED

Public INT x = 0;

Public fred (int x) {

THIS.X = X;

}

PUBLIC CLASS FRED EXTENDS MyBaseClass, myotherbaseclass {

Public INT x = 0;

Public fred (int xval) {

x = xval;

}

} protected class fred {

PRIVATE INT X = 0;

Private fred (int xval) {

x = xval;

}

Import java.awt. *;

Public class fred extends Object {

INT X;

Private fred (int xval) {

x = xval;

}

} 4. A class design requires that a particular member variable must beaccessible for direct access by any subclasses of this class, but otherwise not by classes which are not members of the same package. What should be done to achieve this? The variable should be marked public The variable should be marked private The variable should be marked protected The variable should have no special access modifier The variable should be marked private and an accessor method provided5. Which correctly creates an array of five empty Strings (select all that apply)?

String a [] = new string [5]; for (int i = 0; i <5; a [i ] = ""); string a [] = {"", "", ",", "," "}; String a [5]; string [] a = new string [5]; for (int i = 0; i <5; a [i ] = null); string [5] a; 6. Which cannot BE Added to a container?

An applet a companies A Container a menu a panel

转载请注明原文地址:https://www.9cbs.com/read-4825.html

New Post(0)