SCJP在线测试
时间还剩:
联系我们   收藏本站   设为首页   
 
JAVA下载 JAVA文摘 J2me学习 JAVA实例              


SCJP在线测试

〖 姓名:Guest〗

第1题(id号=163):

 which gets the name of the parent directory of file "file.txt"? 
   A. String name=File.getParentName("file.txt"); 
   B. String name=(new File("file.txt")).getParent(); 
   C. String name=(new File("file.txt")).getParentName(); 
   D. String name=(new File("file.txt")).getParentFile(); 
   E. Diretory dir=(new File("file.txt")).getParentDir(); 


请选择: A B C D E

第2题(id号=327):

Which of the following statements is correct for a method which is overriding the
following method:
public void add(int a) {…}
A. the overriding method must return void
B. the overriding method must return int
C. the overriding method can return whatever it likes
Select the most appropriate answer.


请选择: A B C

第3题(id号=436):

If you would like to change the size of a Component, you can use the following method
a. size()
b. resize()
c. setSize()
d. dimension()


请选择: A B C D

第4题(id号=145):

1)public class Test{ 
  2) public static void main(String[] args){ 
  3) unsigned byte b=0; 
  4) b--; 
  5) 
  6) } 
  7) } 
  what is the value of b at line 5? 
  A.-1   B.255  C.127  D.compile fail  E.compile succeeded but run error 


请选择: A B C D E

第5题(id号=385):

Consider the following code: What will be printed?
 public class EqualsTest2{
   public static void main(String[]args){
     byte A = (byte)4096;
     if (A == 4096)
       System.out.println("Equal");
     else 
       System.out.println("Not Equal");
    System.out.println(A);
    int B = (int)4096;
    if (B == 4096)
       System.out.println("Equal");
    else 
       System.out.println("Not Equal");
    System.out.println(A);
  }
}
A. Not Equal Not Equal 0
B. Not Equal 0 Equal 0
C. Equal Not Equal 4096
D. Equal Equal 4096


请选择: A B C D

第6题(id号=712):

Assume you have a class that holds two private variables: a and b. 
  Which of the following pairs can prevent concurrent access 
  problems in that class? (Choose all that apply.)

A. public int read(){return a+b;} 

   public void set(int a, int b){this.a=a;this.b=b;} 

B. public synchronized int read(){return a+b;} 

   public synchronized void set(int a, int b){this.a=a;this.b=b;} 

C. public int read(){synchronized(a){return a+b;}} 

   public void get(int a, int b){synchronized(a){this.a=a;this.b=b;}} 

D. public int read(){synchronized(a){return a+b;}} 

   public void set(int a, int b){synchronized(b){this.a=a;this.b=b;}} 

E. public synchronized(this) int read(){return a+b;} 

   public synchronized(this) void set(int a, int b){this.a=a;this.b=b;} 

F. public int read () {synchronized (this) {return a+b;}} 

   public void set(int a, int b){synchronized(this){this.a=a;this.b=b;}} 


请选择: A B C D E F

第7题(id号=608):

What does the following code do?
File f = new File("hello.test");
FileOutputStream out = new FileOutputStream(f);
Select the one right answer.
a) Create a new file named "hello.test" if it does not yet exist. It also opens
   the file so you can write to it and read from it.
b) Create a new file named "hello.test" if it does not yet exist. The file is not
   opened.
c) Open a file named "hello.test" so that you can write to it and read from it, but
   does not create the file if it does not yet exist.
d) Open a file named "hello.test" so that you can write to it but cannot read from it.
e) Create an object that you can now use to create and open the file named
   "hello.test," and write to and read from the file.


请选择: A B C D E

第8题(id号=35):

Given the following code:
  class Person {
  String name,department;
  public void printValue(){ 
  System.out.println("name is "+name);
  System.out.println("department is "+department);
  }
  }
  public class Teacher extends Person {
  int salary;
  public void printValue(){
  // doing the same as in the parent method printValue()
  // including print the value of name and department.
  System.out.println("salary is "+salary);
  }
  }
  Which expression can be added at the "doing the same as..." part of the method 
    printValue()?
  A. printValue();
    B. this.printValue();
  C. person.printValue();
  D. super.printValue().


请选择: A B C D

第9题(id号=5):

Which two statements are true for the class java.util.TreeSet? (Choose two) 
  
  A. The elements in the collection are ordered. 
  B. The collection is guaranteed to be immutable. 
  C. The elements in the collection are guaranteed to be unique. 

  D. The elements in the collection are accessed using a unique key. 
  E. The elements in the collection are guaranteed to be synchronized 
 


请选择: A B C D E

第10题(id号=682):

Given:

10.    public static void main(String[] args) {
11.        Queue<String> q = new LinkedList<String>();
12.        q.add("Veronica");
13.        q.add("Wallace");
14.        q.add("Duncan");
15.        showAll(q);
16.    }
17.
18.    public static void showAll(Queue q) {
19.        q.add(new Integer(42));
20.        while (!q.isEmpty ( ) )
21.            System.out.print(q.remove( ) + "  ");
22.    }

What is the result?

A. Veronica Wallace Duncan 

B. Veronica Wallace Duncan 42 

C. Duncan Wallace Veronica 

D. 42 Duncan Wallace Veronica 

E. Compilation fails.

F. An exception occurs at runtime.


请选择: A B C D E F

第11题(id号=621):

Given:

class CardBoard {
  Short story = 5;
  CardBoard go(CardBoard cb) {
    cb = null;
    return cb;
  }

  public static void main(String[] args) {
    CardBoard c1 = new CardBoard();
    CardBoard c2 = new CardBoard();
    CardBoard c3 = c1.go(c2);
    c1 = null;
    // do Stuff
} }

When // doStuff is reached, how many objects are eligible for GC?

A. 0

B. 1

C. 2

D. Compilation fails.

E. It is not possible to know.

F. An exception is thrown at runtime.


请选择: A B C D E F

第12题(id号=270):


Consider the following code:
What will be printed?
public class AB{
  public static void main (String[] args){
   int x = 1;
   if (0 < --x){
    System.out.println(x);
   }
 }
}
A. 0
B. 1
C. 2
D. Nothing
E. An IllegalArgumentException will be thrown


请选择: A B C D E

第13题(id号=698):

Given:

1. class Foo {
2.   class Bar{ }
3. } 
4. class Test {
5.    public static void main(String[] args) {
6.       Foo f = new Foo();
7.       // Insert code here
8.    }
9. }

Which, inserted at line 7, creates an instance of Bar? (Choose all that apply.)

A. Foo.Bar b = new Foo.Bar(); 

B. Foo.Bar b = f.new Bar () ; 

C. Bar b = new f.Bar(); 

D. Bar b = f.new Bar(); 

E. Foo.Bar b = new f.Bar(); 


请选择: A B C D E

第14题(id号=398):

Which statement are characteristics of the >> and >>> operators.
A. >> performs a shift
B. >> performs a rotate
C. >> performs a signed and >>> performs an unsigned shift
D. >> performs an unsigned and >>> performs a signed shift
E. >> should be used on integrals and >>> should be used on floating point


请选择: A B C D E

第15题(id号=218):

Which statement is true about an inner class?
A. It must be anonymous
B. It can not implement an interface
C. It is only accessible in the enclosing class
D. It can only be instantiated in the enclosing class
E. It can access any final variables in any enclosing scope.


请选择: A B C D E

第16题(id号=454):

What is wrong with the following code?
 final class First {
  private int a = 1;
  int b = 2;
 }
 class Second extends First {
  public void method() {
   System.out.println(a+b);
  }
 }
a. You cannot invoke println() without passing it a string.
b. Because a is private, no classes other than First can access it.
c. Second cannot extend First.
d. final is not a valid keyword for a class.


请选择: A B C D

第17题(id号=671):

Given:

import java.io.*;
class Player {
  Player() { System.out.print("p"); }
}
class CardPlayer extends Player implements Serializable {
  CardPlayer() { System.out.print("c"); }
  public static void main(String[] args){
    CardPlayer c1 = new CardPlayer();

    try {
      FileOutputStream fos = new FileOutputStream("play.txt");
      ObjectOutputStream os = new ObjectOutputStream(fos);
      os.writeObject(c1);
      os.close() ;
      FileInputStream fis = new FileInputStream("play.txt");
      ObjectInputStream is = new ObjectInputStream(fis);
      CardPlayer c2 = (CardPlayer) is.readObject();
      is.close();
    } catch (Exception x ) { }
  }
}

What is the result?

A. pc 

B. pcc 

C. pcp 

D. pcpc 

E. Compilation fails.

F. An exception is thrown at runtime.


请选择: A B C D E F

第18题(id号=193):

public class X{ 
   public static void main(String[] args){ 
     int[] a=new int[1]; 
    4) modify(a); 
     System.out.println(a[0]); 
     } 
     public static void modify(int[] a){ 
    9) a[0]++;} 
      } 
    what is the result? 
    A.The program runs and prints "0"; 
    B.The program runs and prints "1"; 
    C.The program runs but aborts with an exception; 
    D.An error "possible undefined variable" at line 4 cause compilation to fail; 
    E.An error "possible undefined variable" at line 9 cause compilation to fail; 




请选择: A B C D E

第19题(id号=384):

Consider the following code: What will be printed?
public class EqualsTest{
   public static void main(String[]args){
     if ("john" == "john")
       System.out.println(""john" == "john"");
     if("john".equals("john"));
       System.out.println(""john".equals("john")");
}
}
A. john == john
B. "john" == "john" "john".equals "john"
C. john == john john.equals john
D. john.equals john
E. "john" == "john"
F. "john".equals "john"


请选择: A B C D E F

第20题(id号=49):

Which fragments are correct in Java source file?
  A. package testpackage;
  public class Test{//do something...}

  B. import java.io.*;
  package testpackage;
  public class Test{// do something...}

  C. import java.io.*;
  class Person{// do something...}
  public class Test{// do something...}

  D. import java.io.*; 
   import java.awt.*;
  public class Test{// do something...}
 


请选择: A B C D

第21题(id号=701):

Given:

public class Foo {
   Foo() {System.out.print("foo");}
   class Bar{
      Bar() {System.out.print("bar");}
      public void go() {System.out.print("hi");}
   }
   public static void main(String[] args) {
      Foo f = new Foo ();
      f.makeBar();
   }
   void makeBar() {
     (new Bar() {}).go();
   }
}

What is the result?

A. Compilation fails.

B. An error occurs at runtime.

C. foobarhi 

D. barhi 

E. hi 

F. foohi 


请选择: A B C D E F

第22题(id号=274):

What type of object is the parameter for all methods of the MouseListener interface?
A. MouseEvent
B. KeyEvent
C. ActionEvent


请选择: A B C

第23题(id号=305):

If a font with variable width is used to construct the string text
for a column, the initial size of the column is:
A. determined by the number of characters in the string, multiplied by
   the width of a character in this font
B. determined by the number of characters in the string, multiplied by
   the average width of a character in this font
C. exclusively determined by the number of characters in the string
D. undetermined


请选择: A B C D

第24题(id号=325):

What is the result of executing the following code, using the parameters 4 and 0:
public void divide(int a, int b) {
 try {
   int c = a / b;
 } catch (Exception e) {
     System.out.print("Exception ");
} finally {
     System.out.println("Finally");
}
A. Prints out: Exception Finally
B. Prints out: Finally
C. Prints out: Exception
D. No output
Select the most appropriate answer.


请选择: A B C D

第25题(id号=260):

Consider the code below.
void myMethod(){
 try{
   fragile() ;
 }catch(NullPointerException npex){
   System.out.println("NullPointerException thrown ");
 }catch(Exception ex){
   System.out.println("Exception thrown ");
 }finally{
    System.out.println("Done with exceptions ");
 }
    System.out.println("myMethod is done");
 }
What is printed to standard output if fragile() throws an IllegalArgumentException?
A. "NullPointerException thrown"
B. "Exception thrown"
C. "Done with exceptions"
D. "myMethod is done"
E. Nothing is printed


请选择: A B C D E

第26题(id号=22):

Given the following incomplete method: 
   1) public void method(){ 
   2) 
   3) if (someTestFails()){ 
   4) 
   5) } 
   6) 
   7) } 
   You want to make this method throw an IOException if,and only if,the method
       someTestFails() returns a value of true. 
   Which changes achieve this? 
   A. Add at line 2:IOException e; 
   B. Add at line 4:throw e; 
   C. Add at line 4:throw new IOException(); 
   D. Add at line 6:throw new IOException(); 
   E. Modify the method declaration to indicate that an object of type Exception
        might be thrown. 


请选择: A B C D E

第27题(id号=45):

Which statements about Java code security are true?
  A. The bytecode verifier loads all classes needed for the execution of a program.
  B. Executing code is performed by the runtime interpreter.
  C. At runtime the bytecodes are loaded, checked and run in an interpreter.
  D. The class loader adds security by separating the namespaces for the classes of 
       the local file system from those imported from network sources.
  


请选择: A B C D

第28题(id号=703):

Given:

 1. public class HorseTest {
 2.   public static void main(String [] args) {
 3.    class Horse {
 4.       public String name;
 5.       public Horse(String s) {
 6.         name = s;
 7.       }
 8.     }
 9.     Object obj = new Horse("Zippo");
10.     Horse h = (Horse) obj;
11.     System.out.println(h.name);
12.   }
13. }


What is the result?

A. An exception occurs at runtime at line 10.

B. Zippo 

C. Compilation fails because of an error on line 3.

D. Compilation fails because of an error on line 9.

E. Compilation fails because of an error on line 10.

F. Compilation fails because of an error on line 11.


请选择: A B C D E F

第29题(id号=723):

Given:

1. // insert code here
2. class StatTest {
3.   public static void main(String[] args) {
4.     System.out.println(Integer.MAX VALUE);
5.   }
6. }

hich, inserted independently at line 1, compiles? (Choose all that apply.)

A. import static java.lang; 

B. import static java.lang.Integer; 

C. import static java.lang.Integer.*; 

D. import static java.lang.Integer.* VALUE; 

E. import static java.lang.Integer.MAX_VALUE; 

F. None of the above statements are valid import syntax.


请选择: A B C D E F

第30题(id号=295):

Consider the following code sample:
class Tree{}
class Pine extends Tree{}
class Oak extends Tree{}
public class Forest {
  public static void main (String [] args){
   Tree tree = new Pine():
   if( tree instanceof Pine )
     System.out.println ("Pine");
   if( tree instanceof Tree )
     System.out.println ("Tree");
   if( tree instanceof Oak )
     System.out.println ( "Oak" );
   else
     System.out.println ("Oops ");
  }
}
Select all choices that will be printed:
A. Pine
B. Tree
C. Forest
D. Oops
E. Nothing will be printed


请选择: A B C D E

第31题(id号=333):

What is the name of the interface that can be used to define a class that can execute
within its own thread?
A. Runnable
B. Run
C. Threadable
D. Thread
E. Executable
Select the most appropriate answer.


请选择: A B C D E

第32题(id号=583):

1)public class Foo{ 
2) public static void main(String args[]){ 
3) String s; 
4) System.out.println("s="+s); 
5)  } 
6) } 
 what is the result? 
A. The code compiles and “s=” is printed.
B. The code compiles and “s=null” is printed.
C. The code does not compile because string s is not initialized. 
D. The code does not compile because string s cannot be referenced.
E. The code compiles, but a NullPointerException is thrown when toString is called.



请选择: A B C D E

第33题(id号=683):

Given:

public static void before () {
  Set set = new TreeSet();
  set.add("2");
  set.add(3);
  set.add("1");
  Iterator it = set.iterator();
    while (it.hasNext())
  System.out.print(it.next() + " ");
}

Which of the following statements are true?

A. The before() method will print 1 2 

B. The before() method will print 1 2 3 

C. The before() method will print three numbers, but the order cannot be determined.

D. The before() method will not: compile.

E. The before() method will throw an exception at runtime.


请选择: A B C D E

第34题(id号=58):

Given the following class:
  public class Sample{
  long length;
  public Sample(long l){ length = l; }
  public static void main(String arg[]){
  Sample s1, s2, s3;
  s1 = new Sample(21L);
  s2 = new Sample(21L); 
  s3 = s2;
  long m = 21L;
  }
  } 

Which expression returns true?
  A. s1 == s2;
  B. s2 == s3;
  C. m == s1;
  D. s1.equals(m).


请选择: A B C D

第35题(id号=718):

Given:

public static synchronized void main(String[] args) throws
 InterruptedException {
    Thread t = new Thread();
    t.start () ;
    System.out.print ("X") ;
    t.wait (10000) ;
    System.out.print("Y");
}

What is the result of this code?

A. It prints X and exits.

B. It prints X and never exits.

C. It prints XY and exits almost immeditately.

D. It prints XY with a 10-second delay between X and Y.

E. It prints XY with a 10000-second delay between X and Y.

F. The code does not compile.

G. An exception is thrown at runtime.


请选择: A B C D E F G

第36题(id号=64):

What is the result when you compile and run the following code?

public class Test
{
    public void method()
    {
        for(int i = 0; i < 3; i++)
        {
            System.out.print(i);
        }
        System.out.print(i);
    }
}

A. 0122
B. 0123
C. Compilation error
D. None of these


请选择: A B C D

第37题(id号=159):

 which two statements declare an array capable of 10 ints? 
  A. int[] foo; 
  B. int foo[]; 
  C. int foo[10]; 
  D. Object[] foo; 
  E. Object foo[10]


请选择: A B C D E

第38题(id号=129):

float f=4.2F;
Float g=new Float(4.2F);
Double d=new Double(4.2);
Which are true?
A. f==g   B. g==g   C. d==f   D. d.equals(f)  E d.equals(g)  F. g.equals(4.2);


请选择: A B C D E F

第39题(id号=292):

Given this code snippet:
   double a=90.7;
   double b=method(a);
   System.out.println(b);

If this snippet displays 90.0 in the standard output,what Math method did method()
   invoke?
A.  Math.abs(a)
B.  Math.min(a)
C.  Math.floor(a)
D.  Math.round(a)
E.  Math.ceil(a)


请选择: A B C D E

第40题(id号=522):

Which statements concerning the methods notify() and notifyAll() are true? 

A) Instances of class Thread have a method called notify(). 
B) A call to the method notify() will wake the thread that currently 
   owns the monitor of the object. 
C) The method notify() is synchronized. 
D) The method notifyAll() is defined in class Thread. 
E) When there is more than one thread waiting to obtain the monitor of 
   an object, there is no way to be sure which thread will be notified 
   by the notify() method. 


请选择: A B C D E

第41题(id号=369):

public class ExceptionTest{
  public static void main(String [] args){
    ExceptionTest e = new ExceptionTest();
    e.trythis();
  }

  public void trythis(){
    try{
      System.out.println("1");
      problem();
    }catch (RuntimeException x){
      System.out.println("2");
      return;
    }catch(Exception x){
      System.out.println("3");
      return;
   }finally{
      System.out.println("4");
   }
      System.out.println("5");
   }

 public void problem() throws Exception{
     throw new Exception();
 }
}
A. 1
B. 2
C. 3
D. 4
E. 5


请选择: A B C D E

第42题(id号=726):

Given two files:

a=b.java
c_d.class

Are in the current directory, which command-line invocation(s) could 
complete without error? (Choose all that apply.)

A. java -Da=b c_d 

B. java -D a=b c_d 

C. javac -Da=b c_d 

D. javac -D a=b c_d 


请选择: A B C D

第43题(id号=389):

Consider the following code: What will be printed?
public class charTest2{
  public static void main(String[] args){
   int y = 020;
   char b = 'u0010'
   if(b==y)
     System.out.println("Char 'u0010' = 16.0");
  }
}
A. Nothing will be printed.
B. Compilation error. The char variable cannot be assigned this way.
C. Char 'u0010' = 16.0
D. Compilation error. The int variable cannot be assigned this way.
E. Compilation error. The char variable cannot be assigned this way.


请选择: A B C D E

第44题(id号=312):

What will be the result of compiling the following code:
public class Test {
  static int age;
  public static void main (String args []) {
  age = age + 1;
  System.out.println("The age is " + age);
} }
A. Compiles and runs with no output
B. Compiles and runs printing out The age is 1
C. Compiles but generates a runtime error
D. Does not compile
E. Compiles but generates a compile time error
Select the most appropriate answer.


请选择: A B C D E

第45题(id号=512):

Which code fragments will succeed in printing the last argument given on 
the command line to the standard output, and exit gracefully with no 
output if no arguments are given? 

CODE FRAGMENT A: 
public static void main(String args[]) { 
  if (args.length != 0) 
    System.out.println(args[args.length-1]); 
  } 

CODE FRAGMENT B: 
public static void main(String args[]) { 
   try { System.out.println(args[args.length]); } 
     catch (ArrayIndexOutOfBoundsException e) {} 


CODE FRAGMENT C: 
public static void main(String args[]) { 
  int ix = args.length; 
  String last = args[ix]; 
  if (ix != 0) System.out.println(last); 


CODE FRAGMENT D: 
public static void main(String args[]) { 
  int ix = args.length-1; 
  if (ix > 0) System.out.println(args[ix]); 


CODE FRAGMENT E: 
public static void main(String args[]) { 
   try { System.out.println(args[args.length-1]); } 
      catch (NullPointerException e) {} 
   } 

A) Code fragment A. 
B) Code fragment B. 
C) Code fragment C. 
D) Code fragment D. 
E) Code fragment E. 


请选择: A B C D E

第46题(id号=331):

What class must an inner class extend:
A. The top level class
B. The Object class
C. Any class or interface
D. It must extend an interface
Select the most appropriate answer.


请选择: A B C D

第47题(id号=689):

Given:

import java.util.*;
public class Group extends HashSet<Person> {
    public static void main(String[] args) {
        Group g = new Group () ;
        g.add(new Person("Hans"));
        g.add(new Person("Lotte"));

        g.add(new Person("Jane"));
        g.add(new Person("Hans"));
        g.add(new Person("Jane"));
        System.out. printIn ("Total: " + g.size() );
    }
    public boolean add(Object o) {
        System.out.println("Adding: " + o) ;
        return super.add(o);
    }
}
class Person {
    private final String name;
    public Person(String name) { this.name = name; }
    public String toString() { return name; }
}

Which of the following occur at least once when the code is compiled and run? 
(Choose all that apply.)

A. Adding Hans 

B. Adding Lotte 

C. Adding Jane 

D. Total: 3 

E. Total : 5 

F. The code does not compile.

G. An exception is thrown at runtime.


请选择: A B C D E F G

第48题(id号=609):

Which expressions are illegal?
Select all valid answers.
a) (true & true)
b) (4 & 5)
c) (int myInt = 0 > 3)
d) float myFloat = 40.0;
e) boolean b = (boolean)99;


请选择: A B C D E

第49题(id号=518):

Which method implementations will write the given string to a 
file named "file", using UTF8 encoding? 

IMPLEMENTATION A: 
public void write(String msg) throws IOException { 
  FileWriter fw = new FileWriter(new File("file")); 
  fw.write(msg); 
  fw.close(); 


IMPLEMENTATION B: 
public void write(String msg) throws IOException { 
  OutputStreamWriter osw = 
  new OutputStreamWriter(new FileOutputStream("file"), "UTF8"); 
  osw.write(msg); 
  osw.close(); 


IMPLEMENTATION C: 
public void write(String msg) throws IOException { 
  FileWriter fw = new FileWriter(new File("file")); 
  fw.setEncoding("UTF8"); 
  fw.write(msg); 
  fw.close(); 


IMPLEMENTATION D: 
public void write(String msg) throws IOException { 
  FilterWriter fw = FilterWriter(new FileWriter("file"), "UTF8"); 
  fw.write(msg); 
  fw.close(); 


IMPLEMENTATION E: 
public void write(String msg) throws IOException { 
  OutputStreamWriter osw = new OutputStreamWriter( 
    new OutputStream(new File("file")), "UTF8" ); 
    osw.write(msg); 
    osw.close(); 


A) Implementation A. 
B) Implementation B. 
C) Implementation C. 
D) Implementation D. 
E) Implementation E. 


请选择: A B C D E

第50题(id号=249):

What is true about the garbage collection?
A. The garbage collector is very unpredictable.
B. The garbage collector is predictable.


请选择: A B

第51题(id号=557):

Which layout manager is used when the frame is resized the buttons's
 position in the Frame might be changed? 
  A. BorderLayout
  B. FlowLayout
  C. CardLayout
  D. GridLayout 


请选择: A B C D

第52题(id号=469):

What is the requirement of the class which implements the following Interface
 public interface Test {
   void someMethod();
 }
Select all correct answers
a. Should have someMethod which must be necessarily declared as public.
b. Should have someMethod which could be "friendly" or public
c. Should have someMethod which should not throw any checked exceptions.
d. Should have someMethod which cannot be sychronized as 
   sychronized is not in the signature of the interface definition.


请选择: A B C D

第53题(id号=528):

Which statements concerning the event model of the AWT are true? 

A) At most one listener of each type can be registered with a component. 
B) Mouse motion listeners can be registered on a List instance. 
C) There exists a class named ContainerEvent in package java.awt.event. 
D) There exists a class named MouseMotionEvent in package java.awt.event. 
E) There exists a class named ActionAdapter in package java.awt.event. 


请选择: A B C D E

第54题(id号=508):

Given two collection objects referenced by col1 and col2, which of 
these statements are true? 

A) The operation col1.retainAll(col2) will not modify the col1 object. 
B) The operation col1.removeAll(col2) will not modify the col2 object. 
C) The operation col1.addAll(col2) will return a new collection object, 
    containing elements from both col1 and col2. 
D) The operation col1.containsAll(Col2) will not modify the col1 object. 


请选择: A B C D

第55题(id号=519):

Which are valid identifiers? 

A) _class 
B) $value$ 
C) zer@ 
D) ¥ngstr 
E) 2muchuq 


请选择: A B C D E

第56题(id号=82):

Give this class outline: 
class Example{ 
private int x; 
//rest of class body… 

Assuming that x invoked by the code java Example, which statement can made x be  
    directly 
    accessible in main() method of Example.java? 
A. Change private int x to public int x 
B. change private int x to static int x 
C. Change private int x to protected int x 
D. change private int x to final int x 


请选择: A B C D

第57题(id号=303):

In the list below, which subclass(es) of Component cannot be directly instantiated:
A. Panel
B. Dialog
C. Container
D. Frame


请选择: A B C D

第58题(id号=425):

A text field has a variable-width font. It is constructed by calling new  
TextField("iiiii"). What happens if you change the contents of the textfield 
to "wwwww"? 
(NOTE i is one of the narrowest characters, and w is one of the widest.)
a. The text field becomes wider.
b. The text field becomes narrower.
c. The text field stays the same width;
   to see the entire contents you have to scroll using -> and <-.
d. The text field stays the same width;
   to see you need to have a horizontal scroll bar.


请选择: A B C D

第59题(id号=278):

Which of the following describe the sequence of method calls that
result in a component being redrawn?
A. invoke paint() directly
B. invoke update which calls paint()
C. invoke repaint() which invokes update(), which in turn invokes paint()
D. invoke repaint() which invokes paint() directly


请选择: A B C D

第60题(id号=166):

 import java.io.IOException; 
     public class ExceptionTest{ 
     public static void main(String args[]){ 
      try{ 
          methodA(); 
         }catch(IOException e){ 
         System.out.println("Caught Exception"); 
         } 
         } 
      public void methodA(){ 
       throw new IOException(); 
       } 
       } 
      what is the result? 
      A.The code will not compile 
      B.The output is Caught Exception 
      C.The output is Caught IOException 
      D.The program executes normally without printing a message 


请选择: A B C D


如果你想交卷,请点击提交按钮: