


版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Chapter11) is the physical aspect of the computer that can be seen.A) Hardware B) Operating system C)Application program D) Software2) is the brain of a computer.A) Disk B) Memory C)Hardware D) CPU3) The speed of the CPU is measured in . (Choose all that apply.)A) megabytes B) megahertz C)gigabytes
2、D) gigahertz4) Why do computers use zeros and ones?A) because binary numbers are the bases upon which all other number systems are built.B) because combinations of zeros and ones can represent any numbers and characters.C) because binary numbers are simplest.D) because digital devices have two stabl
3、e states and it is natural to use one state for 0 and the other for 1.5) One byte has bits.A) 12 B) 4 C) 16 D) 86) Which of the following are storage devices? (Choose all that apply.)A) hard disk B) CD-ROMC)flash stick D) floppy disk7) is a device to connect a computer to a local area network (LAN).
4、A)Regular modem B) DSL C)NIC D) Cable modem8) are instructions to the computer. (Choose all that apply.)A)Software B) Keyboards C)Hardware D) Programs9) Computer can execute the code in .A)machine language B) high-level language C)assembly language D) none of the above10) translates high-level langu
5、age program into machine language program.A)An assembler B) The operating system C)CPU D) A compiler11) is an operating system.A)Java B)Windows XP C)Visual Basic D)Ada E)C+12) is a program that runs on a computer to manage and control a computer's activities.A)Modem B)Java C)Interpreter D)Operat
6、ing system E)Compiler13) Java was developed by .A)IBM B)Microsoft C)Cisco Systems D)Oracle E)Sun Microsystems14) Java can run from a Web browser.A)servlets B) applets C)Micro Edition programs D) applications15) is an object-oriented programming language. (Choose all that apply.)A)Ada B)Java C)C D)Pa
7、scal E)C+16) is interpreted.A)Ada B)C C)C+ D)Java E)Pascal17) is Architecture-Neutral.A)C+ B)Pascal C)Ada D)Java E)C18) is a technical definition of the language that includes the syntax and semantics of theJava programming language.A)Java IDE B) Java language specification C)Java API D) Java JDK19)
8、 contains predefined classes and interfaces for developing Java programs.A)Java JDK B) Java language specification C)Java API D) Java IDE20) consists of a set of separate programs for developing and testing Java programs,each of which is invoked from a command line.A) Java JDK B) Java IDE C)Java lan
9、guage specification D) Java API21) provides an integrated development environment (IDE) for rapidly developing Javaprograms. Editing, compiling, building, debugging, and online help are integrated in one graphical user interface.A)Java language specification B) Java JDK C)Java IDE D) Java API22) The
10、 main method header is written as:A)public void main(String args)B)public static void main(String args)C)public static void Main(String args)D)public static main(String args)E) public static void main(string args)23) Which of the following statements is correct?A)Every statement in a program must en
11、d with a semicolon.B) Every comment line must end with a semicolon.C) Every line in a program must end with a semicolon.D) Every class must end with a semicolon.E) Every method must end with a semicolon.24) Which of the following statements is correct to display Welcome to Java on the console? (Choo
12、se all that apply.)A)System.out.println("Welcome to Java");B) System.out.print("Welcome to Java");C) System.println('Welcome to Java');D) System.out.println('Welcome to Java');E) System.out.print('Welcome to Java');25) The JDK command to compile a class in
13、 the file Test.java is A)java Test B)java Test.java C)JAVAC Test.java D)javac Test E)javac Test.java26) Which JDK command is correct to run a Java application in ByteCode.class?A)javac ByteCode.java B)javac ByteCodeC)java ByteCode.class D)JA VAC ByteCode E)java ByteCode27) Java compiler translates J
14、ava source code into .A)another high-level language code B)machine code C)Java bytecode D)assembly code28) is a software that interprets Java bytecode.A)Java debugger B) Java compiler C)Java virtual machine D) Java API29) Suppose you define a Java class as follows:public class Test In order to compi
15、le this program, the source code should be stored in a file named A)Test.class C)Test.java D)Test.txt E)Any name with extension .java30) The extension name of a Java bytecode file is A).obj B) .exe C) .class D) .java31) The extension name of a Java source code file is A).java B) .obj C) .exe D) .cla
16、ss32) Which of the following lines is not a Java comment? (Choose all that apply.)A)- comments B)/* comments */ C)* comments * D)/ comments E)/* comments */33) Which of the following are the reserved words? (Choose all that apply.)A) static B) void C) class D) public34) Every statement in Java ends
17、with .A) a semicolon (;) B) an asterisk (*) C)a period (.) D) a comma (,)35) A block is enclosed inside .A) braces B) parentheses C)brackets D) quotes36) The method displays a message dialog box. (Choose all that apply.)Output",Output",Output",Output",A)JOptionPane.displayMessage
18、Dialog(null, "Welcome to Java!", "Example 1.2 JOptionPane.INFORMA TION_MESSAGE);B) JOptionPane.showMessageDialog(null, "Welcome to Java!");C) JOptionPane.showMessageDialog(null, "Welcome to Java!", "Example 1.2 JOptionPane.INFORMA TION_MESSAGE);D) JOptionPane.
19、displayMessage(null, "Welcome to Java!", "Example 1.2JOptionPane.INFORMA TION_MESSAGE);E) JOptionPane.showMessage(null, "Welcome to Java!", "Example 1.2 JOptionPane.INFORMA TION_MESSAGE);37) To use JOptionPane in your program, you may import it using: (Choose all that a
20、pply.) A)import javax.swing.*; B)import javax.swing.JOptionPane;C)import javax.*.JOptionPane; D)import javax.*;1)A2)D3)B, D4)D5)D 6)A, B, C, D 7)C 8)A, D 9)A10)D11)B12)D13)E14)B15)B,E 16)D 17)D18)B19)C 20)A21)C 22)B 23)A 24)A, B25)E26)E27)C28)C29)C 30)C31)A 32)A, C33)A, B,C, D34)A35)A36)B,C 37)A, BC
21、hapter21) Suppose a Scanner object is created as follows: Scanner input = new Scanner(System.in);What method do you use to read an int value?A) input.nextInteger(); B) eger(); C) input.nextInt(); D) ();2) The following code fragment reads in two numbers: (Choose all that apply.) Sc
22、anner input = new Scanner(System.in);int i = input.nextInt(); double d = input.nextDouble();What are the correct ways to enter these two numbers?A) Enter an integer, a space, a double value, and then the Enter key.B) Enter an integer, an Enter key, a double value, and then the Enter key.C) Enter an
23、integer, two spaces, a double value, and then the Enter key.D) Enter a numeric value with a decimal point, a space, an integer, and then the Enter key.3) If you enter 1 2 3, when you run this program, what will be the output?import java.util.Scanner; public class Test1 public static void main(String
24、 args) Scanner input = new Scanner(System.in); System.out.print("Enter three numbers: "); double number1 = input.nextDouble();double number2 = input.nextDouble();double number3 = input.nextDouble();/ Compute averagedouble average = (number1 + number2 + number3) / 3;/ Display result System.
25、out.println(average);A) 1.0 B) 2.0 C) 4.0 D) 3.04) Every letter in a Java keyword is in lowercase.A) true B) false5) Which of the following is a valid identifier? (Choose all that apply.)A) $343 B)radius C)9X D)8+9 E)class6) Which of the following are correct names for variables according to Java na
26、ming conventions? (Choose all that apply.)A)RADIUS B)radius C)FindArea D)Radius E)findArea7) Which of the following are correct ways to declare variables? (Choose all that apply.) A)int length; int width; B) int length, int width;C)int length; width; D) int length, width;8) is the Java assignment op
27、erator.A)= B) = C) := D) =:9) To assign a value 1 to variable x, you write A)1 = x; B)x = 1; C)1 := x; D)x = 1; E)x := 1;10) Which of the following assignment statements is incorrect? (Choose all that apply.) A)i = j = k = 1; B) i = j = k = 1; C)i = 1; j = 1; k = 1; D) i = 1 = j = 1 = k = 1;11) To d
28、eclare a constant MAX_LENGTH inside a method with value 99.98, you write A)final float MAX_LENGTH = 99.98;B)double MAX_LENGTH = 99.98;C)final double MAX_LENGTH = 99.98;D)final MAX_LENGTH = 99.98;12) Which of the following is a constant, according to Java naming conventions? (Choose all that apply.)A
29、)MAX_V ALUE B)COUNT C)Test D)ReadInt E)read13) To improve readability and maintainability, you should declare instead of usingliteral values such as 3.14159.A)constants B) methods C)classes D) variables14) Which of these data types requires the most amount of memory?A)long B) int C) byte D) short15)
30、 To declare an int variable number with initial value 2, you write A)int number = 2; B) int number = 2.0; C)int number = 2L; D) int number = 2l;16) What is the result of 45 / 4?A)11 B) 10 C) 11.25 D) 1217) Which of the following expressions will yield 0.5? (Choose all that apply.) A)(double) (1 / 2)
31、 B)1 / 2 C)1.0 / 2 D)1 / 2.0 E)(double) 1 / 218) Which of the following expression results in a value 1?A)15 % 4 B) 2 % 1 C) 25 % 5 D) 37 % 619) 25 % 1 is .A) 1 B) 2 C) 3 D) 4 E) 020) -25 % 5 is .A) 1 B) 2 C) 3 D) 4 E) 021) 24 % 5 is .A)1 B) 2 C) 3 D) 4 E) 022) -24 % 5 is A)-1 B) -2 C) -3 D) -4 E) 0
32、23) -24 % -5 is .A)3 B) -3 C) 4 D) -4 E) 024) To add a value 1 to variable x, you write (Choose all that apply.)A)x = x + 1; B)x := 1; C)1 + x = x; D)x += 1; E)x = 1 + x;25) To add number to sum, you write (Note: Java is case-sensitive) (Choose all that apply.) A)number = sum + number; B)sum += numb
33、er;C)number += sum; D)sum = sum + number; E)sum = Number + sum;26) Suppose x is 1. What is x after x += 2?A)0 B) 1 C) 2 D) 3 E) 427) Suppose x is 1. What is x after x -= 1?A)0 B) 1 C) 2 D) -1 E) -228) What is x after the following statements? int x = 1;int y = 2;x *= y + 1;A)x is 2. B) x is 3. C) x
34、is 4. D) x is 1.29) What is x after the following statements?int x = 1;x *= x + 1;A)x is 2. B) x is 3. C) x is 1. D) x is 4.30) Math.pow(2, 3) returns .A) 9.0 B) 9 C) 8.0 D) 831) The method returns a raised to the power of b.A)Math.exponent(a, b) B) Math.pow(b, a) C)Math.pow(a, b) D) Math.power(a, b
35、)32) Analyze the following code.public class Test public static void main(String args) int month = 09;System.out.println("month is " + month);A)The program displays month is 9B) The program displays month is 9.0C) The program displays month is 09D) The program has a syntax error, because 0
36、9 is an incorrect literal value.33) What is y displayed in the following code?public class Test1 public static void main(String args) int x = 1;int y = x = x + 1;System.out.println("y is " + y);A) y is 1 because x is assigned to y first.B) y is 2 because x + 1 is assigned to x and then x i
37、s assigned to y.C) y is 0.D) The program has a compile error since x is redeclared in the statement int y = x = x + 1.34) What is i printed?public class Test public static void main(String args) int j = 0;int i = +j + j * 5;System.out.println("What is i? " + i);A) 0 B) 1 C) 6 D) 535) What
38、is i printed in the following code? public class Test public static void main(String args) int j = 0;int i = j+ + j * 5;System.out.println("What is i? " + i);A)5 B) 6 C) 1 D) 036) What is y displayed in the following code? public class Test public static void main(String args) int x = 1;in
39、t y = x+ + x;System.out.println("y is " + y);A)y is 4. B) y is 2. C) y is 3. D) y is 1.37) What is y displayed? public class Test public static void main(String args) int x = 1;int y = x + x+;System.out.println("y is " + y);A) y is 1. B) y is 2. C) y is 4. D) y is 3.38) To assign
40、 a double variable d to a float variable x, you write A) x = (float)d; B) x = (int)d; C)x = (long)d D) x = d;39) What is the printout of the following code: double x = 5.5;int y = (int)x;System.out.println("x is " + x + " and y is " + y);A) x is 5.5 and y is 5.0B) x is 6.0 and y
41、is 6.0C) x is 5.5 and y is 5D) x is 5 and y is 6E) x is 6 and y is 640) Which of the following assignment statements is illegal? (Choose all that apply.)A) float f = -34;B) int t = (int)false;C) short s = 10;D) int t = 4.5;E) int t = 23;41) What is the value of (double)5/2?A)2.5 B) 3 C) 3.0 D) 2.0 E
42、) 242) What is the value of (double)(5/2)?A)3 B) 2.0 C) 2.5 D) 2 E) 3.043) The expression (int)(76.0252175 * 100) / 100 evaluates to .A)76 B) 76.02 C)76.03 D) 76.025217544) If you attempt to add an int, a byte, a long, and a double, the result will be a value.A)int B) byte C) double D) long45) Which
43、 of the following is the correct expression of character 4? A)'4' B) "4" C) 4 D) '0004'46) A Java character is stored in .A)three bytes B) two bytes C)one byte D) four bytes47) Suppose x is a char variable with a value 'b'. What is the printout of the statement Syst
44、em.out.println(+x)?A)b B) d C) c D) a48) Which of the following statement prints smithexam1test.txt? A)System.out.println("smithexam1test.txt");B) System.out.println("smithexam1test.txt");C) System.out.println("smith"exam1"test.txt");D) System.out.println(&quo
45、t;smith"exam1"test.txt");49) Suppose i is an int type variable. Which of the following statements display the character whose Unicode is stored in variable i?A)System.out.println(i); B) System.out.println(i + " ");C)System.out.println(char)i); D) System.out.println(int)i);50
46、) The Unicode of 'a' is 97. What is the Unicode for 'c'?A) 96 B) 99 C) 97 D) 9851) Will System.out.println(char)4) display 4?A)Yes B) No52) What is the printout of System.out.println('z' - 'a')?A)25 B) z C) a D) 2653) An int variable can hold . (Choose all that apply.
47、)A)120.0 B) 120 C) "120" D) "x" E) 'x'54) Which of the following assignment statements is correct? (Choose all that apply.)A)char c = "100" B) char c = 'd' C)char c = 100; D) char c = "d"55) The expression "Java " + 1 + 2 + 3 evaluate
48、s to .A)Java123 B)Java 123 C)java 123 D)Java6 E)Illegal expression56) Note that the Unicode for character A is 65. The expression "A" + 1 evaluates to .A)B B) A1 C)66 D) Illegal expression57) Note that the Unicode for character A is 65. The expression 'A' + 1 evaluates to .A)A1 B)
49、66 C)B D) Illegal expression58) The System.currentTimeMillis() returns .A)the current time in millisecondsB) the current time in milliseconds since midnight, January 1, 1970C) the current time in milliseconds since midnight, January 1, 1970 GMT (the Unix time)D) the current time in milliseconds sinc
50、e midnightE) the current time59) Programming style is important, because . (Choose all that apply.)A)good programming style can make a program run fasterB) a program may not compile if it has a bad styleC) good programming style helps reduce programming errorsD) good programming style makes a progra
51、m more readable60) According to Java naming convention, which of the following names can be variables? (Choose all that apply.)A)TOTAL_LENGTH B)totalLength C)class D)findArea E)FindArea61) If a program compiles fine, but it produces incorrect result, then the program suffersA)a logic error B)a compi
52、lation error C)a runtime error62) The method displays an input dialog for reading a string. (Choose all that apply.)A) String string = JOptionPane.showInputDialog("Enter a string", "Input Demo", JOptionPane.QUESTION_MESSAGE);B) String string = JOptionPane.showInputDialog(null, &q
53、uot;Enter a string", "Input Demo", JOptionPane.QUESTION_MESSAGE);C) String string = JOptionPane.showInputDialog(null, "Enter a string");D) String string = JOptionPane.showInputDialog("Enter a string");E) String string = JOptionPane.showMessageDialog(null, "Ent
54、er a string", "Input Demo", JOptionPane.QUESTION_MESSAGE);63) The method parses a string s to an int value.A) integer.parseInt(s); B)Integer.parseInteger(s); C)integer.parseInteger(s); D) Integer.parseInt(s);64) The method parses a string s to a double value.A) Double.parsedouble(s);
55、B) double.parse(s);C)double.parseDouble(s); D) Double.parseDouble(s);65) Analyze the following code.import javax.swing.*;public class ShowErrors public static void main(String args) int i;int j;String s = JOptionPane.showInputDialog(null,"Enter an integer", "Input",JOptionPane.QU
56、ESTION_MESSAGE);j = Integer.parseInt(s);i = (i + 4);A) The program compiles but has a runtime error because i does not have an initial value when it is used in i = i + 4;B) The program compiles and runs fine.C) The program cannot compile because i does not have an initial value when it is used in i
57、= i + 4;D) The program cannot compile because j is not initialized.1) C 2)A, B, C 3)B 4)A 5)A, B 6)B, E 7)A, D 8)B 9)B 10)A, D 11)C 12)A, B 13)A 14)A 15)A 16)A 17)C, D, E 18)D 19)E 20)E 21)D 22)D 23)D 24)A, D, E 25)B, D 26)D 27)A 28)B29)A 30)C 31)C 32)D 33)B 34)C 35)A 36)C 37)B 38)A 39)C 40)B, D 41)
58、A 42)B 43)A 44)C 45)A46)B 47)C 48)B 49)C 50)B 51)B 52)A 53)B, E 54)B, C 55)B 56)B 57)B 58)C 59)C, D 60)B, D 61)A 62)B, C, D 63)D 64)D 65)CChapter31)The "less than or equal to" comparison operator in Java is .A)<< B) != C) =< D) <= E) <2) The equal comparison operator in Java is .A)!= B) <> C) A= D)=3) What is 1 + 1 + 1 + 1 + 1 = 5?A)true B)false C)There is no guarantee that 1 + 1 + 1 + 1 + 1 = 5 is true.4) What is 1.0 + 1.0 + 1.0 + 1.0 + 1.0 = 5.0? A)true B)false C)There is no guarantee that 1.0 + 1.0 + 1.0 + 1.0 + 1.0 = 5.0 is true.5) In Java, the wo
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 建筑安裝工程承包合同經(jīng)典版模板5篇
- 技術(shù)人才定向培養(yǎng)與合作合同
- 度家庭教師聘任合同
- 山西省存量房買賣合同8篇
- 科技創(chuàng)新合作四邊合同書
- 2025年標(biāo)準(zhǔn)餐飲租賃合同文本
- 2025年農(nóng)村交通新建工程合同文件
- 大廈改造工程合同范本
- 深圳商業(yè)房產(chǎn)買賣合同范本
- 外貿(mào)貨物運(yùn)輸合同標(biāo)準(zhǔn)文本
- 脊柱內(nèi)鏡應(yīng)用與進(jìn)展
- 鹿茸的現(xiàn)代藥理研究報(bào)告
- 化工行業(yè)儀表典型事故分析報(bào)告
- 2024年初級(jí)會(huì)計(jì)職稱《初級(jí)會(huì)計(jì)實(shí)務(wù)》真題匯編及答案
- 醫(yī)用耗材配送服務(wù)方案
- 中職統(tǒng)編《金屬材料與熱處理》系列課件 第3章 鐵碳合金(動(dòng)畫) 云天系列課件
- 人教版七年級(jí)下冊(cè)地理全冊(cè)復(fù)習(xí)知識(shí)點(diǎn)匯總課件
- 外墻瓷磚隱患排查施工方案
- 21 自然界和社會(huì)
- 反腐倡廉廉潔行醫(yī)
- 國(guó)家公務(wù)員考試準(zhǔn)考證模板
評(píng)論
0/150
提交評(píng)論