




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、SSD3选择题题库1 .Which method must exist in every Java application?(a) begin(b) paint(c) init(d) mainCorrect answer is (d)Which of the following is a valid character literal in Java?(a) ''(b) '<='(c) "'"(d) "a"Correct answer :A2 .A Java identifier may begin with
2、 all but which of the following?(a) $(b) if(c) _ (the underscore)(d) 0Correct answer is (d)3.In the context of Java programming, garbage collection refers to(a) automatic balancing of parenthesis performed by some editors(b) removal of Java programs that could cause damage to a system(c) conversion
3、of comments into Javadoc comments(d) automatic return of memory to the heap for objects no longer required by the programCorrect answer is (d)(e) hat will be output when the following Java program segment is executed? int x = 5;int y = 2;System.out.println(x+y);(a) 5+2(b) 5 2(c) 7(d) 52Correct answe
4、r is (c)5. Which of the following parts of an if-else-statement is optional?(a) the if part(b) the else part(c) the parenthesis around the condition(d) the conditionCorrect answer is (b)6.Which of the following is the Java loop construct typically used when the range is clear?(a) while-loop(b) for-l
5、oop(c) switch-loop(d) do-while-loopCorrect answer is (b)8 .Consider the following Java program segment.import java.io.*;public class Test public Test( ) System.out.println("default");public Test( int i ) System.out.println("non-default");public static void main(String args) Test
6、t = new Test(2);Which of the following will be output during execution of the program segment?(a) The line of text "non-default" followed by the line of text "default"(b) The line of text "default" followed by the line of text "non-default"(c) The line of text
7、 "default"(d) The line of text "non-default"Correct answer is (d)9 .What is the name of the JDK program that processes Javadoc comments?(a) java(b) javac(c) javacom(d) javadocCorrect answer is (d)10 .According to the Java code conventions, files longer than lines shouldbe .(a) 10
8、0, encouraged(b) 100, avoided(c) 2000, avoided(d) 2000, encouragedCorrect answer is (c)2 .The primitive floating-point types available in Java are and .(a) real, double(b) float , double(c) real , float(d) single , realCorrect answer is (b)3 .How many bytes are required to represent a Unicode charac
9、ter?(a) Four(b) One(c) Three(d) TwoCorrect answer is (d)5 .How many lines of output will be produced by the following code fragment?for (int i = 0; i < 4; +i) for (int j = 1; j < 3 ; +j) stdOut.println(i + j);(a) 12(b) 6(c) 10(d) 8Correct answer is (d)6 .How many lines of output will be produc
10、ed by the following code fragment?for (int i = 0; i < 3; +i) for (int j = 0; j < i; +j) stdOut.println(i + j);(a) 6(b) 4(c) 3(d) 5Correct answer is (c)7 .Which of the following statements about class variables in Java is not true?(a) Class variables require the modifier static in the declarati
11、ons.(b) All objects have their own copy of the class variable defined in the instantiated class.(c) Non-static methods in a class can access the class variable defined in the same class.(d) Class variables do not need the reference to the object of the instantiated class to access them.Correct answe
12、r is (b)8 .The term class variable is a synonym for(a) an instance variable(b) a read-only variable(c) a private data field(d) a static data fieldCorrect answer is (d)9 .Which of the following patterns of characters opens a Javadoc comment block?(a) /*(b) /(c) /*(d) */Correct answer is (a)2 .The ter
13、m wrapper classes refers to(a) the Java classes that contain at least two data fields(b) the Java classes that contain themselves(c) a collection of Java classes that "wrap" Java primitive types(d) a collection of Java classes that contain other Java classesCorrect answer is (c)3 .Given th
14、e following code, what value will be output by the last statement?StringTokenizer st = new StringTokenizer("this is,a,test of tokens", ",");String s;int count = 0;while (st.hasMoreTokens() s = st.nextToken();+count;stdOut.println(count);(a) 3(b) 1(c) 6(d) 4Correct answer is (a)5
15、.Consider the following Java program x = 5;int y = 2;System.out.println(x + "1" + y);Which of the following statements is true about the program segment?(a) The output caused by the code will be 512.(b) The output caused by the code will be 8.(c) The code will cause a compilati
16、on error.(d) The output caused by the code will be 5 1 2.Correct answer is (a)6 .Consider the following Java program segment.import java.io.*;public class SomeClasspublic void x() throw new RuntimeException("Exception from x");public void y()throw new IOException("Exception from y&quo
17、t;);Which of the following is true concerning the definitions for the methods x and y?(a) Neither x nor y has a legal definition.(b) Both x and y have legal definitions.(c) x has a legal definition, but y has an illegal definition.(d) x has an illegal definition, but y has a legal definition.Correct
18、 answer is (c)7.1 n Java, exceptions that are not handled are passed up the(a) exception ladder(b) call stack(c) catch blocks(d) block hierarchyCorrect answer is (b)10.After a typical debugger encounters a breakpoint, the programmer using the debugger may perform which of the following actions?1. Ex
19、amine the values of variables in the halted program2. Execute the current line3. Resume execution of the halted program(a) III only(b) I, II, and III(c) I only(d) I and II onlyCorrect answer is (b)1 .The name of a Java source file(a) must use the extension .class(b) must be the same as the class it
20、defines, respecting case(c) must be the same as the class it defines, ignoring case(d) has no restrictionsCorrect answer is (b)5 .A difference between the methods print and println of the class java.io.PrintWriter is that(a) println appends a new line to the end of its output, but print does not(b)
21、print appends a new line to the end of its output, but println does not(c) println inserts a new line at the beginning of its output, but print does not(d) print inserts a new line at the beginning of its output, but println does notCorrect answer is (a)6 .What is the right way to handle abnormaliti
22、es in input on Java?(a) By handling these problems by providing exception handlers(b) By always specifying the throws clause in every method header where fileI/O is performed(c) By using the class FileFilter which gracefully filters out bad input data(d) By writing while loops to guard against bad i
23、nputCorrect answer is (a)7 .All Java exception classes are derived from the class(a) java.lang.RuntimeException(b) java.lang.Throwable(c) java.lang.Error(d) java.io.IOExceptionCorrect answer is (b)9.Which of the following statements is true of the conventions outlined by Sun Microsystems in the docu
24、ment entitled Code Conventions for the Java Programming Language?1. They define a standard interface definition language that must be used for all Java classes.2. They provide recommendations intended to make source code easier to read and understand.3. They describe one mechanism for network commun
25、ication between Java and C+ programs.(a) III only(b) I, II, and III(c) II only(d) I and III onlyCorrect answer is (c)10.A tool that allows programmers to execute lines of a program one line at a time in order to help locate the source of a program's errors is known as a(n)(a) debugger(b) stack t
26、race(c) exception handler(d) scopeCorrect answer is (a)2.Which of the following is not true concerning objects and their representation?(a) objects are represented by their addresses(b) objects are represented by value(c) objects are represented by reference(d) objects are represented indirectlyCorr
27、ect answer is (b)5.In programming, a loop is generally used to achieve(a) branching(b) succession(c) repetition(d) selectionCorrect answer is (c)7.If a class contains a constructor, that constructor will be invoked(a) each time an object of that class goes out of scope(b) once at the beginning of an
28、y program that uses that class(c) once the first time an object of that class is instantiated(d) each time an object of that class is instantiatedCorrect answer is (d)8.Which of the following categorizations can be applied to both the data fields and the methods in a Java class?(a) native and non-na
29、tive(b) static and non-static(c) default and non-default(d) abstract and non-abstractCorrect answer is (b)10. According to the Java code conventions, files that contain Java source code have the suffix , and compiled bytecode files have the suffix .(a) .javac, .class(b) .java, .class(c) .class, .jav
30、ac(d) .class, .javaCorrect answer is (b)2.Variables of primitive types are also referred to as(a) references(b) classes(c) objects(d) scalarsCorrect answer is (d)3.Based on the following declaration, what does b1 represent just after the declaration is executed?Button b1;(a) a "default" Bu
31、tton object(b) a Button object with no label(c) a blank Button object(d) nothingCorrect answer is (d)8. The return type for a method that returns nothing to its caller is(a) not specified in the method definition(b) false(c) null(d) voidCorrect answer is (d)2.What is the name of the wrapper class fo
32、r the type int?(a) Integer(b) INT(c) integer(d) IntCorrect answer is (a)3. Which of the following statements is (are) true about the use of an asterisk (*) in a Java import statement?It does not incur run-time overhead.It can be used to import multiple packages with a single statement.It can be used to import multiple classes with a single statement.(a) III only(b) I and III only(c) I only(d) I, II, and IIICorrect answer is (b)4. What will be output caused by the execution of the following Java program segment?String name = "Elvis"System.out.print(name +
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025至2030年中国玻璃艺术台盆数据监测研究报告
- 2025至2030年中国珠绣睡衣数据监测研究报告
- 土地三调合同范本
- 短视频在网销中的运用与成功案例
- 建材订货合同范本
- 科技与教育的融合K12课外辅导的创新探索
- 2024年苏州市张家港译匀铝业有限公司招聘考试真题
- 糕点代加工合同范本
- 电子政务如何推动智慧城市建设
- 科技与经济全球化的深度融合案例分析
- 全球气候变化与应对措施
- 化工企业安全生产信息化系统管理解决方案
- 供电工程施工方案(技术标)
- 2023届江西省九江市高三第一次高考模拟统一考试(一模)文综试题 附答案
- 2024年共青团入团积极分子、发展对象考试题库及答案
- AI赋能供应链优化-深度研究
- 箱式变电站迁移施工方案
- 二零二五版服装厂服装产品质量追溯劳动合同范本3篇
- 小程序代运营合作协议
- 2025年中电建新能源集团有限公司招聘笔试参考题库含答案解析
- 2024年湖南环境生物职业技术学院高职单招职业技能测验历年参考题库(频考版)含答案解析
评论
0/150
提交评论