java单选题2018年版.docx

上传人:lao****ou 文档编号:133246 上传时间:2023-04-07 格式:DOCX 页数:44 大小:42.55KB
下载 相关 举报
java单选题2018年版.docx_第1页
第1页 / 共44页
java单选题2018年版.docx_第2页
第2页 / 共44页
java单选题2018年版.docx_第3页
第3页 / 共44页
java单选题2018年版.docx_第4页
第4页 / 共44页
java单选题2018年版.docx_第5页
第5页 / 共44页
亲,该文档总共44页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《java单选题2018年版.docx》由会员分享,可在线阅读,更多相关《java单选题2018年版.docx(44页珍藏版)》请在第一文库网上搜索。

1、1. How many bytes of storage are required for an integer of type long in Java? (b)(a) Four(b) Eight(c) Two(d) Three注 java中有8种基本类型byte:8位无符号整数 short: 16位有符号整数臧廷杰int32位有符号整数long:64(8字节)位有符号整数float:32位单精度浮点数double:64位单精度浮点数char:单个字符 使用16位Unicode编码 boolean2.The two Boolean literals avallable in Java are

2、 and.(d)(a) T, F(b) 0, 1(c) TRUE, FALSE(d) true, false3.Consider the following line of Java code.(c)int x = 1+7*2;What wi11 be the value of x at the end of execution of the line of code?(a) 21(b) 16(c) 15(d) 94.How many lines of output will be produced by the following code fragment?(d)for (int i =

3、0; i 4; +i) for (int j = 1; j 3 ; +j)stdOut. println(i + j);(a) 10(b) 12(c) 6(d) 85.Which is the Java keyword used to denote a class method? (d)(a) class(b) private(c) final(d) static 6? According to Javadoc convention, the first sentence of each Javadoc commentshould be (c)(a) an author tag(b) the

4、order of lines is not important(c) a summary sentence of the declared entry(d) an version tag7.The coding system used to represent characters in Java is (c)(a) bytecode(b) ASCII(c) Unicode(d) EBCDIC8.Which expression below evaluates to true if and only if x is in the range 0,9 (inclusive)? (a)(a) !

5、(x 9)(b) 0 x 9(c) 0 = 9(d) x 0 & x 99.Which of the following is a valid integer constant declaration? (a)(a) final int SCALE = 10;(b) int final SCALE = 10;(c) final SCALE = 10;(d) int SCALE = 10;10.Which of the following is a valid character literal in Java?(注意字符与字符串的表示)(a)(a),(b) (c) /(d)11.Which o

6、f the following is not equivalent in value to the following expression? (b)flag = false(a) flag != true(b) flag(c) !flag(d) ! (flag = true)臧廷杰12. Which of the following statements is used to exit from a switch statement?(a)(a) break;(b) end;(c) exit;(d) default;13.Which of the following is not a leg

7、al identifier in Java? (c)(a) firstindex(b) $first index(c) 1 index(d) indexl14.Tn Java, what is the identifier for the primitive type used to represent a character? (b)(a) Character(b) char(c) character(d) Char15.Which of the following is a valid literal of type float in Java?(c)(a) 10. 5sp(b) 10.

8、5fp(c) 10. 5f(d) 10. 5d16.Which of the fol 1 owing statements about constructors in Java is true? (a)(a) Aclass can definemore than oneconstructor.(b) Aclass must define at least oneconstructor.(c) Aconstructor mustbe defined aspublic.(d) Aconstructor mustbe defined asstatic.17. According to the doc

9、ument entitledCode Conventions for the Java Programming Language, file suffixes used by Javasoftware include which of the following?(b)I. objIL. class111. .h(a) I and H only(b) II only(c) II and III only(d) I and III only18- A stack trace is (c)臧廷杰(a) a list of variables allocated on a programs stac

10、k(b) a fatal error that causes a typical debugger to terminate(c) a sequence of method calls(d) only available through a typical debuggers step into feature注 堆栈轨迹:如果你需要打印出某个时间的调用堆栈状态 你将产生一个堆栈轨迹。stack trace中包括三部分 分别为.bss . text . databss表示程序中未初始化的全局变量的一块内存区域text表示程序中已初始化的全局变量的一块内存区域data 表示存放程序执行代码的一块

11、内存区域19- Which method must exist in every Java application?(a) begin(b) paint(c) init(d) mainCorrect answer is (d)20. A Java identifier may begin with all but which of the following?(a) $(b) if(c) _ (the underscore)(d) 0Correct answer is (d)2L Tn the context of Java programming, garbage col lection r

12、efers to(a) automatic balancing of parenthesis performed by some editors(b) removal of Java programs that could cause damage to a system(c) conversion of comments into Javadoc comments(d) automatic return of memory to the heap for objects no longer required by theprogramCorrect answer is (d)22. What

13、 will be output when the following Java program segment is executed?int x = 5;int y = 2;System, out. printin (x+y);(a) 5+2(b) 5 2(c) 7(d) 52Correct answer is (c) 23. Which of the following parts of an if-else-statement isoptional?(a) the if part(b) the else part(c) the parenthesis around the conditi

14、on(d) the conditionCorrect answer is (b)24 Which of the following is the Java loop construct typically used when the rangeis clear?(a) while-loop(b) for-loop(c) switch-loop(d) do-while-loopCorrect answer is (b)25. Consider the following Java program segment.import java, io.*;public class Test public

15、 Test( ) System, out. printIn(default);)public Test( int i ) System, out. println(/znon-defaultz/);public static void main(String args) Test t 二 new Test(2);Which of the following will be output during execution of the program segment?(a) The line of text(b) The 1ine of text(c) The line of text(d) The line of textz,non-default/

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

当前位置:首页 > 应用文档 > 汇报材料

copyright@ 2008-2022 001doc.com网站版权所有   

经营许可证编号:宁ICP备2022001085号

本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有,必要时第一文库网拥有上传用户文档的转载和下载权。第一文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知第一文库网,我们立即给予删除!



客服