JAVA期末考试模拟试题

上传人:飞*** 文档编号:3749538 上传时间:2017-08-11 格式:DOC 页数:12 大小:156.50KB
返回 下载 相关 举报
JAVA期末考试模拟试题_第1页
第1页 / 共12页
JAVA期末考试模拟试题_第2页
第2页 / 共12页
JAVA期末考试模拟试题_第3页
第3页 / 共12页
JAVA期末考试模拟试题_第4页
第4页 / 共12页
JAVA期末考试模拟试题_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《JAVA期末考试模拟试题》由会员分享,可在线阅读,更多相关《JAVA期末考试模拟试题(12页珍藏版)》请在金锄头文库上搜索。

1、一、选择题(每小题 1 分,共 10 分,注:选择答案可能不止一个正确)1、编译 Java Application 源程序文件将产生相应的字节码文件,这些字节码文件的扩展名为( )。A. .java B. .class C. .html D. .exe2、设 x = 1 , y = 2 , z = 3,则表达式 yz/x 的值是( )。A. 3 B. 3. 5 C. 4 D. 53、在 Java Applet 程序用户自定义的 Applet 子类中,一般需要重载父类的 ( )方法来完成一些画图操作。 A. start( ) B. stop( ) C. init( ) D. paint( )4、

2、不允许作为类及类成员的访问控制符的是( )。A. public B. private C. static D. protected5、为 AB 类的一个无形式参数无返回值的方法 method 书写方法头,使得使用类名 AB 作为前缀就可以调用它,该方法头的形式为( )。A. static void method( ) B. public void method( ) C. final void method( ) D. abstract void method( ) 6、下面哪些是 java 语言中的关键字? A. sizeof B. abstract C. NULL D. Native 7、

3、下面语句哪个是正确的? A. char c =abc; B. long l=oxfff; C. float f=0.23; D. double d =0.7E-3; 8、以下程序测试 String 类的各种构造方法,试选出其运行效果。 class STRpublic static void main(String args)String s1=new String();String s2=new String(String 2);char chars=a, ,s,t,r,i,n,g;String s3=new String(chars);String s4=new String(chars,2

4、,5);byte bytes=72,101,108,108,79,33; /A、a 和“!”号的 ASCII 分别为 65、97 和 33 StringBuffer sb=new StringBuffer(s3);sb.append(“!”);String s5=new String(sb);String s6 = new String(bytes);System.out.println(The String No.1 is +s1);System.out.println(The String No.2 is +s2);System.out.println(The String No.3 is

5、 +s3);System.out.println(The String No.4 is +s4);System.out.println(The String No.5 is +s5);System.out.println(The String No.6 is +s6);A . The String No.1 is B. The String No.1 isThe String No.2 is String The String No.2 is String 2The String No.3 is a string The String No.3 is a stringThe String No

6、.4 is string The String No.4 is strinThe String No.5 is a string The String No.5 is a string!The String No.6 is HELLO! The String No.6 is Hello!C. The String No.1 is The String No.2 is String 2 The String No.3 is a string D 以上都不对 The String No.4 is strin The String No.5 is a string The String No.6 i

7、s hello! 9、下面语句段的输出结果是( ) int i = 9; switch (i) default: System.out.println(default); case 0: System.out.println(zero); break; case 1: System.out.println(one); case 2: System.out.println(two); A. default B. default, zero C. error default clause not defined D. no output displayed10、下面哪些语句能够正确地生成 5 个空

8、字符串? A . String a=new String5; B. String a=,; for(int i=0;i1) break; System.out.println(j+and+i); A. 0 and 0 B. 0 and 1C. 0 and 2 D. 0 and 3 E. 2 and 2 F. 2 and 1 G. 2 and 0 12、在编写 Java Application 程序时,若需要使用到文件输入输出语句,必须在程序的开头写上( ) 语句。A、import java.awt.* ; B、import java.applet.Applet ;C、import java.i

9、o.* ; D、import java.awt.Graphics ;13. 下列可作为正确的 java 标识符使用的是:A、MyClass, $amount, _totalGrades B、$美元, instanceOf, TAX_RATEC、one, My Class, numberOf*s D、final, 1Way, new 14、下列程序的运行结果为:(A 的 ASCII 为 65, 1 的 ASCII 为 49, a 的 ASCII 为 97)char c1=A, c2=1; System.out.println(c1+3); /68System.out.println(char)(

10、c1+3); /D System.out.println(char)(c1+c2); /rA. D D r B. 68 D w C. D D r D. 68 D r15、下列程序的运行结果为:System.out.println(37D); /37.0 System.out.println(037); /31System.out.println(037D); /37.0 System.out.println(0x37D); /893A. 37.0 37 37 37 B. 37.0 31 37.0 37.0 C. 37.0 31 37.0 893 D. 37.0 37 31 89316、下列程序

11、的运行结果为:Integer n1 = new Integer(47); Integer n2 = new Integer(47);System.out.println(n1 = = n2); /false System.out.println(n1.equals(n2); /truen1 = n2; System.out.println(n1 ! = n2); /false System.out.println(n1.equals(n2); /trueA. true true true true B. false false false true C. false true false tr

12、ue D. true true false true17、下列程序中出错的语句为:class A void f(int x,int y)static void g(int a, int b) public static void main(String args) A a1 = new A(); a1.f(2,3); (1)a1.g(2,5); (2)A.f(4,6); / error (3)A.g(8,9); (4)f(4,6); / error (5)g(8,9); (6)A. (2) (4) (6) B. (1) (3) (5) C. (3) (5) D. (4) (6)18、下列说法正

13、确的是:public class TestFinal Random rnd = new Random();final int a = rnd.nextInt();final static double pi = 3.1415926;final Person teacher = new Person(kongzi); / Person(Sting name)为 Person 类的构造器static void f(final int i)System.out.println(i+=100);public static void main(String args) TestFinal test1 =

14、 new TestFinal();TestFinal test2 = new TestFinal();A、 test1.a 与 test2.a 的值相同;test1.pi 与 test2.pi 的值相同; test1 与 test2 的 teacher 属性是同一个Person 类型对象;方法 f()存在错误,应将 f(final int i)改为 f(int i)B、 test1.a 与 test2.a 的值可能相同,也可能不同;test1.pi 与 test2.pi 的值相同;test1 与 test2 的teacher 属性是不同的 Person 类型对象;方法 f()存在错误,应将 i+=100 改为 i+100C、 test1.a 与 test2.a 的值一定不同;test1.pi 与 test2.pi 的值相同;te

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 资格认证/考试 > 人力资源管理师

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号