77
Exposure Java PreAP Computer Science Chapters 1 – 6 Semester 1 Examination THIS EXAM IS A KEY. DO NOT WRITE ON THIS EXAM. 01. What is the “Exposure Equation”? (A) Exposure + Obvious = Bewilderment ### (B) Bewilderment + Exposure = Obvious (C) Obvious + Bewilderment = Exposure (D) New Concepts + Exposure = Bewilderment 02. Who is considered the “Father of Computers”? (A) Steven Jobbs (B) Herman Hollerith ### (C) Charles Babbage (D) Bill Gates. 03. Who is considered the “Mother of Programming”? ### (A) Ada Lovelace. (B) Grace Hopper. (C) Jacky Kilby. (D) Belinda Gates. 04. Herman Hollerith created a tabulating machine for the Bureau of Census. He left the Bureau of Census and founded a company, which today is called Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 1 Updated 05-10-12

Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

Embed Size (px)

Citation preview

Page 1: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

Exposure Java PreAP Computer Science

Chapters 1 – 6 Semester 1 Examination

THIS EXAM IS A KEY.DO NOT WRITE ON THIS EXAM.

01. What is the “Exposure Equation”?

(A) Exposure + Obvious = Bewilderment### (B) Bewilderment + Exposure = Obvious

(C) Obvious + Bewilderment = Exposure(D) New Concepts + Exposure = Bewilderment

02. Who is considered the “Father of Computers”?

(A) Steven Jobbs(B) Herman Hollerith

### (C) Charles Babbage(D) Bill Gates.

03. Who is considered the “Mother of Programming”?

### (A) Ada Lovelace.(B) Grace Hopper.(C) Jacky Kilby.(D) Belinda Gates.

04. Herman Hollerith created a tabulating machine for the Bureau of Census. He left the Bureau ofCensus and founded a company, which today is called

(A) Microsoft(B) Apple(C) EDS

### (D) IBM.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 1 Updated 05-10-12

Page 2: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

05. Who invented the planar transistor, which lead to the development of the microchip?

(A) Bill Gates### (B) Jack Kilby

(C) John Napier(D) Charles Babbage

06. When comparing computer and human capabilities, which of the following statements is false?

(A) Computers are faster than people.(B) Computers are more accurate than people.(C) Computers do not forget stored information as easily as people.

### (D) Computers are more creative than people.

07. How many BITs are in a byte?

### (A) 8(B) 16(C) 32(D) 64

08. People use _______ numbers and computers use _______ numbers.

(A) base 2 base 10(B) base 10 base 5

### (C) base 10 base 2(D) base 16 base 2

09. Early computers used _______. Today’s computers use _______.

### (A) vacuum tubes microchips(B) microchips transistors(C) transistors vacuum tubes(D) microchips vacuum tubes

10. Which of the following is erased when you turn off the computer?

(A) ROM### (B) RAM

(C) CPU(D) CD-ROM

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 2 Updated 05-10-12

Page 3: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

11. Which of the following is the “brains” of the computer?

(A) ROM(B) RAM

### (C) CPU(D) CD-ROM

12. About how many bytes are in a gigabyte?

(A) 1000(B) 1024(C) 1 million

### (D) 1 billion(E) 1 trillion

13. Which of the following is an example of a digital device?

(A) A speedometer with a rotating needle(B) A protractor

### (C) A watch with numbers only(D) A measuring tape

14. Which of the following has the quickest access?

(A) A disk drive(B) A hard drive

### (C) Internal memory(D) A CD-ROM drive(E) A tape drive

15. Which of the following is an example of secondary storage?

(A) Hard drive(B) CD Rom(C) Memory stick(D) Floppy diskette

### (E) All of the above

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 3 Updated 05-10-12

Page 4: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

16. A _______ is a sequence of instructions that makes a computer perform a desired task.

(A) disk drive### (B) program

(C) printer(D) compiler

17. A(n) _______ translates the program one line a time during execution, while a(n) _______ translatesthe entire program first before execution.

(A) compiler interpreter### (B) interpreter compiler

(C) monitor programmer(D) programmer monitor

18. A _______ level language is very close to English instructions, while a _______ level languageis very close to machine code.

### (A) high low(B) low medium(C) medium high(D) low high

19. The first successful programming language was designed for math and science programs.What is the name of that language?

### (A) FORTRAN(B) COBOL(C) BASIC(D) Pascal(E) Assembly

20. Who developed the first translator and helped create the language COBOL?

(A) Bjarne Stroustrup(B) Nicholas Wirth

### (C) Grace Hopper(D) Bill Gates

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 4 Updated 05-10-12

Page 5: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

21. Who or what motivated the creation of the Internet?

(A) Bill Gates with Microsoft(B) Herman Hollerith

### (C) The Department of Defense during the Cold War(D) structured

22. Which of the following networks has at least one dedicated computer to handle services like logging on, network printing, and file sharing?

(A) peer-to-peer### (B) client-server

(C) Sneakernet(D) Internet

23. Which of the following is an example of hardware?

(A) Monitor(B) Keyboard(C) Microsoft Word(D) Windows 7

### (E) Both A & B

24. Which of the following is an example of system software?

(A) Monitor(B) Keyboard(C) Microsoft Word

### (D) Windows 7(E) Both C & D

25. Which of the following is an example of application software?

(A) Monitor(B) Keyboard

### (C) Microsoft Word(D) Windows 7(E) Both C & D

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 5 Updated 05-10-12

Page 6: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

26. A programming language is considered ____________________ if program source code createdon one type of platform can execute on another platform without any difficulty.

(A) Java(B) reliable

### (C) platform independent(D) structured

27. Which translator is used by Java?

(A) A compiler only.(B) An interpreter only

### (C) Both a compiler and an interpreter.(D) Either a compiler or an interpreter, but not both.

28. Java bytecode is the

(A) translated machine code used by the computer to execute a program.(B) program source code written by programmers.

### (C) intermediate code, that is low-level, but not yet ready to execute.(D) special code required to create Java applets.

29. Java source code is converted to bytecode with

(A) an interpreter.### (B) a compiler.

(C) a compiler and an interpreter.(D) JCreator.

30. An applet is a

### (A) Java program that runs inside a web page.(B) small Java program.(C) Java program that only runs on an Apple computer.(D) single file Java program.(E) Java program that runs in a stand-alone environment.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 6 Updated 05-10-12

Page 7: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

31. An application is a

(A) Java program that runs inside a web page.(B) small Java program.(C) Java program that only runs on an Apple computer.(D) single file Java program.

### (E) Java program that runs in a stand-alone environment.

32. Look at this screen display. Which files have been compiled?

(A) Java0201.java only(B) Java0202.java only(C) Java0203.java only

### (D) Java0201.java and Java0202.java only(E) All of the Java files have been compiled.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 7 Updated 05-10-12

Page 8: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

33. What is the output of this program?

### (A) AP Computer Science I (B) APComputerScienceI

(C) AP (D) AP ComputerComputerScience Science II

(E) No Output

34. What is the output of this program?

(A) AP Computer Science I (B) APComputerScienceI

### (C) AP (D) AP ComputerComputerScience Science II

(E) No Output

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 8 Updated 05-10-12

Page 9: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

35. What is the output of this program?

(A) AP Computer Science I ### (B) APComputerScienceI

(C) AP (D) AP ComputerComputerScience Science II

(E) No Output

36. What is the output of this program?

(A) AP Computer Science I (B) APComputerScienceI

(C) AP (D) AP ComputerComputerScience Science II

### (E) No Output

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 9 Updated 05-10-12

Page 10: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

37. What is the output of this program?

(A) AP Computer Science I (B) APComputerScienceI

(C) AP ### (D) AP ComputerComputerScience Science II

(E) No Output

38. What is WRONG with this program?

(A) The name of the file does not match the name of the class.### (B) There is a semicolon missing at the end of one of the program statements.

(C) There are print and println statements in the same program.(D) There is nothing wrong with this program.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 10 Updated 05-10-12

Page 11: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

39. What is WRONG with this program?

### (A) The name of the file does not match the name of the class.(B) There is a semicolon missing at the end of one of the program statements.(C) There are print and println statements in the same program.(D) There is nothing wrong with this program.

40. If the program class name is Test05 then the program file name must be

(A) Test05(B) JavaTest05

### (C) Test05.java(D) Test05.class

41. Java program statements end with a

### (A) semi-colon.(B) period.(C) comma.(D) colon.

42. A program with one or more compile errors

(A) can compile, but the output execution will be wrong.(B) can compile, but the output execution will be very slow.

### (C) cannot compile, and as a consequence cannot execute.(D) can compile, but will stop executing at the point of the compile error.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 11 Updated 05-10-12

Page 12: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

43. The syntax (sentence structure) of the source code Java program must be _________ percent correctbefore the source code can be translate into a bytecode file.

### (A) 100(B) 95(C) 90(D) 50

44. Java comments are

### (A) optional in a program.(B) are required in a program.(C) must be removed from a program before execution.(D) required, but may only be placed at the top of a program.

45. Every program must start with

(A) public static void main(String args[])### (B) public class <some class name>

(C) // <Program file name>(D) any program statement, as long as the statement uses correct Java syntax.

46. Java program statements must be placed

(A) anywhere in the program.(B) at the beginning of the program only.

### (C) between a set of braces.(D) between a set of parentheses.

47. You need to protect your computer from

(A) physical damage.(B) viruses.(C) hackers.

### (D) all of the above.

48. Hacking into a web site or another computer

(A) is fine, as long as nothing is altered on the web page or computer.(B) is fine, as long as you do not use any private information like somebody's identity.(C) is fine, as long as the web page or computer does not have any password protection.

### (D) is always wrong.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 12 Updated 05-10-12

Page 13: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

49. Downloading Internet software is

(A) always wrong.(B) only correct if you pay for the software.

### (C) correct if you make the required payment or download software that is indicated as freeware.(D) always free if you do not make a profit with the downloaded software.

50. A virus is

(A) normally a harmless Internet program.### (B) a program that duplicates itself and can be mildly annoying or very destructive.

(C) a program that stops annoying email messages.(D) a pop-up window that sells some product.

51. Consider the two program segments below.

Segment A Segment B

int a; int a = 100;int b; int b = 200;a = 100;b = 200;

What is true about the comparison of these two segments?

(A) Segment A is correct and segment B is not correct.(B) Segment A is incorrect and segment B is correct.

### (C) Segment A and segment B are both correct.(D) segment A and segment B are both incorrect.

52. Which of the following are examples of reserved words?

### (A) public, void and static(B) System, out and println(C) System, public and void(D) print, println and args

53. Which of the following is a Java integer data type?

(A) boolean(B) char(C) double

### (D) int(E) String

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 13 Updated 05-10-12

Page 14: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

54. Which of the following is a Java real number data type?

(A) boolean(B) char

### (C) double(D) int(E) String

55. Which of the following would be ideal for storing someone middle initial?

(A) boolean### (B) char

(C) double(D) int(E) String

56. Which of the following would you need to store somebody’s name?

(A) boolean(B) char(C) double(D) int

### (E) String

57. Which of the following can only store 2 possible values: true or false?

### (A) boolean(B) char(C) double(D) int(E) String

58. Assume x is defined as an int. Which of the following will add 1 to x?

(A) x++;(B) x+=1;(C) x = x + 1;

### (D) All of the above

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 14 Updated 05-10-12

Page 15: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

59. Which operator is used for multiplication?

(A) +(B) –

### (C) *(D) /(E) %

60. '7' is a(n) _______ value.

(A) boolean### (B) char

(C) double(D) int(E) String

61. Which of these is not a Java comment symbol?

(A) //### (B) \\

(C) /*(D) */

62. What is the output of this program?

(A) 2(B) 2.5(C) 150(D) 25000

### (E) 250 100

63. What is the output of this program?

(A) 2(B) 2.5

### (C) 150(D) 25000(E) 250 100

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 15 Updated 05-10-12

Page 16: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

64. What is the output of this program?

(A) John(B) John Smith

### (C) JohnSmith(D) Smith, John(E) John C. Smith

65. What is the output of this program?

(A) John### (B) John Smith

(C) JohnSmith(D) Smith, John(E) John C. Smith

66. What is the output of this program?

(A) John(B) John Smith(C) JohnSmith

### (D) Smith, John(E) John C. Smith

67. What is the output of this program?

(A) 100(B) 200(C) 300

### (D) 100200(E) 100 200

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 16 Updated 05-10-12

Page 17: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

68. What is the output of this program?

(A) 100(B) 200

### (C) 300(D) 100200(E) 100 200

69. What is the output of this program?

(A)

(B)

(C) No Output

### (D) Compiler Error

70. Assume the variables a, b, and q are defined as int.Which Java statement below represents the mathematical expression ?

(A) 6a – b / q + 8(B) 6 * a – b / q + 8(C) (6a – b) / (q + 8)(D) (6 * a – b) / q + 8

### (E) (6 * a – b) / (q + 8)

71. What is the output of the program segment below?

int number = 5 + 8 * 3 + 2;System.out.println(number);

### (A) 31(B) 41(C) 45(D) 65

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 17 Updated 05-10-12

6a – b q + 8

Page 18: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

72. What is the output of the program segment below?

int number = (5 + 8) * (3 + 2);System.out.println(number);

(A) 31(B) 41(C) 45

### (D) 65

73. What is the output of the program segment below?

int a = 2;int b = 7;int c = 11;int d = (a + b) * c;d = d + 1;int e = d / 2;System.out.println(e);

(A) 40### (B) 50

(C) 80(D) 99(E) 100

74. What value is stored in number by executing the statement number = 7 / 2; ?Assume that number is declared to be an integer number data type.

(A) 3.5### (B) 3

(C) 1(D) 4

75. What value is stored in number by executing the statement number = 7.0 / 2.0; ?Assume that number is declared to be a real number data type.

### (A) 3.5(B) 3(C) 1(D) 4

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 18 Updated 05-10-12

Page 19: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

76. In English, several words can combine into a sentence.In Java, several keywords can combine into a _______.

(A) class(B) method(C) keysentence

### (D) program statement

77. Multiple methods are stored in a _______.

### (A) class(B) keyword(C) keysentence(D) program statement

78. In the statement: double x = Math.sqrt(1024);Math is the

(A) parameter(B) method identifier

### (C) class identifier(D) separator between the method identifier and the class identifier.

79. In the statement: double x = Math.sqrt(1024);sqrt is the

(A) parameter### (B) method identifier

(C) class identifier(D) separator between the method identifier and the class identifier.

80. In the statement: double x = Math.sqrt(1024);1024 is the

### (A) parameter(B) method identifier(C) class identifier(D) separator between the method identifier and the class identifier.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 19 Updated 05-10-12

Page 20: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

81. What is the output of this statement? System.out.println(Math.sqrt(25));

(A) -25(B) -5

### (C) 5(D) 25(E) NaN

82. What is the output of this statement? System.out.println(Math.sqrt(-25));

(A) -25(B) -5(C) 5(D) 25

### (E) NaN

83. What is the output of this statement? System.out.println(Math.abs(25));

(A) -25(B) -5(C) 5

### (D) 25(E) NaN

84. What is the output of this statement? System.out.println(Math.abs(-25));

(A) -25(B) -5(C) 5

### (D) 25(E) NaN

85. What is the output of this statement? System.out.println(Math.sqrt(Math.abs(-25)));

(A) -25(B) -5

### (C) 5(D) 25(E) NaN

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 20 Updated 05-10-12

Page 21: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

86. What is the output of this statement? System.out.println(Math.sqrt(Math.sqrt(16)));

(A) 1### (B) 2

(C) 4(D) 16(E) NaN

87. What is the output of this statement? System.out.println(Math.round(8.4999));

(A) 0### (B) 8

(C) 8.5(D) 9(E) NaN

88. What is the output of this statement? System.out.println(Math.round(8.5));

(A) 0(B) 8(C) 8.5

### (D) 9(E) NaN

89. What is the output of this statement? System.out.println(Math.pow(5,2));

(A) 1(B) 10

### (C) 25(D) 32(E) NaN

90. What is the output of this statement? System.out.println(Math.pow(2,5));

(A) 1(B) 10(C) 25

### (D) 32(E) NaN

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 21 Updated 05-10-12

Page 22: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

91. Which of the following is an attribute of the Math class?

(A) sqrt(B) abs(C) round(D) pow

### (E) PI

92. Which of the following methods cannot be in an applet program?

(A) paint### (B) main

(C) drawLine(D) fillCircle(E) setColor

93. Where are the height and width of an applet window specified?

(A) in the .java file(B) in the .class file

### (C) in the .html file(D) in the .rbt file(E) in the .exe file

94. Assume you have a 1000 by 650 applet window.Which of the following commands will draw a diagonal line from the top-left cornerto the bottom-right corner?

(A) Expo.drawLine(g,0,999,0,649);(B) Expo.drawLine(g,0,649,0,999);

### (C) Expo.drawLine(g,0,0,999,649);(D) Expo.drawLine(g,0,0,649,999);

95. Assume you have a 1000 by 650 applet window.Which of the following commands will draw a solid square?

(A) Expo.drawRectangle(g,100,100,300,300);(B) Expo.drawRectangle(g,100,100,400,600);

### (C) Expo.fillRectangle(g,100,100,300,300);(D) Expo.fillRectangle(g,100,100,400,600);

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 22 Updated 05-10-12

Page 23: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

96. Assume you have a 1000 by 650 applet window.Which of the following commands will draw a circle in the EXACT center of the applet window?

### (A) Expo.drawCircle(g,400,300,100);(B) Expo.drawCircle(g,300,400,100);(C) Expo.drawCircle(g,500,325,100);(D) Expo.drawCircle(g,325,500,100);

97. Assume you have a 1000 by 650 applet window.Which of the following program segments will make the entire applet window red?

(A) Expo.setColor(Expo.red);Expo.drawRectangle(g,0,0,1000,650);

(B) Expo.setColor(Expo.red);Expo.drawRectangle(g,0,0,650,1000);

### (C) Expo.setColor(g, Expo.red);Expo.fillRectangle(g,0,0,1000,650);

(D) Expo.setColor(g, Expo.red);Expo.fillRectangle(g,0,0,650,1000);

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 23 Updated 05-10-12

Page 24: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

In Questions 98-100 you are provided with the output of a graphics program.You need to determine which program statement created the output.

You may need to use your provided Graphics Sheet to help you answer these questions.

98. Which program statement created this output?Assume the applet window size is 1000 by 650.

(A) Expo.drawOval(g,500,325,150,300);

(B) Expo.drawOval(g,500,325,300,150);

### (C) Expo.fillOval(g,500,325,150,300);

(D) Expo.fillOval(g,500,325,300,150);

99. Which program statement created this output?Assume the applet window size is 1000 by 650.

(A) Expo.drawOval(g,500,325,150,300);

### (B) Expo.drawOval(g,500,325,300,150);

(C) Expo.fillOval(g,500,325,150,300);

(D) Expo.fillOval(g,500,325,300,150);

100. Which program statement created this output?Assume the applet window size is 800 by 600,and that each square in the grid is 100 by 100.

(A) Expo.drawArc(g,400,300,200,200,45,135);

(B) Expo.drawArc(g,400,300,200,200,135,45);

(C) Expo.fillArc(g,400,300,200,200,45,135);

### (D) Expo.fillArc(g,400,300,200,200,135,45);

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 24 Updated 05-10-12

Page 25: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

101. Which of the following are the three general types of control structures?

(A) conditional sequence, branching, selection### (B) simple sequence, selection, repetition

(C) selection, Repetition, repetition(D) simple sequence, branching, decision making

102. Selection is also called

### (A) conditional branching or decision making.(B) conditional sequence or Repetition.(C) conditional branching or Repetition.(D) decision making or conditional repetition

103. A conditional statement is

### (A) a program expression that evaluates to true or false.(B) a program statement that requires input from the keyboard.(C) any program statement with a binary operator.(D) any program statement with a unary operator.

104. Which of the following is the relational operator meaning "equal to”?

(A) =### (B) ==

(C) !=(D) >=(E) <

105. Which of the following is not a relational operator?

### (A) =(B) ==(C) !=(D) >=(E) <

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 25 Updated 05-10-12

Page 26: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

106. What type of value is stored in variable sum?

System.out.print("Enter 1st Number ===>> ");String number1 = Expo.enterString();System.out.print("Enter 2nd Number ===>> ");String number2 = Expo.enterString();String sum = number1 + number2;

(A) The addition of number1 and number2### (B) The concatenation of number1 and number2

(C) The value of number1.(D) The value of number2.

107. What type of value is stored in variable sum?

System.out.print("Enter 1st Number ===>> ");int number1 = Expo.enterString();System.out.print("Enter 2nd Number ===>> ");int number2 = Expo.enterString();int sum = number1 + number2;

### (A) The addition of number1 and number2(B) The concatenation of number1 and number2(C) The value of number1.(D) The value of number2.

108. Which Java keyword or keywords are used for one-way selection?

### (A) if only

(B) if ... then only

(C) if ... else only

(D) if ... then ... else

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 26 Updated 05-10-12

Page 27: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

109. What is the output of the following program segment?

double bonus = 100.0;double sales = 400000.0;if (sales >= 300000.0)

bonus += 250.0;System.out.println("Bonus: " + bonus);

(A) Bonus: 100.0

(B) Bonus: 250.0

### (C) Bonus: 350.0

(D) No output

110. What is the output of the following program segment?

double bonus = 100.0;double sales = 200000.0;if (sales >= 300000.0){

bonus += 250.0;System.out.println("Bonus: " + bonus);

}

(A) Bonus: 100.0

(B) Bonus: 250.0

(C) Bonus: 350.0

### (D) No output

111. Which of the following Java keywords are used for two-way selection?

(A) if only

(B) if ... then only

### (C) if ... else only

(D) if ... then ... else

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 27 Updated 05-10-12

Page 28: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

112. What is the output of the following program segment?

int num = 25;if (num < 50)

System.out.println("Less than 50");else

System.out.println("Greater than or equal to 50");

### (A) Less than 50

(B) Greater than or equal to 50

(C) Less than 50Greater than or equal to 50

(D) No output

113. What is the output of the following program segment?

int num = 50;if (num < 50)

System.out.println("Less than 50");else

System.out.println("Greater than or equal to 50");

(A) Less than 50

### (B) Greater than or equal to 50

(C) Less than 50Greater than or equal to 50

(D) No output

114. What do selection control structures and repetition control structures have in common?

(A) Both structures require user input.(B) Both structures generate output.

### (C) Both structures require a conditional statement.(D) Both structures require a user-created function.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 28 Updated 05-10-12

Page 29: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

115. What is the output of the following program segment?

for (int k = 1; k <= 5; k++) System.out.println(k);

(A) 12345

(B) 1 2 3 4 5

### (C) 12345

(D) 54321

116. What is the output of the following program segment?

for (int k = 4; k < 4; k++){ System.out.println("What is QWERTY?”);}System.out.println("The End");

(A) What is QWERTY?What is QWERTY?The End

### (B) What is QWERTY?What is QWERTY?What is QWERTY?The End

(C) What is QWERTY?What is QWERTY?What is QWERTY?What is QWERTY?The End

(D) The End

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 29 Updated 05-10-12

Page 30: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

117. What is the output of the following program segment?

for (int k = 1; k <= 10; k++) System.out.print(k + " ");

### (A) 1 2 3 4 5 6 7 8 9 10

(B) 1 2 3 4 5 6 7 8 9

(C) 1 2 3 4 5 6 7 8 9 10 11

(D) No output

118. What is the output of the following program segment?

for (int k = 1; k < 10; k++) System.out.print(k + " ");

(A) 1 2 3 4 5 6 7 8 9 10

### (B) 1 2 3 4 5 6 7 8 9

(C) 1 2 3 4 5 6 7 8 9 10 11

(D) No output

119. What is the output of the following program segment?

for (int k = 2; k <= 10; k+=2) System.out.print(k + " ");

(A) 2 3 4 5 6 7 8 9 10

### (B) 2 4 6 8 10

(C) 2 4 6 8 12

(D) No output

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 30 Updated 05-10-12

Page 31: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

120. What is the output of the following program segment?

for (int k = 1; k <= 10; k+=2) System.out.print(k + " ");

(A) 1 2 3 4 5 6 7 8 9 10

### (B) 1 3 5 7 9

(C) 1 3 5 7 9 11

(D) No output

121. What is the output of the following program segment?

int k = 1;while (k <= 5){

System.out.print(k + " "); k++;

}

### (A) 1 2 3 4 5

(B) 1 2 3 4

(C) 1 2 3 4 5 6

(D) 2 3 4 5

122. What is the output of the following program segment?

int k = 1;while (k < 5){

k++; System.out.print(k + " ");

}

(A) 1 2 3 4 5

(B) 1 2 3 4

### (C) 2 3 4 5

(D) 2 3 4 5 6

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 31 Updated 05-10-12

Page 32: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

123. What is displayed by the following program segment?

for (int y = 50; y < 500; y +=10)Expo.drawLine(g,100,y,900,y);

### (A) A set of parallel horizontal lines(B) A set of parallel vertical lines(C) A set of parallel diagonal lines(D) A set of randomly positioned lines

124. What is displayed by the following program segment?

for (int x = 100; x <= 900; x +=10)Expo.drawLine(g,x,100,x,500);

(A) A set of parallel horizontal lines### (B) A set of parallel vertical lines

(C) A set of parallel diagonal lines(D) A set of randomly positioned lines

125. What is displayed by the following program segment?

int x1 = 50;int y1 = 50;int x2 = 200;int y2 = 300;for (int k = 1; k <= 60; k++){

Expo.drawLine(g,x1,y1,x2,y2);x1 += 10;y1 += 5;x2 += 10;y2 += 5;

}

(A) A set of parallel horizontal lines(B) A set of parallel vertical lines

### (C) A set of parallel diagonal lines(D) A set of randomly positioned lines

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 32 Updated 05-10-12

Page 33: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

126. The methods of the Math class are

### (A) class methods.(B) object methods.(C) expression methods.(D) variable methods.

127. The methods of the Expo class are

### (A) class methods.(B) object methods.(C) expression methods.(D) variable methods.

128. The format method of the DecimalFormat class is a(n)

(A) class method.### (B) object method.

(C) expression method.(D) variable method.

129. When you call a class method you must use the format sequence of

(A) method identifier, period separator, class identifier.### (B) class identifier, period separator, method identifier.

(C) object identifier, period separator, method identifier.(D) method identifier, period separator, object identifier.

130. When you call an object method you must use the format sequence of

(A) method identifier, period separator, class identifier.(B) class identifier, period separator, method identifier.

### (C) object identifier, period separator, method identifier.(D) method identifier, period separator, object identifier.

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 33 Updated 05-10-12

Page 34: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

131. What is Bank in the program statement below?

Bank tom = new Bank(5000.0,7500.0);

### (A) a class(B) an object(C) a parameter(D) a sepaerator

132. What is tom in the program statement below?

Bank tom = new Bank(5000.0,7500.0);

(A) a class### (B) an object

(C) a parameter(D) a sepaerator

133. What are 5000.0,7500.0 in the program statement below?

Bank tom = new Bank(5000.0,7500.0);

(A) classes(B) objects

### (C) parameters(D) sepaerators

134. What type of program statement is shown below?

Expo.drawCircle(300,400,50);

(A) A call to an object method### (B) A call to a class method

(C) Declaration of the object tom(D) A call to the Bank constructor method

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 34 Updated 05-10-12

Page 35: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

135. What type of program statement is shown below?

tom.checkingDeposit(1000.0);

### (A) A call to an object method(B) A call to a class method(C) Declaration of the object tom(D) A call to the Bank constructor method

136. The DecimalFormat class has the ability to

(A) round off decimal numbers to a specified number of digits.(B) format numbers with leading zeroes.(C) format numbers with trailing zeroes.

### (D) do all of the above.

137. What is the output of the following program segment?

DecimalFormat money = new DecimalFormat("$0.00");System.out.println(money.format(2.718));

(A) $2.71(B) $2.72(C) $2.718

### (D) Error

138. What is the output of the following program segment?

DecimalFormat output = new DecimalFormat("00000");System.out.println(output.format(1));System.out.println(output.format(12));System.out.println(output.format(123));System.out.println(output.format(1234));

(A) 1121231234

(B) 1 12 123 1234

(C) 00001### 00012

0012301234

(D) 10000120001230012340

(E) 0001001201231234

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 35 Updated 05-10-12

Page 36: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

139. What is the output of the following program segment?

DecimalFormat output = new DecimalFormat("000");System.out.println(output.format(1));System.out.println(output.format(12));System.out.println(output.format(123));System.out.println(output.format(1234));

(A) 1121231234

(B) 1 12 123 1234

(C) 001012123123

(D) 001### 012

1231234

(E) Error

140. Where are random numbers used outside your computer science course?

(A) Advertising(B) Political polling(C) Video games

### (D) All of the above

141. Which of the following will could display any 4-digit number?

(A) System.out.println(1000-9999);(B) System.out.println(Expo.random(1,1000);(C) System.out.println(Expo.random(999,10000);

### (D) System.out.println(Expo.random(1000,9999);(E) System.out.println(Expo.random(1000,2000);

142. Which of the following will display a random negative number in the range of -5000..-3000?

(A) System.out.println(-5000 - -3000);(B) System.out.println(Expo.random(3000,5000);(C) System.out.println(Expo.random(5000,3000);(D) System.out.println(Expo.random(-3000,-5000);

### (E) System.out.println(Expo.random(-5000,-3000);

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 36 Updated 05-10-12

Page 37: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

Use the following graphic to answers questions 143 & 144.

143. Which of the shapes above could have been created with a single drawRegularPolygon command?

### (A) I and II only(B) III and IV only(C) V and VI only(D) All 6 of the above shapes

144. Which of the shapes above could have been created with a single fillRegularPolygon command?

(A) I and II only(B) III and IV only

### (C) V and VI only(D) All 6 of the above shapes

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 37 Updated 05-10-12

Page 38: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

In Questions 145 & 146 you are provided with the output of a graphics program.You need to determine which program statement created the output.

You may need to use your provided Graphics Sheet to help you answer these questions.

145. Which program statement created this output?

(A) Expo.drawPolygon(g,300,50,550,150,350,250,450,350,150,350,250,250,50,150);

(B) Expo.fillPolygon(g,300,50,550,150,350,250,450,350,150,350,250,250,50,150);

### (C) Expo.drawPolygon(g,300,50,550,150,450,350,350,250,250,250,150,350,50,150);

(D) Expo.fillPolygon(g,300,50,550,150,450,350,350,250,250,250,150,350,50,150);

146. Which program statement created this output?

(A) Expo.drawPolygon(g,300,50,550,150,350,250,450,350,150,350,250,250,50,150);

### (B) Expo.fillPolygon(g,300,50,550,150,350,250,450,350,150,350,250,250,50,150);

(C) Expo.drawPolygon(g,300,50,550,150,450,350,350,250,250,250,150,350,50,150);

(D) Expo.fillPolygon(g,300,50,550,150,450,350,350,250,250,250,150,350,50,150);

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 38 Updated 05-10-12

Page 39: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

147. What is the output of this program?

(A) (B) ###

(C) (D)

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 39 Updated 05-10-12

Page 40: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

148. What is the output of this program?

(A) (B)

(C) ### (D)

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 40 Updated 05-10-12

Page 41: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

149. Which program segment created this output?

(A) (B) ###

(C) (D)

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 41 Updated 05-10-12

Page 42: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

150. Which program segment created this output?

(A) (B)

(C) ### (D)

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 42 Updated 05-10-12

Page 43: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

Abridged Reference Sheet for the Expo Class to help with the Semester Exam

Expo.drawPixel(g,100,200);Draws a very small single dot (pixel) on the computer screen 100 pixels over and 200 pixels down.

Expo.drawPoint(g,100,200);Draws a larger (3 pixel by 3 pixel) dot on the computer screen 100 pixels over and 200 pixels down.

Expo.drawLine(g,100,200,300,400);Draws a line segment connecting the starting coordinate point (100,200) with the ending point (300,400).

Expo.drawCircle(g,300,200,100);Draws an open circle with a radius of 100 pixels whose center is located at the coordinate (300,200).

Expo.drawOval(g,300,200,100,50);Draws an open oval with a horizontal radius of 100 pixels and a vertical radius of 50 pixels.The center of this oval is located at the coordinate (300,200).

Expo.drawArc(g,300,200,100,50,90,270);Draws an arc (which is a “piece” of an oval). The arc will begin at 90° (3:00 position) and stop at 270° (9:00 position). This means the arc will be the bottom half of the oval whose center is located at the coordinate (300,200) and has a horizontal radius of 100 pixels and a vertical radius of 50 pixels.

Expo.drawRectangle(g,100,200,300,400);Draws an open rectangle whose upper-left-hand coordinate is (100,200) and whose lower-right-hand coordinate is (300,400).

Expo.setColor(g,Expo.red); Changes the current drawing color to red. 36 color constants are built into the Expo class. 

Expo.fillRectangle(g,100,200,300,400);Draws a solid “filled-in” rectangle.

Expo.fillCircle(g,300,200,100);Draws a solid “filled-in” circle.

Expo.fillOval(g,300,200,100,50);Draws a solid “filled-in” oval.

Expo.fillArc(g,300,200,100,50,90,270);Draws a solid “filled-in” arc (which is a “piece” of a solid “fill-in” oval).

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 43 Updated 05-10-12

Page 44: Exposure C++ - Vernon Computer Sciencevernonmath.com/wp/wp-content/uploads/2014/02/SemEx…  · Web viewExposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44

Graphics Sheet - 1000 x 6500,0 25 50 75 100 125 150 175 200 225 250 275 300 325 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925 950 975 999

25

50

75

100

125

150

175

200

225

250

275

300

325

350

375

400

425

450

475

500

525

550

575

600

625

649

Exposure Java 2012, PreAPCS Edition Semester-1 Exam Chapters 01-06 Page 44 Updated 05-10-12