版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、SSD3選擇題題庫(kù)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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030年中國(guó)圓弧形同步帶數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)冬季型泡沫填縫劑數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年銹石(荔枝面)項(xiàng)目投資價(jià)值分析報(bào)告
- 2025至2030年染色機(jī)電氣控制柜項(xiàng)目投資價(jià)值分析報(bào)告
- 二零二五年度大理石石材加工與建筑工程施工管理合同4篇
- 2025年飾品商鋪?zhàn)赓U與品牌合作與市場(chǎng)拓展合同3篇
- 2025版互聯(lián)網(wǎng)數(shù)據(jù)中心相關(guān)方環(huán)境管理協(xié)議3篇
- 二零二五版鋼筋焊接工藝用工合同模板范文2篇
- 二零二五版模具維修改型與產(chǎn)業(yè)融合合同4篇
- 2025年道路工程質(zhì)量檢測(cè)與驗(yàn)收合同3篇
- 2024年社區(qū)警務(wù)規(guī)范考試題庫(kù)
- 2024年食用牛脂項(xiàng)目可行性研究報(bào)告
- 消防安全隱患等級(jí)
- 溫室氣體(二氧化碳和甲烷)走航監(jiān)測(cè)技術(shù)規(guī)范
- 部編版一年級(jí)語(yǔ)文下冊(cè)第一單元大單元教學(xué)設(shè)計(jì)
- 《保單檢視專(zhuān)題》課件
- 北京地鐵13號(hào)線
- 2023山東春季高考數(shù)學(xué)真題(含答案)
- 職業(yè)衛(wèi)生法律法規(guī)和標(biāo)準(zhǔn)培訓(xùn)課件
- 高二下學(xué)期英語(yǔ)閱讀提升練習(xí)(二)
- 民事訴訟證據(jù)清單模板
評(píng)論
0/150
提交評(píng)論