Short Page Link

https://www.edufilestorage.com/6lt

Full Page Link

https://www.edufilestorage.com/6lt/PDF_2015_AP_Computer_Science_A_Released_Exam_MCQ_Multiple_Choice_Questions_with_Answers_Advanced_Placement.pdf

HTML Code

<a href="https://www.edufilestorage.com/6lt/PDF_2015_AP_Computer_Science_A_Released_Exam_MCQ_Multiple_Choice_Questions_with_Answers_Advanced_Placement.pdf" target="_blank" title="Download from eduFileStorage.com"><img src="https://www.edufilestorage.com/cache/plugins/filepreviewer/4395/pdf/150x190_middle_46f4e7862b1eb5bd4935adbbba5d79e8.jpg"/></a>

Forum Code

[url=https://www.edufilestorage.com/6lt/PDF_2015_AP_Computer_Science_A_Released_Exam_MCQ_Multiple_Choice_Questions_with_Answers_Advanced_Placement.pdf][img]https://www.edufilestorage.com/cache/plugins/filepreviewer/4395/pdf/150x190_middle_46f4e7862b1eb5bd4935adbbba5d79e8.jpg[/img][/url]
Filename: [PDF] 2015 AP Computer Science A Released Exam MCQ Multiple Choice Questions with Answers Advanced Placement.pdf
Filesize: 4.77 MB
Keywords:
Description: Download file or read online AP past exam paper 2015 AP Computer Science A Released Exam MCQ Multiple Choice Questions with Answers and FRQ Free Response Questions with Scoring Guidelines - Collegeboard Advanced Placement.

[PDF] 2015 AP Computer Science A Released Exam MCQ Multiple Choice Questions with Answers Advanced Placement.pdf | Plain Text


2015 AP ® Computer Science A Released Exam Secured for Teacher Use This Released Exa m is provided by the Colleg e Boar d fo r AP Exam preparation . Teacher s ar e permitted to download the material s an d mak e copies to use wit h thei r student s in a classroo m settin g onl y. T o maintai n th e securit y of this exam , teacher s shoul d collec t al l material s afte r thei r administratio n an d keep the m in a secure location . Exam s ma y no t be poste d on schoo l or personal websites, no r electronically redistributed for an y reason. Fu rther distributio n of thes e material s outside of the secur e Colleg e Board sit e disadvantages teacher s wh o rel y on uncirculated questions for classroo m testing . An y additional distribution is in violation of the Colleg e Board ’s copyright policies an d ma y resul t in the terminatio n of Practic e Exa m acces s fo r you r schoo l as well as the removal of access to other online services such as the A P Teache r Communit y an d Onlin e Scor e Repo rts.

Contents Exam Instructions Student Answer Sheet for the Multiple -Choice Section Section I: Multiple -Choice Questions Section II: Free -Response Questions Multiple -Choice Answer Key Free- Response Scoring Guidelines Scoring Worksheet Note: This publication shows the page numbers that appeared in the 2014 −15 AP Exam Instructions book and in th e actual exam. This publication was not repaginated to begin with page 1. © 2015 The College Board. College Board, Advanced Placement Program, AP, SAT and the acorn logo are registered trademarks of the College Board. All other products and services may be trademarks of their respective owners. Permission to use copyrighted College Board materials may be requested online at: ww w.collegeboard.com/inquiry/cbpermit.html.

59 COMPUTER SCIENCE A What Proctors Need to Bring to This Exam • Exam packets • Answer sheets • AP Student Packs • 2014 - 15 AP Coordinato r’s Manual • This book — AP Exam Instructi ons • AP Exam Seating Chart te mplate(s) • School Code and Home-Sc hool/Self- Study Codes • Pencil sharpener • Container for studen ts’ electronic devices (if needed) • Extra No . 2 pencils with e rasers • Extra pens with black or da rk blue ink • Extra paper • Stapler • Wa t c h • Signs for the door to the tes ting room –“Exam in Progress” –“Cell phones are proh ibited in the testing room” SECTION I: Multiple Choice ! Do not begin the exam instructions below until you have completed the appropriate General Instructions for your group. Make sure you begin the exam at the designated time . Remember: You must complete a seating chart for this exam . See pages 279–280 for a seating chart template and instructions . See the 2014-15 AP Coordinator’s Manual for exam seating requirements (pages 48–50, 88) . If you are giving the regularly scheduled exam, say: It is Thursday morning, May 7, and you will be taking the AP Computer Science A Exam. If you are giving the alternate exam for late testing, say: It is Thursday morning, May 21, and you will be taking the AP Computer Science A Exam. AP® Computer Science A Exam Regularly Scheduled Exam Date: Thursday morning, May 7, 2015 Late-Testing Exam Date: Thursday morning, May 21, 2015 Section I Total Time: 1 hr. 15 min. Section II Total Time: 1 hr. 45 min. Section I Total Time: 1 hour 15 minutes Number of Questions: 40* Percent of Total Score: 50% Writing Instrument: Pencil required *The number of questions may vary slightly depending on the form of the exam. Section II Total Time: 1 hour 45 minutes Number of Questions: 4 Percent of Total Score: 50% Writing Instrument: Pencil required Note: The language used on the exam will be Java. The Java Quick Reference is included in the exam booklets. © 2015 The College Board. Visit the College Board on the Web: www.collegeboard.org.

60 Computer Science A In a moment, you will open the packet that contains your exam materials. By opening this packet, you agree to all of the AP Program’s policies and procedures outlined in the 2014 - 15 Bulletin for AP Students and Parents . You may now remove the shrinkwrap from your exam packet and take out the Section I booklet, but do not open the booklet or the shrinkwrapped Section II materials. Put the white seals aside. . . . Carefully remove the AP Exam label found near the top left of your exam booklet cover. Now plac e it on page 1 of your answer sheet on the light blue box near the top right-hand corner that reads “AP Exam Label.” If students accidentally place the exam label in the space for the number label or vice versa, advise them to leave the labels in place . They should not try to remove the label; their exam will be processed correctly . Read the statements on the front cover of Section I and look up when you have finished. . . . Sign your name and write today’s date. Look up when you have finished. . . . Now print your full legal name where indicated. Are there any questions? . . . Turn to the back cover and read it completely. Look up when you have finished. . . . Are there any questions? . . . You will now take the multiple-choice portion of the exam. You should have in front of you the multiple-choice booklet and your answer sheet. You may never discuss these specific multiple-choice questions at any time in any form with anyone, including your teacher and other students. If you disclose these questions through any means, your AP Exam score will be canceled. . . . You must complete the answer sheet using a No. 2 pencil only. Mark all of your responses beginning on page 2 of your answer sheet, one response per question. Completely fill in the circles. If you need to erase, do so carefully and completely. No credit will be given for anything written in the exam booklet. Scratch paper is not allowed, but you may use the margins or any blank space in the exam booklet for scratch work. Are there any questions? . . . The Java Quick Reference is located at the back of the booklet. You have 1 hour and 15 minutes for Section I. Open your Section I booklet and begin. 12 6 3 9 Note Start Time here . Note Stop Time here . Check that students are marking their answers in pencil on their answer sheets, and that they are not looking at their shrinkwrapped Section II booklets . After 1 hour and 5 minutes, say: There are 10 minutes remaining. After 10 minutes, say: Stop working. Close your exam booklet and put your answer sheet on your desk, face up. Make sure you have your AP number label and an AP Exam label on page 1 of your answer sheet. Sit quietly while I collect your answer sheets. © 2015 The College Board. Visit the College Board on the Web: www.collegeboard.org.

61 AP Exam Instructions COMPUTER SCIENCE A Collect an answer sheet from each student . Check that each answer sheet has an AP number label and an AP Exam label . After all answer sheets have been collected, say: Now you must seal your exam booklet using the white seals you set aside earlier. Remove the white seals from the backing and press one on each area of your exam booklet cover marked “PLACE SEAL HERE.” Fold each seal over the back cover. When you have finished, place the booklet on your desk, face up. . . . I will now collect your Section I booklet. Collect a Section I booklet from each student . Check that each student has signed the front cover of the sealed Section I booklet . There is a 10-minute break between Sections I and II . When all Section I materials have been collected and accounted for and you are ready for the break, say: Please listen carefully to these instructions before we take a 10-minute break. All items you placed under your chair at the beginning of this exam must stay there, and you are not permitted to open or access them in any way. Leave your shrinkwrapped Section II packet on your desk during the break. You are not allowed to consult teachers, other students, or textbooks during the break. You may not make phone calls, send text messages, check email, use a social networking site, or access any electronic or communication device. Remember, you may never discuss the multiple- choice questions at any time in any form with anyone, including your teacher and other students. If you disclose these questions through any means, your AP Exam score will be canceled. Are there any questions? . . . 126 3 9 You may begin your break. Testing will resume at . SECTION II: Free Response After the break, say: May I have everyone’s attention? Place your Student Pack on your desk. . . . You may now remove the shrinkwrap from the Section II packet, but do not open the exam booklet until you are told to do so. . . . Read the bulleted statements on the front cover of the exam booklet. Look up when you have finished. . . . Now place an AP number label on the shaded box. If you don’t have any AP number labels, write your AP number in the box. Look up when you have finished. . . . Read the last statement. . . . Using your pen, print the first, middle and last initials of your legal name in the boxes and print today’s date where indicated. This constitutes your signature and your agreement to the statements on the front cover. . . . © 2015 The College Board. Visit the College Board on the Web: www.collegeboard.org.

62 Computer Science A Turn to the back cover and complete Item 1 under “Important Identification Information.” Print the first two letters of your last name and the first letter of your first name in the boxes. Look up when you have finished. . . . In Item 2, print your date of birth in the boxes. . . . In Item 3, writ e the school code you printed on the front of your Student Pack in the boxes. . . . Read Item 4. . . . Are there any questions? . . . I need to collect the Student Pack from anyone who will be taking another AP Exam. You m ay keep it only if you are not taking any other AP Exams this year. If you have no other AP Exams to take, place your Student Pack under your chair now. . . . While Student Packs are being collected, read the information on the back cover of the e xam booklet. Do not open the booklet until you are told to do so. Look up when you have finished. . . . Collect the Student Packs . Then say: Are there any questions? . . . You have 1 hour and 45 minutes for Section II. You must write your answers in the exam booklet using a No. 2 pencil. You are responsible for pacing yourself, and may proceed freely from one question to the next. If you need more paper during the exam, raise your hand. At the top of each sheet of paper you use, be sure to write only your AP number and the number of the question you are working on. Do not write your name. The Java Quick Reference is located at the back of the booklet. Are there any questions? . . . You may begin. 12 6 3 9 Note Start Time here . Note Stop Time here . After 1 hour and 35 minutes, say: There are 10 minutes remaining. After 10 minutes, say: Stop working and close your exam booklet. Place it on your desk, face up. . . . If any students used extra paper for the free-response section, have those students staple the extra sheet(s) to the first page corresponding to that question in their exam booklets . Complete an Incident Report and include any exam booklets with extra sheets of paper in an Incident Report return envelope (see page 57 of the AP Coordinator’s Manual for details) . Then say: Remain in your seat, without talking, while the exam materials are collected. . . . © 2015 The College Board. Visit the College Board on the Web: www.collegeboard.org.

63 AP Exam Instructions COMPUTER SCIENCE A Collect a Section II booklet from each student . Check for the following: • Exam booklet front cover: The student placed an AP number label on the shaded box, and printed his or her initials and today’s date . • Exam booklet ba ck cover: The student completed the “Important Identification Information” area . When all exam materials have been collected and accounted for, return to students any electronic devices you may have collected before the start of the exam . If you are giving the regularly scheduled exam, say: You may not discuss or share these specific free-response questions with anyone unless they are released on the College Board website in about two days. Your AP Exam score results will be available online in July. If you are giving the alternate exam for late testing, say: None of the questions in this exam may ever be discussed or shared in any way at any time. Your AP Exam score results will be available online in July. If any students completed the AP number card at the beginning of this exam, say: Please remember to take your AP number card with you. You will need the information on this card to view your scores and order AP score reporting services online. Then say: You are now dismissed. All exam materials must be placed in secure storage until they are returned to the AP Program after your school’s last administration . Before storing materials, check the “School Use Only” section on page 1 of the answer sheet and: • Fill in the appropriate section number circle in order to access a separate AP Instruc tional Planning Report (for regularly scheduled exams only) or subject score roster at the class section or teacher level . See “Post-Exam Activities” in the 2014 - 15 AP Coordinator’s Manual . • Check your lis t of students who are eligible for fee reductions and fill in the appropriate circle on their registration answer sheets . Be sure to give the completed seating chart to the AP Coordinator . Schools must retain seating charts for at least six months (unless the state or district requires that they be retained for a longer period of time) . Schools should not return any seating charts in their exam shipments unless they are required as part of an Incident Report . © 2015 The College Board. Visit the College Board on the Web: www.collegeboard.org.

Sign your legal name as it will appear on your college applications. Date To maintain the security of the exam and the validity of my AP score, I w\ ill allow no one else to see the multiple-choice questions. I will seal the multiple-choice booklet when asked to do so, and I will not dis\ cuss these questions with anyone at any time after completing the section. I am aware of and agree to the AP Program’s policies and procedures as outlined in the 2014-15 Bulletin for AP Students and Parents, including using testing accommodations (e.g., extended time, computer\ , etc.) only if I have been preapproved by College Board Services for Students with Disabilities.COMPLETE THIS AREA AT EVERY EXAM.USE NO. 2 PENCIL ONLY A. SIGNATURE PAGE 1 AP Exam Label (from Section I Booklet) AP Number Label (from Student Pack) Answer Sheet 2 015 B. LEGAL NAME Omit apostrophes, Jr., II. Legal First Name ? First 12 Letters Legal Last Name ? First 15 Letters MI A A A A A A A A A A A A A A A B B B B B B B B B B B B B B B C C C C C C C C C C C C C C C D D D D D D D D D D D D D D D E E E E E E E E E E E E E E E F F F F F F F F F F F F F F F G G G G G G G G G G G G G G G H H H H H H H H H H H H H H H I I I I I I I I I I I I I I I J J J J J J J J J J J J J J J K K K K K K K K K K K K K K K L L L L L L L L L L L L L L L M M M M M M M M M M M M M M M N N N N N N N N N N N N N N N O O O O O O O O O O O O O O O P P P P P P P P P P P P P P P Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q R R R R R R R R R R R R R R R S S S S S S S S S S S S S S S T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U V V V V V V V V V V V V V V V W W W W W W W W W W W W W W W X X X X X X X X X X X X X X X Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z – – – – – – – – – – – – – 1 2 3 4 5 6 7 8 9 A A A A A A A A A A A A A B B B B B B B B B B B B B C C C C C C C C C C C C C D D D D D D D D D D D D D E E E E E E E E E E E E E F F F F F F F F F F F F F G G G G G G G G G G G G G H H H H H H H H H H H H H I I I I I I I I I I I I I J J J J J J J J J J J J J K K K K K K K K K K K K K L L L L L L L L L L L L L M M M M M M M M M M M M M N N N N N N N N N N N N N O O O O O O O O O O O O O P P P P P P P P P P P P P Q Q Q Q Q Q Q Q Q Q Q Q Q R R R R R R R R R R R R R S S S S S S S S S S S S S T T T T T T T T T T T T T U U U U U U U U U U U U U V V V V V V V V V V V V V W W W W W W W W W W W W W X X X X X X X X X X X X X Y Y Y Y Y Y Y Y Y Y Y Y Y Z Z Z Z Z Z Z Z Z Z Z Z Z – – – – – – – – – – 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 0 0 1 1 2 2 3 3 4 5 6 7 8 9 6 12 7 1 8 2 9 3 10 4 11 5 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 S D. EXAM DATE C. YOUR AP NUMBER Month AM PM F. MULTIPLE-CHOICE BOOKLET SERIAL NUMBER H. AP EXAM I AM TAKING USING THIS ANSWER SHEET Exam Name: Form Code: Form: COMPLETE THIS AREA ONLY ONCE. SCHOOL USE ONLY Fee Reduction Granted Section Number Option 1 Option 2 E. EXAM START TIME 0 0 1 1 2 3 4 5 6 7 8 9 1 2 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 G. ONLINE PROVIDER CODE Day 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 L. SOCIAL SECURITY NUMBER (Optional) 104246-00657• UNLWEB315 Q3914/1- 4 COLLEGE CODE 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 M. COLLEGE TO RECEIVE YOUR AP SCORE REPORT College Name State Country Using the college code listed in the AP Student Pack, indicate the ONE college that you want to receive your AP score report. City SCHOOL CODE 0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 8 8 8 8 8 8 9 9 9 9 9 9 School Name State Country J. SCHOOL YOU ATTEND City 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 INTERNATIONAL PHONE I. AREA CODE AND PHONE NUMBER 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Month DayYear K. DATE OF BIRTH N. CURRENT GRADE LEVEL Not yet in 9th grade 9th 10th 11th 12th No longer in high school B123456789T 779934

P. LANGUAGE — Do not complete this section unless instructed to do so. 1 2 34 5 67 8 9 A B C D E F G H I A B C D E F G H I A B C D E F G H I A B C D E F G H I A B C D E F G H I A B C D E F G H I A B C D E F G H I A B C D E F G H I A B C D E F G H I If this answer sheet is for the French Language and Culture, German Language and Culture, Italian Language and Culture, Spanish Language and Culture, or Spanish Literature and Culture Exam, please answer the following questions. Your responses will not affect your score. 1. Have you lived or studied for one month or more in a country where the language of the exam you are now taking is spoken? Yes No DO NOT WRITE IN THIS AREA O. SURVEY QUESTIONS — Answer the survey questions in the AP Student Pack. Do not put responses to exam questions in this section. PAGE 2 COMPLETE THIS AREA AT EACH EXAM (IF APPLICABLE). Indicate your answers to the exam questions in this section (pages 2 and 3). Mark only one response per question for Questions 1 through 120. If a question has only four answer options, do not mark option E. Answers written in the multiple-choice booklet will not be scored. A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 5051 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 QUESTIONS 1–75 Yes No 2. Do you regularly speak or hear the language at home? A B C D A B C D You must use a No. 2 pencil and marks must be complete. Do not use a mechanical pencil. It is very important that you fill in the entire circle darkly and completely. If you change your response, erase as completely as possible. Incomplete marks or erasures may affect your score. COMPLETE MARK EXAMPLES OF INCOMPLETE MARKS SELECTED MEDIA EXAMS R W O OTHER EXAMS R W O PT02 TOTAL PT03 Subscore (if applicable) PT04 Subscore (if applicable) ETS USE ONLY Exam Exam 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9

/ / / – . . . . . 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 / / / – . . . . . 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 / / / – . . . . . 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 / / / – . . . . . 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 / / / – . . . . . 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 For Students Taking AP Biology / / / – . . . . . 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 121123 122 124125 126 Write your answer in the boxes at the top of the griddable area and fill in the corresponding circles. Mark only one circle in any column. You will receive credit only if the circles are filled in correctly. PAGE 3 DO NOT WRITE IN THIS AREA A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E A B C D E 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10 0 101 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 110111 11 2 11 3 11 4 11 5 11 6 11 7 11 8 11 9 120 Be sure each mark is dark and completely fills the circle. If a question has only four answer options, do not mark option E. QUESTIONS 76–120 © 2014 The College Board. College Board, AP, Student Search Service and the acorn logo are registered trademarks of the College Board. QUESTIONS 121–126 A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D A B C D 131 132 133 134 135 136 137 138139 140 141 142 For Students Taking AP Physics 1 or AP Physics 2 Mark two responses per question. You will receive credit only if both correct responses are selected. QUESTIONS 131–142

X. ETHNICITY/RACE COMPLETE THIS AREA ONLY ONCE. ZIP OR POSTAL CODE COUNTRY CODE PAGE 4 STREET ADDRESS (include street number, street name, apartment number, etc.) CITY A A A A A A A A A A A A A A A A A A A A A A A A A A B B B B B B B B B B B B B B B B B B B B B B B B B B C C C C C C C C C C C C C C C C C C C C C C C C C C D D D D D D D D D D D D D D D D D D D D D D D D D D E E E E E E E E E E E E E E E E E E E E E E E E E E F F F F F F F F F F F F F F F F F F F F F F F F F F G G G G G G G G G G G G G G G G G G G G G G G G G G H H H H H H H H H H H H H H H H H H H H H H H H H H I I I I I I I I I I I I I I I I I I I I I I I I I I J J J J J J J J J J J J J J J J J J J J J J J J J J K K K K K K K K K K K K K K K K K K K K K K K K K K L L L L L L L L L L L L L L L L L L L L L L L L L L M M M M M M M M M M M M M M M M M M M M M M M M M M N N N N N N N N N N N N N N N N N N N N N N N N N N O O O O O O O O O O O O O O O O O O O O O O O O O O P P P P P P P P P P P P P P P P P P P P P P P P P P Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q R R R R R R R R R R R R R R R R R R R R R R R R R R S S S S S S S S S S S S S S S S S S S S S S S S S S T T T T T T T T T T T T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U U U U U U U U U U U U V V V V V V V V V V V V V V V V V V V V V V V V V V W W W W W W W W W W W W W W W W W W W W W W W W W W X X X X X X X X X X X X X X X X X X X X X X X X X X Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 / / / / / / / / / / / / / / / / / / / / / / / / A A A A A A A A A A A A A B B B B B B B B B B B B B C C C C C C C C C C C C C D D D D D D D D D D D D D E E E E E E E E E E E E E F F F F F F F F F F F F F G G G G G G G G G G G G G H H H H H H H H H H H H H I I I I I I I I I I I I I J J J J J J J J J J J J J K K K K K K K K K K K K K L L L L L L L L L L L L L M M M M M M M M M M M M M N N N N N N N N N N N N N O O O O O O O O O O O O O P P P P P P P P P P P P P Q Q Q Q Q Q Q Q Q Q Q Q Q R R R R R R R R R R R R R S S S S S S S S S S S S S T T T T T T T T T T T T T U U U U U U U U U U U U U V V V V V V V V V V V V V W W W W W W W W W W W W W X X X X X X X X X X X X X Y Y Y Y Y Y Y Y Y Y Y Y Y Z Z Z Z Z Z Z Z Z Z Z Z Z A A A A A A A A A B B B B B B B B B C C C C C C C C C D D D D D D D D D E E E E E E E E E F F F F F F F F F G G G G G G G G G H H H H H H H H H I I I I I I I I I J J J J J J J J J K K K K K K K K K L L L L L L L L L M M M M M M M M M N N N N N N N N N O O O O O O O O O P P P P P P P P P Q Q Q Q Q Q Q Q Q R R R R R R R R R S S S S S S S S S T T T T T T T T T U U U U U U U U U V V V V V V V V V W W W W W W W W W X X X X X X X X X Y Y Y Y Y Y Y Y Y Z Z Z Z Z Z Z Z Z 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 / / / / / / / 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 Q. YOUR MAILING ADDRESS Use the address abbreviations from your AP Student Pack. Fill in only one circle per column. Indicate a space in your address by leaving a blank box; do not grid that column. AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD MEMI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VAVT WA WI WV WY Puerto Rico AA AE AP Other S TAT E R. FOR STUDENTS OUTSIDE THE UNITED STATES ONLY T. EMAIL ADDRESS If your address does not fit in the spaces provided in Item Q, fill in as many circles as you can, then fill in the circle in Item R and print the remainder of your address in the spaces provided. Address City State or Province Country ZIP or Postal Code By providing your email address, you are granting the College Board permission to use your email in accordance with the policies in the 2014-15 Bulletin for AP Students and Parents. S. STUDENT IDENTIFIER (Student ID Number) U. STUDENT SEARCH SERVICE ® Colleges and scholarship programs may request your information to inform you of educational opportunities and financial aid. Would you like us to supply your information? If you don’t answer and previously chose to participate in this service, we will continue providing your information. Colleges and scholarship programs may request your information to inform you of educational opportunities and financial aid. Would you like us to supply your information? If you don’t answer and previously chose to participate in this service, we will continue providing your information.Y. PARENTAL EDUCATION LEVEL American Indian or Alaska Native Asian, Asian American or Pacific Islander Black or African American Mexican or Mexican American Puerto Rican Other Hispanic, Latino or Latin American White Other W. WHICH LANGUAGE DO YOU KNOW BEST? Grade school Some high school High school diploma or equivalent Vocational or trade school Some college Associate or two-year degree Bachelor’s or four-year degree Some graduate or professional school Graduate or professional degree Mother or female guardian Father or male guardian V. SEX Female Male English English and another language about the same Another language Yes No In the first column, indicate the highest level of education of your parent/guardian. If you have two parents/guardians, indicate the level of education for your other parent/ guardian in the second column. In the appropriate column for each parent/guardian, indicate whether this is your mother or female guardian or your father or male guardian.

AP ® Computer Science A Exam SECTION I: Multiple Choice 2015 DO NOT OPEN THIS BOOKLET UNTIL YOU ARE TOLD TO DO SO. At a Glance Total Time 1 hour, 15 minutes Number of Questions 40 Percent of Total Score 50% Writing Instrument Pencil required Electronic Device None allowed Instructions The Java Quick Reference is located at the back of this booklet. Section I of this exam contains 40 multiple-choice questions. Fill in only the circles for numbers 1 through 40 on your answer sheet. Indicate all of your answers to the multiple- choice questions on the answer sheet. No credit will be given for anything written in this exam booklet, but you may use the booklet for notes or scratch work. After you have decided which of the suggested answers is best, completely fill in the corresponding circle on the answer sheet. Give only one answer to each question. If you change an answer, be sure that the previous mark is erased completely. Here is a sample question and answer. Use your time effectively, working as quickly as you can without losing accuracy. Do not spend too much time on any one question. Go on to other questions and come back to the ones you have not answered if you have time. It is not expected that everyone will know the answers to all of the multiple- choice questions. Your total score on the multiple- choice section is based only on the number of questions answered correctly. Points are not deducted for incorrect answers or unanswered questions. Form O Form Code 4LBP 31

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -4- COMPUTER SCIENCE A SECTION I Time — 1 hour and 15 minutes Number of questions — 40 Percent of total score — 50 Directions: Determine the answer to each of the following qu estions or incomplete statements, using the available space for any necessary scratch work. Then decide which is the best of the choices given and fill in the corresponding circle on the answer sheet. No credit will be given for a nything written in the examination booklet. Do not spend too much time on any one problem. Notes : • Assume that the classes listed in the Java Quic k Reference have been imported where appropriate. • Assume that declarations of variables and methods appear within the context of an enclosing class. • Assume that method calls that are not prefixed with an object or class name and are not shown within a complete class definition appear within the context of an enclosing class. • Unless otherwise noted in the question, assu me that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. 1. Consider the following incomplete method, which is intende d to return the number of integers that evenly divide the integer inputVal. Assume that inputVal is greater than 0. public static int numDivisors(int inputVal) { int count = 0; for (int k = 1; k 0

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -5- 2. Consider the following code segment. for (int r = 3; r > 0; r--) { int c; for (c = 1; c < r; c++) { System.out.print("-"); } for (c = r ; c

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -6- 3. Consider the following two classes. public class A { public void show() { System.out.print("A"); } } public class B extends A { public void show() { System.out.print("B"); } } What is printed as a result of executing the following code segment? A obj = new B(); obj.show(); (A) A (B) B (C) AB (D) BA (E) The code results in a runtime error.

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -7- 4. Consider the following instance variable and method. private int[] arr; /** Precondition : arr.length > 0 * @return the largest value in array arr */ public int findMax() { int maxVal = 0; for (int val : arr) { if (val > maxVal) { maxVal = val; } } return maxVal; } Method findMax is intended to return the largest value in the array arr. Which of the following best describes the conditions under which the method findMax will not work as intended? (A) The largest value in arr occurs only once and is in arr[0]. (B) The largest value in arr occurs only once and is in arr[arr.length - 1] . (C) The largest value in arr is negative. (D) The largest value in arr is zero. (E) The largest value in arr occurs more than once.

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -8- 5. Assume that x and y are boolean variables and have been properly initialized. (x || y) && x Which of the following always evaluates to the same value as the expression above? (A) x (B) y (C) x && y (D) x || y (E) x != y 6. Consider the following method, which is intended to return true if at least one of the three strings s1, s2 , or s3 contains the substring " art". Otherwise, the method should return false. public static boolean containsArt(String s1, String s2, String s3) { String all = s1 + s2 + s3; return (all.indexOf("art") != –1); } Which of the following method calls demonstrates that the method does not work as intended? (A) containsArt("rattrap", "similar", "today") (B) containsArt("start", "article", "Bart") (C) containsArt("harm", "chortle", "crowbar") (D) containsArt("matriculate", "carat", "arbitrary") (E) containsArt("darkroom", "cartoon", "articulate")

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -9- 7. Consider the following code segment. for (int outer = 1; outer

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -10- 8. Consider the following method. public static int[] operation(int[][] matrix, int r, int c) { int[] result = new int[matrix.length]; for (int j = 0 ; j < matrix.length ; j++) { result[j] = matrix[r][j] * matrix[j][c]; } return result; } The following code segment appears in another method in the same class. int[][] mat = {{3, 2, 1, 4}, {1, 2, 3, 4}, {2, 2, 1, 2}, {1, 1, 1, 1}}; int[] arr = operation(mat, 1, 2); Which of the following represents the contents of arr as a result of executing the code segment? (A) {6, 4, 2, 4} (B) {1, 6, 3, 4} (C) {4, 3, 6, 1} (D) {4, 4, 2, 2} (E) {2, 2, 4, 4}

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -11- 9. A pair of number cubes is used in a game of chance. Each number cube has six sides, numbered from 1 to 6, inclusive, and there is an equal probability for each of the numbers to appear on the top side (indicating the cube's value) when the number cube is rolled. The fo llowing incomplete statement appears in a program that computes the sum of the values produced by rolling two number cubes. int sum = /* missing code */ ; Which of the following replacements for /* missing code */ would best simulate the value produced as a result of rolling two number cubes? (A) 2 * (int) (Math.random() * 6) (B) 2 * (int) (Math.random() * 7) (C) (int) (Math.random() * 6) + (int) (Math.random() * 6) (D) (int) (Math.random() * 13) (E) 2 + (int) (Math.random() * 6) + (int) (Math.random() * 6)

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -12- 10. Consider the following interface and class declarations. public interface Student { /* implementation not shown */ } public class Athlete { /* implementation not shown */ } public class TennisPlayer extends Athlete implements Student { /* implementation not shown */ } Assume that each class has a zero-para meter constructor. Which of the following is NOT a valid declaration? (A) Student a = new TennisPlayer(); (B) TennisPlayer b = new TennisPlayer(); (C) Athlete c = new TennisPlayer(); (D) Student d = new Athlete(); (E) Athlete e = new Athlete();

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -13- 11. Consider the following method. public static boolean mystery(String str) { String temp = ""; for (int k = str.length(); k > 0; k--) { temp = temp + str.substring(k - 1, k); } return temp.equals(str); } Which of the following calls to mystery will return true ? (A) mystery("no") (B) mystery("on") (C) mystery("nnoo") (D) mystery("nono") (E) mystery("noon")

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -14- 12. Assume that x and y are boolean variables and have been properly initialized. (x && y) && !(x || y) Which of the following best describes th e result of evaluating the expression above? (A) true always (B) false always (C) true only when x is true and y is true (D) true only when x and y have the same value (E) true only when x and y have different values

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -15- 13. Consider the following instance variable and method. private int[] numbers; public void mystery(int x) { for (int k = 1; k < numbers.length; k = k + x) { numbers[k] = numbers[k - 1] + x; } } Assume that numbers has been initialized with the following values. {17, 34, 21, 42, 15, 69, 48, 25, 39} Which of the following represents the order of the values in numbers as a result of the call mystery(3) ? (A) {17, 20, 21, 42, 45, 69, 48, 51, 39} (B) {17, 20, 23, 26, 29, 32, 35, 38, 41} (C) {17, 37, 21, 42, 18, 69, 48, 28, 39} (D) {20, 23, 21, 42, 45, 69, 51, 54, 39} (E) {20, 34, 21, 45, 15, 69, 51, 25, 39}

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -16- 14. Consider the following method, biggest, which is intended to return the gr eatest of three integers. It does not always work as intended. public static int biggest(int a, int b, int c) { if ((a > b) && (a > c)) { return a; } else if ((b > a) && (b > c)) { return b; } else { return c; } } Which of the following best describes the error in the method? (A) biggest always returns the value of a. (B) biggest may not work correctly when c has the greatest value. (C) biggest may not work correctly when a and b have equal values. (D) biggest may not work correctly when a and c have equal values. (E) biggest may not work correctly when b and c have equal values.

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -17- 15. Consider the following method. public static void showMe(int arg) { if (arg < 10) { showMe(arg + 1); } else { System.out.print(arg + " "); } } What will be printed as a result of the call showMe(0) ? (A) 10 (B) 11 (C) 0 1 2 3 4 5 6 7 8 9 (D) 9 8 7 6 5 4 3 2 1 0 (E) 0 1 2 3 4 5 6 7 8 9 10

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -18- 16. Consider the following method. /** Precondition: values has at least one row */ public static int calculate(int[][] values) { int found = values[0][0]; int result = 0; for (int[] row : values) { for (int y = 0; y < row.length; y++) { if (row[y] > found) { found = row[y]; result = y; } } } return result; } Which of the following best describes what is returned by the calculate method? (A) The largest value in the two-dimensional array (B) The smallest value in the two-dimensional array (C) The row index of an element with the largest value in the two-dimensional array (D) The row index of an element with the smallest value in the two-dimensional array (E) The column index of an element with the largest value in the two-dimensional array

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -19- 17. Consider the following method. //* Precondition : num > 0 */ public static int doWhat(int num) { int var = 0; for (int loop = 1; loop

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -20- 19. Consider the following code segment. int x = 1; while ( /* condition */ ) { if (x % 2 == 0) { System.out.print(x + " "); } x = x + 2; } The following conditions have been proposed to replace /* condition */ in the code segment. I. x < 0 II. x

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -21- 20. Consider the following method. /** Precondition : arr.length > 0 */ public static int mystery(int[] arr) { int index = 0; int count = 0; int m = -1; for (int outer = 0; outer < arr.length; outer++) { count = 0; for (int inner = outer + 1; inner < arr.length; inner++) { if (arr[outer] == arr[inner]) { count++; } } if (count > m) { index = outer; m = count; } } return index; } Assume that nums has been declared and initialized as an array of integer values. Which of the following best describes the value returned by the call mystery(nums) ? (A) The maximum value that occurs in nums (B) An index of the maximum value that occurs in nums (C) The number of times that the maximum value occurs in nums (D) A value that occurs most often in nums (E) An index of a value that occurs most often in nums

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -22- 21. Consider the following recursive method. public static void whatsItDo(String str) { int len = str.length(); if (len > 1) { String temp = str.substring(0, len – 1); System.out.println(temp); whatsItDo(temp); } } What is printed as a result of the call whatsItDo("WATCH") ? (A) H (B) WATC (C) ATCH ATC AT A (D) WATC WAT WA W (E) WATCH WATC WAT WA

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -23- 22. Consider the following definition. int[][] numbers = {{1, 2, 3}, {4, 5, 6}}; Which of the following code segments produces the output 123456 ? (A) for (int[] row : numbers) { for (int n : row) { System.out.print(n); } } (B) for (int[] row : numbers) { for (int n : row) { System.out.print(row[n]); } } (C) for (int rc = 0; rc < numbers.length; rc++) { System.out.print(numbers[rc]); } (D) for (int r = 0; r < numbers[0].length; r++) { for (int c = 0; c < numbers.length; c++) { System.out.print(numbers[r][c]); } } (E) for (int c = 0; c < numbers[0].length; c++) { for (int r = 0; r < numbers.length; r++) { System.out.print(numbers[r][c]); } }

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -24- 23. Consider the following code segmen t from an insertion sort program. for (int j = 1; j < arr.length; j++) { int insertItem = arr[j]; int k = j - 1; while (k >= 0 && insertItem < arr[k]) { arr[k + 1] = arr[k]; k--; } arr[k + 1] = insertItem; /* end of for loop */ } Assume that array arr has been defined and initialized with the values {5, 4, 3, 2, 1}. What are the values in array arr after two passes of the for loop (i.e., when j = 2 at the point indicated by /* end of for loop */ ) ? (A) {2, 3, 4, 5, 1} (B) {3, 2, 1, 4, 5} (C) {3, 4, 5, 2, 1} (D) {3, 5, 2, 3, 1} (E) {5, 3, 4, 2, 1}

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -25- 24. Consider the following class. public class SomeMethods { public void one(int first) { /* implementation not shown */ } public void one(int first, int second) { /* implementation not shown */ } public void one(int first, String second) { /* implementation not shown */ } } Which of the following methods can be added to the SomeMethods class without causing a compile-time error? I. public void one(int value) { /* implementation not shown */ } II. public void one(String first, int second) { /* implementation not shown */ } III. public void one(int first, int second, int third) { /* implementation not shown */ } (A) I only (B) I and II only (C) I and III only (D) II and III only (E) I, II, and III

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -26- 25. Consider the following code segment. int count = 0; for (int x = 0; x < 4; x++) { for (int y = x; y < 4; y++) { count++; } } System.out.println(count); What is printed as a result of executing the code segment? (A) 4 (B) 8 (C) 10 (D) 16 (E) 20

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -27- 26. Consider the following two methods, which appear within a single class. public static void changeIt(int[] arr, int val, String word) { arr = new int[5]; val = 0; word = word.substring(0, 5); for (int k = 0; k < arr.length; k++) { arr[k] = 0; } } public static void start() { int[] nums = {1, 2, 3, 4, 5}; int value = 6; String name = "blackboard"; changeIt(nums, value, name); for (int k = 0; k < nums.length; k++) { System.out.print(nums[k] + " "); } System.out.print(value + " "); System.out.print(name); } What is printed as a result of the call start() ? (A) 0 0 0 0 0 0 black (B) 0 0 0 0 0 6 blackboard (C) 1 2 3 4 5 6 black (D) 1 2 3 4 5 0 black (E) 1 2 3 4 5 6 blackboard

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -28- Questions 27-28 refer to the following information. Consider the following sort method. This method correctly sorts the elements of array data into increasing order. public static void sort(int[] data) { for (int j = 0; j < data.length - 1; j++) { int m = j; for (int k = j + 1; k < data.length; k++) { if (data[k] < data[m]) /* Compare values */ { m = k; } } int temp = data[m]; /* Assign to temp */ data[m] = data[j]; data[j] = temp; /* End of outer loop */ } } 27. Assume that sort is called with the array {6, 3, 2, 5, 4, 1}. What will the value of data be after three passes of the outer loop (i.e., when j = 2 at the point indicated by /* End of outer loop */) ? (A) {1, 2, 3, 4, 5, 6} (B) {1, 2, 3, 5, 4, 6} (C) {1, 2, 3, 6, 5, 4} (D) {1, 3, 2, 4, 5, 6} (E) {1, 3, 2, 5, 4, 6} 28. Assume that sort is called with the array {1, 2, 3, 4, 5, 6} . How many times will the expression indicated by /* Compare values */ and the statement indicated by /* Assign to temp */ execute? Compare values Assign to temp (A) 15 0 (B) 15 5 (C) 15 6 (D) 21 5 (E) 21 6

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -29- 29. Consider the following recursive method. /** Precondition : num ≥ 0 */ public static int what(int num) { if (num < 10) { return 1; } else { return 1 + what(num / 10); } } Assume that int val has been declared and initialized with a va lue that satisfies the precondition of the method. Which of the following best describes the value returned by the call what(val) ? (A) The number of digits in the decimal representation of val is returned. (B) The sum of the digits in the decimal representation of val is returned. (C) Nothing is returned. A run-time error occurs because of infinite recursion. (D) The value 1 is returned. (E) The value val/10 is returned.

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -30- 30. The price per box of ink pens advertised in an o ffice supply catalog is based on the number of boxes ordered. The following table shows the pricing. Number of Boxes Price per Box 1 up to but not includin g 5 $5.00 5 up to but not including 10 $3.00 10 or more $1.50 The following incomplete method is intended to return the total cost of an order based on the value of the parameter numBoxes. /** Precondition : numBoxes > 0 */ public static double getCost(int numBoxes) { double totalCost = 0.0; /* missing code */ return totalCost; }

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -31- Which of the following code segments can be used to replace /* missing code */ so that method getCost will work as intended? I. if (numBoxes >= 10) { totalCost = numBoxes * 1.50; } if (numBoxes >= 5) { totalCost = numBoxes * 3.00; } if (numBoxes > 0) { totalCost = numBoxes * 5.00; } II. if (numBoxes >= 10) { totalCost = numBoxes * 1.50; } else if (numBoxes >= 5) { totalCost = numBoxes * 3.00; } else { totalCost = numBoxes * 5.00; } III. if (numBoxes > 0) { totalCost = numBoxes * 5.00; } else if (numBoxes >= 5) { totalCost = numBoxes * 3.00; } else if (numBoxes >= 10) { totalCost = numBoxes * 1.50; } (A) I only (B) II only (C) III only (D) I and II (E) II and III

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -32- 31. Consider the following code segment. String[][] board = new String[5][5]; for (int row = 0; row < 5; row++) { for (int col = 0; col < 5; col++) { board[row][col] = "O"; } } for (int val = 0; val < 5; val++) { if (val % 2 == 1) { int row = val; int col = 0; while (col < 5 && row >= 0) { board[row][col] = " X"; col++; row--; } } }

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -33- Which of the following represents board after this code segment is executed? 0 1 2 3 4 0 X O X O X 1 O X O X O 2 X O X O X 3 O X O X O 4 X O X O X (A) 0 1 2 3 4 0 O X O X O 1 X O X O X 2 O X O X O 3 X O X O X 4 O X O X O (B) 0 1 2 3 4 0 X O O O X 1 O X O X O 2 O O X O O 3 O X O X O 4 X O O O X (C) 0 1 2 3 4 0 O X O O O 1 O O X O O 2 X O O X O 3 O X O O X 4 O O X O O (D) 0 1 2 3 4 0 O X O X O 1 X O X O O 2 O X O O O 3 X O O O O 4 O O O O O (E)

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -34- 32. Consider the following class declaration. public class StudentInfo { private String major; private int age; public String getMajor() { return major; } public int getAge() { return age; } // There may be instance variables, constr uctors, and methods that are not shown. } The following instance variable and method appear in another class. private List students; /** @return the average age of students with the given major; * -1.0 if no such students exist */ public double averageAgeInMajor(String theMajor) { double sum = 0.0; int count = 0; for (StudentInfo k : students) { /* missing code */ } if (count > 0) { return sum / count; } else { return -1.0; } }

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -35- Which of the following could be used to replace /* missing code */ so that averageAgeInMajor will compile without error? (A) if (theMajor.equals(k.major)) { sum += k.age; count++; } (B) if (theMajor.equals(k.getMajor())) { sum += k.getAge(); count++; } (C) if (theMajor.equals(k.major)) { sum += k.getAge(); count++; } (D) if (theMajor.equals(students[k].getMajor())) { sum += students[k].getAge(); count++; } (E) if (theMajor.equals(getMajor(k))) { sum += getAge(k); count++; } 33. Which of the following statements regarding in terfaces is FALSE? (A) All methods in an interface are public. (B) An interface cannot be instantiated. (C) An interface can declare an instance variable. (D) A non-abstract class can implement an interface. (E) An abstract class can implement an interface.

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -36- 34. Consider the problem of finding the maximum value in an array of integers. The following code segments are proposed solutions to the problem. Assume that the variable arr has been defined as an array of int values and has been initialized with one or more values. I. int max = Integer.MIN_VALUE; for (int value : arr) { if (max < value) { max = value; } } II. int max = 0; boolean first = true; for (int value : arr) { if (first) { max = value; first = false; } else if (max < value) { max = value; } } III. int max = arr[0]; for (int k = 1; k < arr.length; k++) { if (max < arr[k]) { max = arr[k]; } } Which of the code segments will always correctly assign the maximum element of the array to the variable max ? (A) I only (B) II only (C) III only (D) II and III only (E) I, II, and III

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -37- 35. Consider the following instance variable and method. Method wordsWithCommas is intended to return a string containing all the words in listOfWords separated by commas and enclosed in braces. For example, if listOfWords contains ["one", "two", "three"] , the string returned by the call wordsWithCommas() should be "{one, two, three}". private List listOfWords; public String wordsWithCommas() { String result = "{"; int sizeOfList = /* expression */ ; for (int k = 0; k < sizeOfList; k++) { result = result + listOfWords.get(k); if ( /* condition */ ) { result = result + ", "; } } result = result + "}"; return result; } Which of the following can be used to replace /* expression */ and /* condition */ so that wordsWithCommas will work as intended? /* expression */ /* condition */ (A) listOfWords.size() - 1 k != 0 (B) listOfWords.size() k != 0 (C) listOfWords.size() - 1 k != sizeOfList - 1 (D) listOfWords.size() k != sizeOfList - 1 (E) result.length() k != 0

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -38- Questions 36-37 refer to the following information. Consider the following binarySearch method. The method correctly performs a binary search. /** Precondition : data is sorted in increasing order. */ public static int binarySearch(int[] data, int target) { int start = 0; int end = data.length - 1; while (start data[mid]) { start = mid + 1; } else { return mid; } } return -1; }

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -39- 36. Consider the following code segment. int[] values = {1, 2, 3, 4, 5, 8, 8, 8}; int target = 8; What value is returned by the call binarySearch(values, target) ? (A) -1 (B) 3 (C) 5 (D) 6 (E) 8 37. Suppose the binarySearch method is called with an array containi ng 2,000 elements sorted in increasing order. What is the maximum number of times that the statement indicated by /* Calculate midpoint */ could execute? (A) 2,000 (B) 1,000 (C) 20 (D) 11 (E) 1

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -40- 38. Consider the following incomplete method that is inte nded to return a string formed by concatenating elements from the parameter words. The elements to be concatenated start with startIndex and continue through the last element of words and should appear in reverse order in the resulting string. /** Precondition: words.length > 0 ; * startIndex >= 0 */ public static String concatWords(String[] words, int startIndex) { String result = ""; /* missing code */ return result; } For example, the following code segment uses a call to the concatWords method. String[] things = {"Bear", "Apple", "Gorilla", "House", "Car"}; System.out.println(concatWords(things, 2)); When the code segment is executed, the string "CarHouseGorilla" is printed. The following three code segments ha ve been proposed as replacements for /* missing code */. I. for (int k = startIndex; k < words.length; k++) { result += words[k] + words[words.length - k - 1]; } II. int k = words.length - 1; while (k >= startIndex) { result += words[k]; k--; } III. String[] temp = new String[words.length]; for (int k = 0; k

Unauthorized copying or reuse of any part of this page is illegal. GO ON TO THE NEXT PAGE. -41- 39. Consider the following method. /** Precondition : 0 < numVals

. . . . . .