[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-314866-105":59,"doc-detail-314866-en":122},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":115,"head_meta":117,"extra_data":119,"updated_unix":121},105,"en","ap-computer-science-a-2024-free-response-questions-section-ii-4-questions","AP® Computer Science A 2024 Free-Response Questions - Section II - 4 Questions","","AP® Computer Science A 2024 Free-Response Questions, Section II, provides four Java-focused problems with a total time limit of 1 hour and 30 minutes. The instructions require students to show all work and write program segments in Java, using any relevant accessible methods and assuming correct preconditions. The excerpt begins with a Feeder simulation task describing normal versus abnormal conditions, random food consumption per bird, and scenarios where a feeder is emptied.",{"@graph":69,"@context":114},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":20,"@type":76,"position":81},"https://docshare.wps.com/document/exam/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/ap-computer-science-a-2024-free-response-questions-section-ii-4-questions/314866/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/ap-computer-science-a-2024-free-response-questions-section-ii-4-questions/314866.png","ImageObject",300,407,{"name":92,"@type":93},"WPS_1786070896","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-10-31","2026-09-20",true,{"@type":102,"interactionType":103,"userInteractionCount":52},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108],{"name":109,"@type":110,"acceptedAnswer":111},"How does simulateOneDay model normal vs. abnormal conditions?","Question",{"text":112,"@type":113},"Normal conditions (95% of the time) model birds visiting the feeder and consuming a randomly chosen amount between 10 and 50 grams per bird. Abnormal conditions (5% of the time) model a bear emptying the feeder, leaving zero food at day’s end.","Answer","https://schema.org",{"og:url":83,"og:type":116,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":118,"canonical":83},"index,follow",{"doc_id":120,"site_id":62},314866,1790028294,{"code":4,"msg":5,"data":123},{"doc_id":120,"user_id":124,"nickname":92,"user_avatar":125,"doc_module":4,"category_id":19,"category_name":20,"doc_title":65,"doc_description":67,"doc_content":126,"file_id":127,"file_url":128,"file_type":129,"file_size":130,"view_count":52,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":56,"language":131,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":132,"faqs":133,"seo_title":134,"seo_description":67,"update_tm":135,"read_time":136,"preview_page_count":4},549768072016,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","2024  \nAP® Computer Science A Free-Response Questions  \n© 2024 College Board. College Board, Advanced Placement, AP, AP Central, and the acorn logo are registered trademarks of College Board. Visit College Board on the web: [collegeboard.org](collegeboard.org).  \n[AP Central is the official online home for the AP Program: apcentral.collegeboard.org](AP Central is the official online home for the AP Program: apcentral.collegeboard.org).  \nAP® Computer Science A 2024 Free-Response Questions  \nCOMPUTER SCIENCE A  \nSECTION II  \nTime—1 hour and 30 minutes  \n4 Questions  \nDirections: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. You may plan your answers in this orange booklet, but no credit will be given for anything written in this booklet. You will only earn credit for what you write in the separate Free Response booklet.  \nNotes:  \n• Assume that the classes listed in the Java Quick Reference have been imported where appropriate.  \n• Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied.  \n• In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit.  \nGO ON TO THE NEXT PAGE.  \n© 2024 College Board.  \nVisit College Board on the web: [collegeboard.org](collegeboard.org).  \nAP® Computer Science A 2024 Free-Response Questions  \n1. This question simulates birds or possibly a bear eating at a bird feeder. The following Feeder class contains information about how much food is in the bird feeder and simulates how much food is eaten. You will write two methods of the Feeder class.  \npublic class Feeder  \n{  \n/**  \n* The amount of food, in grams, currently in the bird feeder; initialized in the constructor and  \n* always greater than or equal to zero */  \nprivate int currentFood;  \n/**  \n* Simulates one day with numBirds birds or possibly a bear at the bird feeder,  \n* as described in part (a)  \n* Precondition: numBirds > 0 */  \npublic void simulateOneDay(int numBirds)  \n{ /* to be implemented in part (a) */ }  \n/**  \n* Returns the number of days birds or a bear found food to eat at the feeder in this simulation,* as described in part (b)  \n* Preconditions: numBirds > 0, numDays > 0 */  \npublic int simulateManyDays(int numBirds, int numDays)  \n{ /* to be implemented in part (b) */ }  \n// There may be instance variables, constructors, or methods that are not shown.  \n}  \nGO ON TO THE NEXT PAGE.  \n© 2024 College Board.  \nVisit College Board on the web: [collegeboard.org](collegeboard.org).  \nAP® Computer Science A 2024 Free-Response Questions  \n(a) Write the simulateOneDay method, which simulates numBirds birds or possibly a bear at the feeder for one day. The method determines the amount of food taken from the feeder on this day and updates the currentFood instance variable. The simulation accounts for normal conditions, which occur 95% of the time, and abnormal conditions, which occur 5% of the time.  \nUnder normal conditions, the simulation assumes that on any given day, only birds visit the feeder and that each bird at the feeder consumes the same amount of food. This standard amount consumed is between 10 and 50 grams of food, inclusive, in 1-gram increments. That is, on any given day, each bird might eat 10, 11, . . . , 49, or 50 grams of food. The amount of food eaten by each bird on a given day is randomly generated and each integer from 10 to 50, inclusive, has an equal chance of being chosen.  \nFor example, a run of the simulation might predict that for a certain day under normal conditions, each bird coming to the feeder will eat 11 grams of food. If 10 birds come to the feeder on that day, then a total of 110 grams of food will be consumed.  \nIf the simulated food consumed is greater than the amou","cbCaieWLPQOZAFG7","https://ap.wps.com/l/cbCaieWLPQOZAFG7","pdf",317395,"English","# Section II\n## Time and directions\n## Question 1: Feeder simulation (parts a and b)","[{\"question\":\"How does simulateOneDay model normal vs. abnormal conditions?\",\"answer\":\"Normal conditions (95% of the time) model birds visiting the feeder and consuming a randomly chosen amount between 10 and 50 grams per bird. Abnormal conditions (5% of the time) model a bear emptying the feeder, leaving zero food at day’s end.\"}]","AP® Computer Science A 2024 Free-Response Questions - Section II - 4 Questions | PDF",1789901979,48]