首页>题库>程序设计师-Java

程序设计师-Ja315道题

1.Main()方法的返回类型是()。

单选题

A. int~||~void~||~boolean~||~static

2.下面()赋值语句是错误的。

多选题

A. floatf=11.1;~||~doubled=5.3E12;~||~charc=“ ”;~||~bytebb=433;

3.下列有关抽象类的说法正确的是(。

单选题

A. 抽象类中必包含抽象方法。~||~抽象类不能实例化~||~抽象类不一定被继承。~||~用interface定义抽象类

4.临界区指出它只能同时被一个线程访问,并且可以指定由线程访问的优先顺序。

判断题

5.下面程序段的运行的结果是()。classExample{publicstaticvoidmain(String[]args){Stringstr1=newString(“abc”);Stringstr2=newString(“abc”);if(str1.equals(str2))System.out.println(“Twostringsareequal.”);elseSystem.out.println(“Twostringsarenotequal.”);if(str1==str2)System.out.println(“str1==str2istrue.”);elseSystem.out.println(“str1==str2isfalse.”);}}

单选题

A. Twostringsareequal.str1==str2isfalse.~||~Twostringsarenotequal.str1==str2isfalse.~||~Twostringsareequal.str1==str2istrue.~||~Twostringsarenotequal.str1==str2istrue.

6.File类的length()方法可以获取文件长度,其返回值是()。

单选题

A. 文件的行数~||~文件的位数~||~文件的块数~||~文件的字节数

7.下面的哪些程序片断可能导致错误。

多选题

A. Strings="Gonewiththewind";~||~Strings="Gonewiththewind";~||~Strings="Gonewiththewind";~||~Strings="homedirectory";

8.流在刚被创建时,指针位于()。

单选题

A. 流的最后一个字节~||~流的第一个字节~||~上次离开的位置~||~随机位置

9.是否可以继承String类?为什么?()

多选题

A. 是~||~否~||~String类是final类故不可以继承。~||~String类是abstract类故可以继承。

10.以下()不是JSP标记库的构成部分。

单选题

A. 标记处理器~||~标记库描述文件~||~标记库处理servlet~||~应用程序部署描述符(web.xml)

11.下列类定义中()是合法的抽象类定义。

多选题

A. abstractA{abstractvoidfun1();}~||~abstractclassA{abstractvoidfun1();}~||~abstractclassA{abstractvoidfun1(){};}~||~abstractclassA{voidfun1(){};}

12.下列关于Servlet的工作过程的叙述错误的是()。

单选题

A. 客户端浏览器通过Http等协议向服务器发出浏览请求~||~Web服务器收到请求后将其传递给Servlet~||~Servlet为客户端请求创建一个新的进程来进行处理,并将处理结果返回服务器。~||~Web服务器将从Servlet收到的处理结果发送回客户端

13.以下声明合法的是()。

单选题

A. defaultStrings;~||~publicfinalstaticintw()~||~abstractdoubled;~||~abstractfinaldoublehyperbolicCosine()

14.所有的例外类皆继承()类。

单选题

A. java.io.Exception~||~java.lang.Throwable~||~java.lang.Exception~||~java.lang.Error

15.Java程序中最小的可编译的单元为()。

单选题

A. 对象~||~类~||~方法~||~语句

16.下列程序存在的错误有()。finalclassFirst{privateinta=1;intb=2;}classSecondextendsFirst{publicvoidmethod(){System.out.println(a+b);}}

多选题

A. println()参数应为字符串,因此此处不能调用该方法。~||~因为变量a是private,所以在其他类中不能到访问a。~||~Second不能继承First。~||~关键字final不能修饰类。

17.JPanel组件的默认布局管理器是()

单选题

A. GridLayout~||~CardLayout~||~BorderLayout~||~FlowLayout

18.下面()对象表示标准输入对象流。

单选题

A. System.in~||~System.out~||~System.err~||~System.read

19.面向对象技术的基本要素主要有()。

多选题

A. 抽象性~||~封装性~||~继承性~||~多态性

20.给出下面的代码publicvoidtest(){try{oneMethod();System.out.println("condition1");}catch(ArrayIndexOutOfBoundsExceptione){System.out.println("condition2");}catch(Exceptione){System.out.println("condition3");}finally{System.out.println("finally");}}在oneMethod()方法运行正常的情况下将显示什么?

多选题

A. condition1~||~condition2~||~condition3~||~finally

注册后查看全部试题

保定市乐凯大街305号

电话: 400-608-5357

邮编: 100043


Copyright © 昊元综合学习与考试平台 保定昊元电气科技有限公司版权所有 2021,All Rights Reserved

经营许可证编号:  冀B2-20210069号       备案号:    冀ICP备19021638号