




已阅读5页,还剩1页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
装订线内不要答题,装订线外不要写姓名、学号、学院专业年级班签个人信息,违者试卷作0分处理考 点 号教 室 号姓 名学 院专 业年 级班 号学号(全号)湖南农业大学课程考核试卷课程名称(全称):Java程序设计(双语) 课程代码:20638B0考核时间:2011 年01月 04 日 试卷号: A 考核对象:电子商务081、电子商务082大题号一二三四五六七八九十总分题分202020101020得分 得分I、Choose one correct answer(Total 20 points,each question 2 points)1. Given the following code:switch (m) case 0: System.out.println(Condition 0); case 1: System.out.println(Condition 1); case 2: System.out.println(Condition 2); case 3: System.out.println(Condition 3);break; default: System.out.println(Other Condition);Which values of m will cause Condition 2 is output? ( ) A. 0,1 and 2 B. only 1 C. only 2 D. only 02. Choose the valid identifier from those listed below. ( ) A. MyMethod B. 3byte C. 5_const D.true3. Which method is faster for linear search and binary search? ( )A. linear search B. binary search C. equal D. different in various situations4. There are three main attributes of class类 except ( )A. encapsulation B.inheritance 继承性C. abstraction D.polymorphism 多态性5. Which language is a low-level programming language in which a mnemonic is used to represent each of the machine language instructions ? ( )A. The machine languageB. Assembly languageC. The ada languageD. The high-level language6. Which is right ? ( )A.String temp = new String j a z; B.char temp = j b c; C.String temp = a, b, c; D.String temp = a, b, c;7( ) contains pre defined classes and interfaces for developing Java programs: A. API B. OOP C. DOM D. COM8. ( ) are errors that occur during compilation 编写 .A. logic errors ; B. runtime errors; C. syntax errors; D. other errors;9.The result of 2 + 5 * 3 7 * ( 2 + 4) - 1 is? ( )A.null B.true C.false D.others10. The result of ( 6 4 ) ( 8 0) is? ( )A.null B.true C.false D.others得分II、Decide correct or wrong(Total 20 points,each question 2 points, “”means right, “X” means wrong)1、the precedence优先权 of ! is lower than *.(错)2、Evaluate whatever subexpressions you can possibly evaluate from right to left.(错)3、Runtime errors occur when a program does not perform the way it was intended to.(错 )4、the else clause matches the most recent unmatched if clause in the same block.(对)5、The symbols ? and : appear together in a conditional expression, they form a conditional operator.This operator is called a ternary operator.(对)6、It will cause a logic error if you use floating-point values for equality checking in a loop control.(对)7、Adding a semicolon分号 at the end of the for clause从句 before the loop body is a common compiling mistake.( 对)8、The high-level language are English-like and easy to learn and program.( 对) 9、Java is not sensative to Lowercase and Upcase. ( 错) 10、Java is distributed and interpreted.(对)得分III、Fill the following blanks(Total 20 points,each blank 2 points)1import javax.swing.JOptionPane;public class TestSum public static void main(String args) / Initialize sum sum=0; / Add 1, 2, ., 99999, 100000 to sum for (Long ; ; ) ; / Display result JOptionPane.showMessageDialog(null, The sum is + sum); 2public class TestMethodOverloading public static void main(String args) System.out.println(The maximum between 3 and 4 is + max(3, 4); System.out.println(The maximum between 3.0 and 5.4 is + max(3.0, 5.4); System.out.println(The maximum between 3.0, 5.4, and 10.14 is + max(3.0, 5.4, 10.14); /* Return the max between two int values */ public static (int num1, int num2) if (num1 num2) return num1; else return num2; /* Find the max between two double values */ public static max( num1, double num2) if (num1 num2) return num1; else return num2; /* Return the max among three double values */ public static double max(double num1, double num2, double num3) return ; 得分IV、Write the results after code is executed.(Total 10 points,each question 5 points)1import java.io.*;public class abc public static void main(String args) SubClass s = new SubClass( ); System.out.println(s.max( );class SuperClassint a = 35 , b = 18 ; class SubClass extends SuperClass int max( ) return (ab)?a:b);The result of question 1 is : 2import javax.swing.JOptionPane;public class ComputeFactorial public static void main(String args) int n = 4; JOptionPane.showMessageDialog(null, Factorial of + n + is + factorial(n); static long factorial(int n) if (n = 0) return 1; else return n * factorial(n - 1); The result of question 2 is : 得分V、answer questions briefly(Total 10 points,each question 5 points)1. Briefly the principle of class inheritance.2. Answer the common methods for debugging.得分VI、programming(Total 10 points,each question 10 points)1Please write a Java program,compute th
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025版写字楼装修工程场地租赁合同样本
- 2025版矿石产品市场调研与评估服务合同样本下载
- 2025房地产代理商合作房产评估服务协议
- 2025房地产项目开发与城市综合体配套合同
- 2025版社区儿童安全教育项目合同书
- 2025年度智能社区物业综合服务合同范本
- 2025年自驾游车辆租赁及保险保障合同
- 2025大型商场家居建材租赁与销售代理合同
- 贵州省修文县2025年上半年公开招聘城市协管员试题含答案分析
- 2025版涂料工程劳务分包合同执行细则
- YYT 0657-2017 医用离心机行业标准
- SYT 6968-2021 油气输送管道工程水平定向钻穿越设计规范-PDF解密
- Q-GDW1799.2-2013-电力安全工作规程-线路部分
- (新)外研版初中英语语法(表格式)网络结构图
- 油脂制取与加工工艺学课件
- 控油控糖控盐知识讲座
- 中医护理进修脑病科汇报
- 汽车传感器的原理与应用课件
- 初中生如何应对学习上的压力和焦虑
- 督灸技术课件
- 《分析化学总复习》课件
评论
0/150
提交评论