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

SCJP模拟试题[1](1)

添加时间: 2007-9-23 1:49:21  作者: JAVA题库  阅读次数:60   来源: http://www.d9soft.com

       

此套试题由60道题组成(实际考试为60道题)。

试题由单选题和多选题组成,单选题将提示:Select the one right answer.,多选题将提示:Select all valid answers.。

实际考试70%为通过,因此您必须在此套模拟试题中答对42题。

Question 1: Given the following class definition:
class A {
   protected int i;
   A(int i) {
      this.i = i;
   }
}
Which of the following would be a valid inner class for this class?

Select all valid answers.

a)

class B {
}
b)

class B extends A {
}
c)

class B {
   B() {
      System.out.println("i = " + i);
   }
}
d)

class B {
   class A {
   }
}
e)

class A {
}

-----------------------------------
Question 2: What statements are true concerning the method notify() that is used in conjunction with wait()?
Select all valid answers.

a) if there is more than one thread waiting on a condition, only the thread that has been waiting the longest is notified

b) if there is more than one thread waiting on a condition,there is no way to predict which thread will be notifed

c) notify() is defined in the Thread class

d) it is not strictly necessary to own the lock for the object you invoke notify() for

e) notify() should only be invoked from within a while loop

------------------------------------
Question 3: Given the following class:
class Counter {
   public int startHere = 1;
   public int endHere = 100;
   public static void main(String[] args) {
      new Counter().go();
   }
   void go() {
      // A
      Thread t = new Thread(a);
      t.start();
   }
}
What block of code can you replace at line A above so that this program will count from startHere to endHere?

Select all valid answers.

a)
Runnable a = new Runnable() {
   public void run() {
      for (int i = startHere; i <= endHere; i++) {
         System.out.println(i);
      }
   }
};

b)

a implements Runnable {
   public void run() {
      for (int i = startHere; i <= endHere; i++) {
         System.out.println(i);
      }
  }
};

c)
Thread a = new Thread() {
   public void run() {
      for (int i = startHere; i <= endHere; i++) {
         System.out.println(i);
      }
   }
};

-----------------------------------
Question 4: What is written to the standard output given the following statement:
System.out.println(4 7);
Select the one right answer.

a) 4

b) 5

c) 6

d) 7

e) 0


-------------------------------------
Question 5: Given the following class:
class Counter {
   public static void main(String[] args) {
      Thread t = new Thread(new CounterBehavior());
      t.start();
   }
}
Which of the following is a valid definition of CounterBehavior that would make Counter’s main() method count from 1 to 100, counting once per second?

Select the one right answer.

a)This class is an inner class to Counter:

class CounterBehavior {
   for (int i = 1; i <= 100; i++);
      try {
         System.out.println(i);
         Thread.sleep(1000);
      } catch (InterruptedException x) {}
   }
}

b) This class is an inner class to Counter:

class CounterBehavior implements Runnable {
   public void run() {
      for (int i = 1; i <= 100; i++);
         try {
            System.out.println(i);
            Thread.sleep(1000);
         } catch (InterruptedException x) {}
      }
   }
}

c) This class is a top-level class:

static class CounterBehavior implements Runnable

  public void run() {
      try {
         for (int i = 1; i <= 100; i++) {
            System.out.println(i);
            Thread.sleep(1000);
         }
      } catch (InterruptedException x) {}
   }
}


------------------------------------
Question 6: Given the following class definition:
class A {
   public int x;
   private int y;
   class B {
      protected void method1() {
      }
      class C {
         private void method2() {
         }
      }
   }
}

class D extends A {
   public float z;
}
 

What can method2() access directly, without a reference to another instance?

 

Select all valid answers.

a) the variable x defined in A

b) the variable y defined in A

c) method1 defined in B

d) the variable z defined in D


------------------------------
Question 7: You have an 8-bit file using the character set defined by ISO 8859-8. You are writing an application to display this file in a TextArea. The local encoding is already set to 8859-8. How can you write a chunk of code to read the first line from this file?
You have three variables accessible to you:

myfile is the name of the file you want to read
stream is an InputStream object associated with this file
s is a String object
Select all valid answers.

a)

InputStreamReader reader = new InputStreamReader(stream, "8859-8");
BufferedReader buffer = new BufferedReader(reader);
s = buffer.readLine();
b)

InputStreamReader reader = new InputStreamReader(stream);
BufferedReader buffer = new BufferedReader(reader);
s = buffer.readLine();
c)

InputStreamReader reader = new InputStreamReader(myfile, "8859-8");
BufferedReader buffer = new BufferedReader(reader);

s = buffer.readLine();
d)

InputStreamReader reader = new InputStreamReader(myfile);
BufferedReader buffer = new BufferedReader(reader);
s = buffer.readLine();
e)

FileReader reader = new FileReader(myfile);
BufferedReader buffer = new BufferedReader(reader);
s = buffer.readLine();

--------------------------------
Question 8: How can you write a line of code for an applet’s init() method that determines how wide the applet is?
Select all valid answers.

a) int width = this.getY();
b) int width = this.getSize().w;
c) int width = getSize();
d) int width = getSize().w;
e) int width = getWidth();
-------------------------------

Question 9: For a variable width font, how "wide" is a TextField created using the expression:
new TextField(20)
Select the one right answer.

a) 20 times the average of all the characters in the font used for this TextField object

b) 20 times the width of the letter M

c) 20 times the width of the letter a

d) 20 inches

e) 20 picas
-----------------------------------------------

Question 10: Given this interface definition:
interface A {
   int method1(int i);
   int method2(int j);
}
which of the following classes implement this interface and is not abstract?

Select all valid answers.

a)
class B implements A {
   int method1() { }
   int method2() { }
}

b)
class B {
   int method1(int i) { }
   int method2(int j) { }
}

c)
class B implements A {
   int method1(int i) { }
   int method2(int j) { }
}

d)
class B extends A {
   int method1(int i) { }
   int method2(int j) { }
}

e)
class B implements A {
   int method2(int j) { }
   int method1(int i) { }
}
--------------------------------------------

Question 11: Given the following code:
import java.awt.*;
import java.awt.event.*;
public class MyApplet extends java.applet.Applet {
   public void init() {
      Button b = new Button("Button1");
      b.addMouseListener(new ClickHandler());

 

上下文章:

 

上一篇文章: Java认证模拟题及分析(3) 下一篇文章: SCJP模拟试题[1](2)

相关文章:

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

相关软件:

  • 全国计算机等级考试模拟软件(2006年全年使用)二级Visual Basic V9.0
  • 白金模拟炒股平台 V3.6
  • 全国计算机等级考试第21次全真模拟系统 20050311
  • 全国专业技术人员计算机应用能力考试模拟 2.1
  • 中考物理试卷分类试题 4.1
  • 计算机等级考试训练模拟软件(三级网络技术) V1.04

 

快速导航

  • 网络学院
  • 精品汇聚
  • 字体下载
  • 教程下载
  • 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题库阅读排行

  • SCJP Mock Exam 2(2)
  • JAVA题库:考考你4
  • JAVA题库:考考你2
  • Java认证模拟题及分析(3)
  • SCJP考试真题和解析[1](2)
  • Java认证模拟题及分析(1)
  • JAVA题库:格林模拟试题一(上)(2)
  • SCJP模拟试题[2](3)
  • SCJP模拟试题[2](1)
  • SCJP考试真题和解析[1](1)

JAVA认证阅读总排行

  • SCJP Mock Exam 2(2)
  • JAVA题库:考考你4
  • JAVA题库:考考你2
  • Java认证模拟题及分析(3)
  • SCJP考试真题和解析[1](2)
  • Java认证模拟题及分析(1)
  • 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 第九软件网 版权所有