收藏 分享(赏)

Java东华理工大学试卷C.doc

上传人:精品资料 文档编号:11029762 上传时间:2020-02-01 格式:DOC 页数:8 大小:69.50KB
下载 相关 举报
Java东华理工大学试卷C.doc_第1页
第1页 / 共8页
Java东华理工大学试卷C.doc_第2页
第2页 / 共8页
Java东华理工大学试卷C.doc_第3页
第3页 / 共8页
Java东华理工大学试卷C.doc_第4页
第4页 / 共8页
Java东华理工大学试卷C.doc_第5页
第5页 / 共8页
点击查看更多>>
资源描述

1、温馨提示:端正考风、严肃考纪、诚信参加考试 凡是代考、使用通讯设备作弊、二次作弊,一经发现开除学籍。专用考试纸 请勿浪费 卷 第 1 页 共 8 页专业 班级 学号 姓名 东 华 理 工 大 学 2012 2013 学 年 第 1 学 期 考 试 试 卷JAVA 程序设计 课程 闭卷 课程类别:考查 补考题号 一 二 三 四 五 六 七 八 九 总分分数评卷人1 选择题(共 35 分)1.Choose the invalid identifiers from those listed below. ( ) A. IDoLikeTheLongNameClass B. $byte C. true

2、D. _ok 2. How can you force garbage collection of an object? ( )A. Garbage collection cannot be forced B. Call System.gc(). C. Call System.gc(), passing in a reference to the object to be garbage collected. D. Call Runtime.gc(). E. Set all references to the object to new values(null, for example). 3

3、 Consider the following class: 1. class Test(int i) 2. void test(int i) 3. System.out.println(“I am an int.”); 4. 5. void test(String s) 6. System.out.println(“I am a string.”); 7. 8. 9. public static void main(String args) 10. Test t=new Test(); 11. char ch=“y”; 12. t.test(ch); 13. 14. Which of the

4、 statements below is true?( .) A. Line 5 will not compile, because void methods cannot be overridden. B. Line 12 will not compile, because there is no version of test() that rakes a char argument. C. The code will compile but will throw an exception at line 12. D. The code will compile and produce t

5、he following output: I am 温馨提示:端正考风、严肃考纪、诚信参加考试 凡是代考、使用通讯设备作弊、二次作弊,一经发现开除学籍。专用考试纸 请勿浪费 卷 第 2 页 共 8 页专业 班级 学号 姓名 an int. 4. Which of the following lines of code will compile without error? ( )A. int i=0; if (i) System.out.println(“Hi”); B. boolean b=0; boolean b2=true; if(b=b2) System.out.println(“So

6、 true”); C. int i=1; int j=2; if(i=1| j=2) System.out.println(“OK”); D. int i=1; int j=2; if (i=1 5. Which two demonstrate a “has a“ relationship? ( ) A. public interface Person public class Employee extends Person B. public interface Shape public interface Rectandle extends Shape C. public interfac

7、e Colorable public class Shape implements Colorable D. public class Species public class Animalprivate Species species; 6 True or False: Readers have methods that can read and return floats and doubles. ( )A. Ture B. False C no answer7 What is result ( )温馨提示:端正考风、严肃考纪、诚信参加考试 凡是代考、使用通讯设备作弊、二次作弊,一经发现开

8、除学籍。专用考试纸 请勿浪费 卷 第 3 页 共 8 页专业 班级 学号 姓名 class Test public static void main(String args) int a=2;System.out.println(a+);A 2 B 3 C 1 D 48 What is result ( )class Testpublic static void main(String args) int a=2,b=3;System.out.println(a+b+);A 2 B 3 C 5 D 49 which platform is not belonging to Java devel

9、oping platform ( )A j2ee B j2me C j2se D jsp10 what expression is incorrect( )A .class file is byte codeB .class file is based on JVMC .class file is run by real CPUD .class file is produced by javac11 what statement is valid ( )A extend is used as implementing hierarchy between both classesB extend

10、s is used as implementing hierarchy between both interfaceC implement is used between interface and classD implements is used as implementing hierarchy between both interface12 Which statement is invalid ( )A int a5; B int a =1,2,4 C int a=new int313 Which sentence is right( )A abstract final class

11、AB abstract private class AC abstract protected class AD abstract class A14 How to compile a Java source code ( )A javac a.java B java a.java C javac a D javac a.class15 Set x=1,y=2,z=3, expression y-=z-%+x; what is result ( )A 1 B 3.5 C 4 D 5二 翻译题 20 分,每小题 5 分温馨提示:端正考风、严肃考纪、诚信参加考试 凡是代考、使用通讯设备作弊、二次作

12、弊,一经发现开除学籍。专用考试纸 请勿浪费 卷 第 4 页 共 8 页专业 班级 学号 姓名 1)Inheritance is a relatively simple concept, which allows one class to extend another, or to inherit characteristics. When a class is extended a hierarchy is built up with the original class at the top and the classes, which build on the class above it

13、 (the class at the top is known as the super-class below). When a class is extended, to create a sub-class, all of the properties (variables and methods) of the original class still exist within the new class along with others, which have been added.2)Polymorphism is the ability of objects to react

14、differently when presented with different information, known as parameters. In a functional programming language the only way to complete two different tasks is to have two functions with different names. Object-oriented languages, which include Java, allow different methods to be run depending on w

15、hat type of parameters is specified. 3)A Java application resembles programs in most compiled languages. Code in object format resides on the users machine and is executed by a run-time interpreter that normally has to be user installed.温馨提示:端正考风、严肃考纪、诚信参加考试 凡是代考、使用通讯设备作弊、二次作弊,一经发现开除学籍。专用考试纸 请勿浪费 卷

16、第 5 页 共 8 页专业 班级 学号 姓名 4)Keywords cannot be used for anything but their predefined purpose. There are 49 in all, These words each have a special meaning to the Java compiler. A keyword must be separated from other keywords or identifiers by white space, a comment or some other punctation symbol.三 程序

17、阅读题(每题 4 分,共计 20 分):The result of following program is:_public class Class1 public static void main(String args)int n=6,sum=0;for(int k=1;k=0;i-)System.out.print(“ a“+i+“ = “+ai+“ “);温馨提示:端正考风、严肃考纪、诚信参加考试 凡是代考、使用通讯设备作弊、二次作弊,一经发现开除学籍。专用考试纸 请勿浪费 卷 第 8 页 共 8 页专业 班级 学号 姓名 System.out.println(“ n 程序运行结束!“);四、编程题 25 分Write an application program that can print numbers from 1 to 10 and then from 10 to 1.(10 分) Write a program that calculates the sum of 1+3+5+999, and display the sum.(15 分)

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报