SCJP考题15

转载 2007年10月13日 15:44:00

22. A Java array is an ordered collection of three kinds of things. What are they?

Fill in the blank.

正确答案:primitives. object references, references to other arrays.

 

 

20. There are seven characters, at least one of which must be included to indicate a floating point literal. What are they?

Fill in the blank.

正确答案:'E''e', 'F', 'f', 'D', 'd', '.'

 

 

18. Show six different ways to express the decimal value 28 as an integral(完整的) literal.(文字的,照字面上的)

Fill in the blank.

正确答案:28034, 0x1c, 0x1C, 0X1c, 0X1C

 

 

4. How you can use the escape notation u to set the variable c, declared as a char, to the Unicode character whose value is hex 0X30A0?

Fill in the blank.

正确答案:C=/u30a0;

 

 

 

 

10.What output is produced by the following program?

class Test{

public static void main(String args[]){

long size=10;

int[]array=new int[size];

size=20;

System.out.println(array.length);

}

}

Select the one right answer.

A. A compiler error.

B. A runtime error.

C. 10

D. 20

正确答案:A

 

 

 

28. What output is produced by the following program? Note that the main() method is not declared public.

class Test{

static void main(String args[]){

System.out.println("OK");

}

}

Select the one right answer.

A. A compiler error.

B. A runtime error.

C. OK

正确答案: C

 

 

29. What output is produced by the following program? Note that the main() method is not declared static.

class Test{

public void main(String args[]){

System.out.println("OK");

}

}

Select the one right answer.

A. A compiler error.

B. A runtime error.

C. OK

正确答案: B

 

 

 

33. True or false? In Java primitives(原始的) are passed by value and objects are passed by reference.

Fill in the blank.

正确答案: False

 

 

 

 

30. What is the purpose of the reference to the array of String references in the argument list of the main() method?

Fill in the blank.

正确答案: Thansfer of command-line arguments

 

 

 

500. Examine the following code which includes an inner class:

public final class Test implements A{

class Inner{

void test(){

if (!Test.this.flag);{

sample();

}

}

private boolean flag = false;

}

publi void sample(){

System.out.println("Sample");

}

public Test(){

(new Inner()).test();

}

public static void main(String args[]){

new Test();

}

}

What is the result?

A. Print out "Sample"

B. Program produces no output but terminates correctly.

C. Program does not terminate.

D. The program will not compile

正确答案: A

 

 

 

 

511. What appears in the standard output if the method named problem() in the code below throws an instance of class Exception when the method named trythis() is invoked?

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");

}

Select all valid answers.

A. "1"

B. "2"

C. "3"

D. "4"

E. "5"

正确答案: ACD

 

 

 

 

 

513. Analyze the following code.

void looper(){

int x=0;

one:

while(x<10){

two:     非法标号

System.out.println(++x);

if(x > 3)

break two;

}

}

Select all valid answer.

A. This code compiles

B. This code does not compile

C. This code writes the number 0 to the standard output

D. The numbers 1 and 2 to the standard outout

E. The numbers 3 and to the standard outout

F. The numbers 4 to the standard outout

G. The numbers 5 through 9 to the standard outout

H. The numbers 10 to the standard outout

正确答案: B

 

 

 

 

520.What code placed after the comment //For loop

would populate the elements of the array ia[] with values of the variable i?

public class Test{

public static void main(String argv[]){

Test 1=new Test();

1.amethod();

}

public void anethod(){

int ia[]=new int[4];

//Start For loop

{

ia[i]=i;

System.out.println(ia[i]);

}

}

}

Select the one right answer.

A. for(int i=0;i<ia.length()-1;i++)

B. for(int i=0;i<ia.length();i++)

C. for(int i=1;i<4.i++)

D. for(int i=0;i<ia.length;i++)

正确答案: D

 

 

 

 

 

523. What will happen when you attempt to compile and run the following code?

public class Test{

static public long i=10;

public static void main(String argv[]){

switch(i){

default:

System.out.println("no value given");

case 1:

System.out.println("one");

case 10:

System.out.println("ten");

case 5):

System.out.println("five");

}

}

}

Select the one right answer.

A. Compile time error

B. Output of "ten"followed by "five"

C. Output of "ten"

D. Compilation and run time error because of location of default

正确答案: A

 

 

 

 

 

525. The thread run() method has the following code, what is the result when the thread runs?

try{

sleep(200); 不会扔出一个IOException

System.out.println("Printing from thread run()method");

}catch(IOException ie){}

Selet the one right answer.

A. Compile time error

B. Prints on the console Printing from thread run() method

C. At line 2 the thread will be stop running and resumes after 200 milliseconds and prints Printing from thread run() method

D. At line 2 the thread will be stop running and resumes exactly 200 milliseconds elapsed

正确答案: A

 

 

 

 

 

534. Given the incompleted method:

//line 1

{

success = connect();

if (success==-1){

throw new TimedOutException();

}

}

TimedOutException is not a RuntimeException. Which can complete the method of declaration when added at line 1?

A. public void method()

B. public void method() throws Exception

C. public void method() throws TimedOutException

D. public void method() throw TimedOutException

E. public throw TimedOutException viod method()

正确答案: BC

 

 

 

 

 

 

542. Given the following code:

class Test{

public static void main(String args[]){

System.out.println(hai());

}

static int hai(){

try{

return 1;

}

catch(Exception e){

System.out.println("Exception");

}

finally{

System.out.println("Finally");

Return  2;

}

}

}

What will be the out put?

A. Compilation Error void main Can't return any value.

B. Prints Exception.

C. Prints Exception Finally.

D. Prints Finally and 1.

E. Prints Finally and 2.

正确答案:E

 

 

SCJP的一些感悟!

终于在上个星期六过了SCJP,可惜只有69%!还是说说我准备考试的过程吧。   本人没有Java的实际开发经验(但有三五年的C++和Delphi开发经验,对OOP比较熟悉),为了考这试,准备了一个月...
  • u012402926
  • u012402926
  • 2016年03月30日 17:57
  • 149

多线程学习(四)线程的交互

转自:http://lavasoft.blog.51cto.com/62575/99157 Java线程:线程的交互   SCJP5学习笔记   线程交互是比较复杂的问题,SCJP要求不很...
  • qq_21909121
  • qq_21909121
  • 2016年05月31日 11:54
  • 360

ccf试题 工资计算

问题描述   小明的公司每个月给小明发工资,而小明拿到的工资为交完个人所得税之后的工资。假设他一个月的税前工资(扣除五险一金后、未扣税前的工资)为S元,则他应交的个人所得税按如下公式计算: ...
  • wqy20140101
  • wqy20140101
  • 2017年01月31日 16:59
  • 854

SCJP认证考试题集

http://wenku.baidu.com/view/a6585824a5e9856a5612606f.html?re=view 310-055SCJIP认证考试题集 Que...
  • xunmeng2002
  • xunmeng2002
  • 2015年06月29日 17:47
  • 855

读SCJP认识一下Java(一)

1. 定义了类、对象、属性、方法等,很明了直接: 2.关于变量名的合法定义的约定: 1、只能第一个字符,只能使用$符、字母、下划线开始,而不能使用数字;2、第一个字符后面没有限制,...
  • u012845809
  • u012845809
  • 2015年06月03日 17:30
  • 355

历年系统架构设计师考试之设计模式试题-2012年

2012年系统架构设计师考试下午试题中出现了一道25分的设计模式大题,上午仍旧是5道选择题,可以说是从2009年开考以来设计模式试题量最多的一年。Sunny友情建议:建议大家先做做这些试题,看是否能够...
  • LoveLion
  • LoveLion
  • 2014年03月17日 22:11
  • 15311

python生成随机的测验试卷

问题描述 假如你是一名老师,班上有45名同学,想要给他们进行一次测验,但又怕学生作弊,所以就想随机生成45份试卷,试卷题目都一样,只是随机打乱试题和答案顺序。 思路: 1.将所有题目和答...
  • tanggangzuiniu12
  • tanggangzuiniu12
  • 2018年01月11日 17:32
  • 28

寻址方式——汇编学习笔记(三)

操作数寻址方式有多种,其目的是缩短指令长度,扩大寻址空间,提高编程的灵活性。最基本的寻址方式有如下几种。    (1)隐含寻址            在指令中并不直接给出操作数...
  • cqkxboy168
  • cqkxboy168
  • 2013年05月30日 14:18
  • 507

考试篇(5.2) NSE4 题库 01. 入门 ❀ 飞塔 (Fortinet) 网络安全专家

Fortinet 飞塔网络安全专家 (4) 考试共 120 分钟,共 60 道英文选择题,答对 70% 计 42 道题为合格。...
  • meigang2012
  • meigang2012
  • 2017年04月23日 13:18
  • 806

SCJP之String的对象的相同与否

public class StringB {     public static void main(String[] args) {        String a ="JAVA...
  • janeness
  • janeness
  • 2014年04月23日 11:29
  • 418
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:SCJP考题15
举报原因:
原因补充:

(最多只允许输入30个字)