Sybase的一套比試題-java版本-轉載

Sybase的一套比試題(1小時完成)。這個是JAVA版的,大家一起來做做,中文是我爲了看清楚自己翻譯的,翻譯得很爛
請大家多講講原理共同提高 而不是簡單給出答案 謝謝!

題目1: One team tries to buy several bottle of drinks for 27 athletes. In ABC store three empty bottles can be exchanged

with one new bottle of drinks. Which of the following numbers is the minimal one that the team should buy for the 27

athletes?(一個隊伍想要買幾瓶飲料給27名運動員喝。在某商店規定3個空瓶可以換1瓶飲料,那麼給27名運動員如果每人喝一瓶的話,最少要

買幾瓶)
A 17
B 18
C 19
D 20


題目2: How can you create a listener class that receives events when the mouse is moved(single Answer)(單選:如何創建一個聽

者類,能做到當老鼠開始移動時,接收事件)
A By extending MouseListener(通過繼承爲老鼠聽者)[不知道extending是不是翻譯成繼承 ?]
B By implementing MouseListener(通過實現老鼠聽者接口)
C By extending Mouse Motion Listener(通過繼承老鼠移動聽者)
D By implementing Mouse Motion Listener(通過實現老鼠移動聽者接口)
E Either by extending Mouse Motion Listener  or extending MouseListener(通過繼承爲老鼠聽者或繼承爲老鼠移動聽者)
F Either by implementing Mouse Motion Listener  or  implementing MouseListener(通過實現老鼠移動聽者接口或實現老鼠聽者接口)


題目3: You are assign the task of building a panel containing a TextArea at the top, a label directly below it, and a button

directly below the label. If the three components are added directly to the panel, which layout manager can be panel use to

ensure that the TextArea absorbs all of the free vertical space when the parel is resized? (你被要求實現如下任務:1創建一個面板;2在面板頂部包含一個TextArea,TextArea底下是一個label,label底下是一個button。如果這三個組件直接加到面板,which layout manager can be panel use to ensure that the TextArea absorbs all of the free vertical space when the parel is resized?)[這句話實在不知道咋翻譯]


題目4: Which are not containers in Java?(Multiple answer)(多選:下面哪幾個不是java所包含的)
A ScollPane
B Canvas
C Scrollbar
D Applet
E Dialog

題目5:You need to store elements in a collection that 
guarantees that no duplicates are stored and all elements 
can be access in nature order, which interface provides 
that capability?(你需要存儲元素到某種數據結構中,而且要確保元素中在自然隊列中沒有重複,下面哪個接口能保證這種能力)
A java.uil.Map
B java.util.Collection
C java.util.List
D java.util.SortedSet
E java.util.SortedMap
F java.util.Set


題目6:What will happen when you attempt to compile and run this (當你嘗試編譯以及運行這段代碼時)
code?

abstract class Base{
  abstract public void myfunc();
public class Abs extends Base{
public static void main(String argv[])
{
  Abs a = new Abs();
  a.amethod();
}
public void amethod(){
  System.out.println("A method");;
}
}

A The code will compile and run, printing out the words "A 
method"(這段程序能夠編譯且運行,打印"A method")
B The compiler will complain errors in Base class.(這段程序在Base class編譯報錯)

C The code will compile but complain at run time that the 
Base class has none abstract methods.(這段程序編譯通過,運行時會報錯說沒有抽象方法)
D The compiler will complain errors in Abs class.(這段程序在Abs class編譯報錯)

題目7: Description(下列程序輸出結果是什麼?闡述原理)
import java.util.*;


public class Test
{
  private String value = null;
  public Test(String v)
  {
  value = v;
  }
  public boolean equals(Test o)
  {
  if(o==this) return true;
  if(o instanceof Test)
  {
  Test test =(Test) o;
  return value.equals(test.value);
  }
  return false;
  }
  public static void main(String[] args)
  {
  List list = new ArrayList();
  Test test1 = new Test("object");
  Test test2 = new Test("object");
  Test test3 = new Test("object");
  Object test4 = new Test("object");
  list.add(test1);

  System.out.println(list.contains(test2));
  System.out.println(test2.equals(test3));
  System.out.println(test3.equals(test4));

  }
}


題目8:
Which of the following is NOT true regarding to RuntimeException?(下面關於運行時異常說法錯誤的是)
A RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtul

Machine.(運行時異常是那些異常的一個超類,Java虛擬機)
B A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the

execution of the method but not caught.(一個方法不要求聲明拋出他的運行時異常的子句和子類,可以只是執行語句而不去捕捉這些異常


C An RuntimeException is a subclass of Throwable that indicates serious problems that a reasonable application should not try

to catch.(一個運行異常是Throwable的一個子類,能指出嚴重問題,因此一個合理的應用是不應該去捕捉它)
D NullPointerException is one kind of RuntimeException.(NullPointerException是一種運行時異常)

題目9: Which of the following items demonstrates the key characteristics of Web 2.0(Web2.0的關鍵字特徵是什麼)?
A Centralized
B User centered design
C Open
D Light Weight


題目10: When using the writeObject method to store the state of n 
object, how can you protect sensitive data from being 
accessed in the stored object?(當用writeObject方法儲存n個對象的狀態時,如何保證敏感數據不被存儲對象訪問)
A Implement the Object as Exteralizable(實現對象作爲序列化)
B Declare the sensitive fields as private transisent(聲明敏感域作爲私有transisent)
C Declare the sensitive fields as static transisent (聲明敏感域作爲靜態transisent)
D Declare the sensitive fields as protected transisent(聲明敏感域作爲保護transisent)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章