java程序员认证模拟试题及解析

天将降大任于是人也,必先苦其心志,劳其筋骨,饿其体肤,空乏其身,行拂乱其所为。以下是小编为大家搜索整理的java程序员认证模拟试题及解析,希望能给大家带来帮助!更多精彩内容请及时关注我们应届毕业生考试网!

Java程序员认证模拟题及详细分析(1)

26. Give following class:

class AClass{

private long val;

public AClass(long v){val=v;}

public static void main(String args[]){

AClass x=new AClass(10L);

AClass y=new AClass(10L);

AClass z=y;

long a=10L;

int b=10;

}

}

Which expression result is true?

A. a==b;

B. a==x;

C. y==z;

D. x==y;

E. a==10.0;

27. A socket object has been created and connected to a standard internet service on a remote network server. Which construction give the most suitable means for reading ASCII data online at a time from the socket?

A. InputStream in=s.getInputStream();

B. DataInputStream in=new DataInputstream(s.getInputStream());

C. ByteArrayInputStream in=new ByteArrayInputStream(s.getInputStream());

D. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()));

E. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()),”8859-1”);

28. String s=”Example String”;

Which operation is legal?

A. s>>>=3;

B. int i=s.length();

C. s[3]=”x”;

D. String short_s=s.trim();

E. String t=”root” s;

29. What happens when you try to compile and run the following program?

class Mystery{

String s;

public static void main(String[] args){

Mystery m=new Mystery();

m.go();

}

void Mystery(){

s=”constructor”;

}

void go(){

System.out.println(s);

}

}

A. this code will not compile

B. this code compliles but throws an exception at runtime

C. this code runs but nothing appears in the standard output

D. this code runs and “constructor” in the standard output

E. this code runs and writes ”null” in the standard output 30. What use to position a Button in a Frame ,only width of Button is affected by the Frame size, which Layout Button well be set ?

A. FlowLayout;

B. GridLayout;

C. North of BorderLayout

D. South of BorderLayout

E. East or West of BorderLayout

31. What use to position a Button in a Frame, size of Button is not affected by the Frame size, which Layout Button will be set?

A. FlowLayout;

B. GridLayout;

C. North of BorderLayout

D. South of BorderLayout

E. East or West of BorderLayout

32. An AWT GUI under exposure condition, which one or more method well be invoke when it redraw?

A. paint();

B. update();

C. repaint();

D. drawing();

33. Select valid identifier of Java:

A. userName

B. %passwd

C. 3d_game

D. $charge E. this

34. Which are Java keyword?

A. goto

B. null

C. FALSE

D. native

E. const

35. Run a corrected class: java ?Ccs AClass a b c

Which statement is true?

A. args[0]=”-cs”;

B. args[1]=”a b c”;

C. args[0]=”java”;

D. args[0]=”a”; E. args[1]=?b?

36. Give the following java class:

public class Example{

static int x[]=new int[15];

public static void main(String args[]){

System.out.println(x[5]);

}

}

Which statement is corrected?

A. When compile, some error will occur.

B. When run, some error will occur.

C. Output is zero.

D. Output is null.

37. Give the following java class:

public class Example{

public static void main(String args[]){

static int x[] = new int[15];

System.out.println(x[5]);

}

}

Which statement is corrected?

A. When compile, some error will occur.

B. When run, some error will occur.

C. Output is zero.

D. Output is null.

38. Short answer:

The decimal value of i is 12, the octal i value is:

39. Short answer:

The decimal value of i is 7, the hexadecimal i value is:

40. Which is the range of char?

A. 27~27-1

B. 0~216-1

C. 0~216

D. 0~28 41. Which is the range of int type?

A. -216~216-1

B.- 231~231-1

C. -232~232-1

D. -264~264-1

42. Give the following class:

public class Example{

String str=new String(“good”);

char ch[]={

public static void main(String args[]){

Example ex=new Example();

ex.change(ex.str,ex.ch);

System.out.println(ex.str ”and” ex.ch);

}

public void change(String str,char ch[]){

str=”test ok”;ch[0]=?g?

}

}

Which is the output:

A. good and abc

B. good and gbc

C. test ok and abc

D. test ok and gbc

43. Which code fragments would correctly identify the number of arguments passed via command line to a Java application, exclude the name of the class that is being invoke.

A. int count = args.length;

B. int count = args.length-1;

C. int count=0; while(args[count]!=null)

count ;

D. int count=0;while

(!(args[count].equals(“”))) count ;

44. FilterOutputStream is the parent class for BufferedOutputStream, DataOutputStream and PrintStream. Which classes are valid argument for the constructor of a FilterOutputStream?

A. InputStream

B. OutputStream

C. File

D. RandomAccessFile

E. StreamTokenizer

45. Given a TextArea using a proportional pitch font and constructed like this:

TextArea t=new TextArea(“12345”,5,5);

Which statement is true?

A. The displayed width shows exactly five characters one each line unless otherwise constrained

B. The displayed height is five lines unless otherwise constrained

C. The maximum number of characters in a line will be five

D. The user will be able to edit the character string

E. The displayed string can use multiple fonts

46. Given a List using a proportional pitch font and constructed like this:

List l=new List(5,true);

Which statement is true?

A. The displayed item exactly five lines unless otherwise constrained

B. The displayed item is five lines init, but can displayed more than five Item by scroll

C. The maximum number of item in a list will be five.

D. The list is multiple mode

47. Given this skeleton of a class currently under construction:

public class Example{

int x,y,z;

public Example (int a, int b) {

//lots of complex computation

x=a; y=b;

}

public Example(int a, int b, int c){

// do everything the same as single argument

// version of constructor

// including assignment x=a, y=b, z=c

z=c;

}

}

What is the most concise way to code the “do everything…” part of the constructor taking two arguments?

Short answer:

48. Which correctly create a two dimensional array of integers?

A. int a[][] = new int[][];

B. int a[10][10] = new int[][];

C. int a[][] = new int[10][10];

D. int [][]a = new int[10][10];

E. int []a[] = new int[10][10];

49. Which are correct class declarations? Assume in each case that the text constitutes the entire contents of a file called Fred.java?

A. public class Fred{

public int x = 0;

public Fred (int x){

this.x=x;

}

}

B. public class fred{

public int x = 0;

public Fred (int x){

this.x=x;

}

}

C. public class Fred extends MyBaseClass, MyOtherBaseClass{

public int x = 0;

public Fred(int xval){

x=xval;

}

}

D. protected class Fred{

private int x = 0;

private Fred (int xval){

x=xval;

}

}

E. import java.awt.*;

public class Fred extends Object{

int x;

private Fred(int xval){

x = xval;

}

} 50. A class design requires that a particular member variable must be accessible 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?

A. The variable should be marked public

B. The variable should be marked private

C. The variable should be marked protected

D. The variable should have no special access modifier

E. The variable should be marked private and an accessor method provided

答案及详细分析:

26。A、C、E

考察的知识点是比较基本类型与对象类型的不同之处,基本类型进行的是值比较,而对象类型进行的是地址比较,也就是对指向它们内存地址的指针进行比较。

27。E

在程序中实现字节与字符转换时,采用规范“ISO8859-1”是最适宜的方式。

28。B、D、E

移位操作只对整型有效,故不能选A;String类型并非数组,故不能用C所示方法取其中的某一位;B中的length方法返回字符串长度;D中trim方法返回字符串去掉其前后的空格后的新字符串;字符串可以用“ ”进行合并。

29。E

回答本题时要细心阅读程序,注意“void Mistery(){}”并非构造函数,因为构造函数是没有返回值时,它只是与类名一致的方法名而已。注意到这一点,此题就没有什么难度了。

30。C、D

考察对布局管理器知识的掌握情况。BorderLayout的特性是当容器的尺寸改变时,North、South、West、East位置控件的较窄边长度不变,较长边长度变化。但控件的相对位置不变。

31。A

FlowLayout的特性是其中的控件大小不随着容器尺寸的变化而变化,但控件的相对位置会有所改变。

32。A(多选)

请注意,此题虽然是多选题,但正确答案只有一个。不管在什么情况下,图形要进行重绘,最终总会调用paint()方法,而且也只有paint()方法总会被调用。

33。A、D

Java中的标识符是以字符开头,字符包括字母、下划线“_”、美圆符“$”。不能以数字开头,也不能是Java关键字。

34。A、B、D、E

注意:goto、const是Java关键字,但是不使用。

35。D

cs是运行时可选择的java命令的参数,类名后才是由用户指定的传入程序中的实参,并且参数是字符串类型,故E也是不正确的。

36。C

数组是引用类型,它的元素相当于类的成员变量,而成员变量是可以被隐式初始化的,所以数组的元素也可以被隐式初始化,int类型被隐式初始化为0,所以选择C。

37。A

自动变量不能被static修饰,如果将static关键字去掉,答案选择C。

38。014

将十进制化成八进制后在数字前加“0”。

39。0x7

十六进制数用在数字前加“0x”表示。

40。B

字符类型是用16位UniCode表示的。

41。B

整型数的取值范围是- 2n~2n-1,n表示各种类型的表示位数。

42。B

JAVA中的参数传递全是值传递,所不同的是,对于引用类型来说,变量内部存放的是对象内存空间的引用,所以引用类型在进行参数传递时,是将引用拷贝给形式参数。所以在方法中绝不可能改变主调方法中引用变量的引用,但是可能改变主调方法中引用变量的某一属性(就象对ch[0]的'改变一样)。

43。A

注意main()方法的参数数组是在程序运行时由系统创建的,大小已经固定了。选项C、D引用args[count]可能会导致数组指针越界异常。

44。B

请查阅类结构,并注意他们的继承关系。这主要考查流链知识点。

45。B

控件TextArea如题中的构造方法的后两个参数分别表示行、列。注意题中的关键词语“prorortional pitch”,所以不一定是5列字,但一定是5行。

46。B

“5”表示可以选择的项目数显示为5行,但可以拖动滑块观察其它选项。“true”表示可以多选。

47。this(a,b);

注意教材中提到使用this方法可以简化构造函数的编写。此时它必须放在构造函数的第一句。

48。C、D、E

JAVA语言中声明数组时,方括号与变量的位置关系非常灵活。

49。A、E

Java中大小写敏感,注意文件名是Fred.java,故B错误;Java中不支持多继承,故C错误;Java中与文件名相同的类名的访问权限一定是public,故D错误。

50。C

请查阅关于访问权限的表格说明。

【java程序员认证模拟试题及解析】相关文章:

java中setconstrations_java程序员认证模拟试题及解析相关推荐

  1. java which valid identifier_JAVA程序员认证模拟题及分析(2)

    JAVA程序员认证模拟题及分析(2) (2007-01-11 14:55:50) 26. Give following class: class AClass{ private long val; p ...

  2. java程序员二级_Java程序员认证模拟题及详细分析(2)

    Java程序员认证模拟题及详细分析(2) 分类:计算机等级 | 更新时间:2016-07-08| 来源:转载 Java程序员认证模拟题及详细分析(1) 26. Give following class ...

  3. 若微型计算机在工作时突然断电,2014计算机软考程序员考前模拟试题

    无忧考网为大家收集整理了<2014计算机软考程序员考前模拟试题>供大家参考,希望对大家有所帮助!!! 1.与十六进制数值CD等值的十进制数是 A.204 B.205 C.206 D.203 ...

  4. 1) 以实现用户在桌面上存储的资料不会因为用户改变计算机而消失.,2014年计算机软考程序员考前模拟试题及答案...

    无忧考网为大家收集整理了<2014年计算机软考程序员考前模拟试题及答案>供大家参考,希望对大家有所帮助!!! 1.与十六进制数值CD等值的十进制数是 A.204 B.205 C.206 D ...

  5. 安装一个可用计算机系统的流程,2014年计算机软考程序员考前模拟试题

    无忧考网为大家收集整理了<2014年计算机软考程序员考前模拟试题>供大家参考,希望对大家有所帮助!!! 1.与十六进制数值CD等值的十进制数是 A.204 B.205 C.206 D.20 ...

  6. 软考初级程序员—计算机基础试题与解析(待补充)

    文件的物理结构不包括() A.连续结构 B.索引结构 C.分区结构 D.多个物理块的索引结构 答案:C 常见的文件物理结构有以下几种: 1.顺序结构又称连续结构.这是一种最简单的物理结构,它把逻辑上连 ...

  7. 经典java程序员的面试题及答案

    今天动力节点java培训机构小编为大家分享"经典java程序员的面试题及答案",希望通过此文能够帮助到正在找工作或是即将毕业的"你",下面就随小编一起看看经典j ...

  8. java中级程序员面试题_中级Java程序员常见面试题汇总

    下面是一些中级Java程序员常见面试题汇总,你可以用它来好好准备面试. 什么是线程? 线程是操作系统能够进行运算调度的最小单位,它被包含在进程之中,是进程中的实际运作单位.程序员可以通过它进行多处理器 ...

  9. oracle ocp认证_OCP Oracle认证专业Java SE 8程序员学习指南II-复习和作者对话

    oracle ocp认证 在招聘技术职位时,传统观点认为,没有什么能比有经验的候选人更胜一筹了,而且许多招聘经理通常可能不会在认证方面投入太多. 但是,Oracle Java认证考试当然是一个例外,因 ...

最新文章

  1. yum安装nginx+PHP+Mysql
  2. linux 运行lua脚本语言,你知道在linux下搭建lua脚本语言的编程环境?
  3. golang 函数结束后 goroutine退出机制
  4. html的meta用法
  5. 【杂谈】如何学会看arxiv.org才能不错过自己研究领域的最新论文?
  6. 第三章 python数据规整化
  7. 大数据主题分享第三期 | 基于ELK的亿级实时日志分析平台实践
  8. 很棒的HTML5效果实例
  9. 工作328:uni-局部过滤器处理数据
  10. C++学习之路 | PTA乙级—— 1093 字符串A+B (20 分)(精简)
  11. 阿里云产品专家解读链路追踪(Tracing Analysis)
  12. 结构等待队列[网络编程]select流程分析
  13. Linux搭建私人饥荒服务器(centos8-64位)
  14. 统信系统安装京瓷打印机驱动步骤 针对京瓷系列复合机的UOS操作系统用户使用说明
  15. jvm System.gc()说明
  16. 2013年深圳百公里徒步感悟
  17. python一个类调用另一个类的方法_python – 从另一个类调用类方法
  18. 雷霆战机服务器维护公告,雷霆战机停服公告 4月11日服务器维护
  19. 数据错误循环冗余检查是什么意思_德尔西曼.交换机是一种什么设备?通过什么方式进行交换?...
  20. 展望2019年:未来一年的WordPress

热门文章

  1. 基于小波神经网络的交通流预测
  2. java ofbiz_Ofbiz初探
  3. Java海康威视摄像头实时预览视频流保存到指定文件中
  4. Vue-node.js,Webpack-kuang 略
  5. 【数据分享】2014-2023年全国监测站点的逐日空气质量数据(15个指标\无需转发)
  6. 12月8日:thinkphp中的杂项
  7. 多项式除法Java实现
  8. 莆田学院计算机系是不是师范类,莆田学院2010会计学、计算机科学与技术拟各招一个海外合作班...
  9. 搭建ELK环境 logstash 时间差8小时问题
  10. Linux shutdown命令:关机和重启