{"assignment":{"_schema_version":2,"course_id":37,"date_created":"2022-06-28T19:00:00+00:00","date_modified":"2022-12-08T03:24:35.862693+00:00","extra_instructor_files":"","extra_starting_files":"","forked_id":null,"forked_version":null,"hidden":false,"id":1162,"instructions":"{\n  \"settings\": {\n    \"readingId\": \"bakery_nesting_2d_dataclasses_read\"\n  },\n  \"questions\": {\n    \"Interpret Nested Access\": {\n      \"type\": \"multiple_dropdowns_question\",\n      \"points\": 4,\n      \"body\": \"Given the following code...\\n\\n```python\\nfrom dataclasses import dataclass\\n\\n@dataclass\\nclass Location:\\n    city: str\\n    state: str\\n\\n@dataclass\\nclass Trip:\\n    origin: Location\\n    destination: Location\\n    duration: int\\n    \\nmy_trip = Trip(Location(\\\"Newark\\\", \\\"DE\\\"),\\n               Location(\\\"Baltimore\\\", \\\"MD\\\"),\\n               90)\\n```\\n\\nWhat will each of the following expressions produce?\\n\\n1. `my_trip[0].state`: [errorAccess]\\n2. `my_trip.origin.state`: [originState]\\n3. `my_trip.duration`: [tripDuration]\\n4. `my_trip.destination.city`: [destinationCity]\\n5. `Trip.Location.state`: [typeAccess]\\n6. `my_trip.origin.city[0]`: [firstLetterOriginCity]\",\n      \"answers\": {\n        \"errorAccess\": [\n          \"\\\"Newark\\\"\",\n          \"\\\"DE\\\"\",\n          \"\\\"Baltimore\\\"\",\n          \"\\\"MD\\\"\",\n          \"\\\"N\\\"\",\n          \"\\\"D\\\"\",\n          \"\\\"B\\\"\",\n          \"\\\"M\\\"\",\n          \"90\",\n          \"0\",\n          \"int\",\n          \"str\",\n          \"Location\",\n          \"Trip\",\n          \"An error occurs\"\n        ],\n        \"originState\": [\n          \"\\\"Newark\\\"\",\n          \"\\\"DE\\\"\",\n          \"\\\"Baltimore\\\"\",\n          \"\\\"MD\\\"\",\n          \"\\\"N\\\"\",\n          \"\\\"D\\\"\",\n          \"\\\"B\\\"\",\n          \"\\\"M\\\"\",\n          \"90\",\n          \"0\",\n          \"int\",\n          \"str\",\n          \"Location\",\n          \"Trip\",\n          \"An error occurs\"\n        ],\n        \"tripDuration\": [\n          \"\\\"Newark\\\"\",\n          \"\\\"DE\\\"\",\n          \"\\\"Baltimore\\\"\",\n          \"\\\"MD\\\"\",\n          \"\\\"N\\\"\",\n          \"\\\"D\\\"\",\n          \"\\\"B\\\"\",\n          \"\\\"M\\\"\",\n          \"90\",\n          \"0\",\n          \"int\",\n          \"str\",\n          \"Location\",\n          \"Trip\",\n          \"An error occurs\"\n        ],\n        \"destinationCity\": [\n          \"\\\"Newark\\\"\",\n          \"\\\"DE\\\"\",\n          \"\\\"Baltimore\\\"\",\n          \"\\\"MD\\\"\",\n          \"\\\"N\\\"\",\n          \"\\\"D\\\"\",\n          \"\\\"B\\\"\",\n          \"\\\"M\\\"\",\n          \"90\",\n          \"0\",\n          \"int\",\n          \"str\",\n          \"Location\",\n          \"Trip\",\n          \"An error occurs\"\n        ],\n        \"typeAccess\": [\n          \"\\\"Newark\\\"\",\n          \"\\\"DE\\\"\",\n          \"\\\"Baltimore\\\"\",\n          \"\\\"MD\\\"\",\n          \"\\\"N\\\"\",\n          \"\\\"D\\\"\",\n          \"\\\"B\\\"\",\n          \"\\\"M\\\"\",\n          \"90\",\n          \"0\",\n          \"int\",\n          \"str\",\n          \"Location\",\n          \"Trip\",\n          \"An error occurs\"\n        ],\n        \"firstLetterOriginCity\": [\n          \"\\\"Newark\\\"\",\n          \"\\\"DE\\\"\",\n          \"\\\"Baltimore\\\"\",\n          \"\\\"MD\\\"\",\n          \"\\\"N\\\"\",\n          \"\\\"D\\\"\",\n          \"\\\"B\\\"\",\n          \"\\\"M\\\"\",\n          \"90\",\n          \"0\",\n          \"int\",\n          \"str\",\n          \"Location\",\n          \"Trip\",\n          \"An error occurs\"\n        ]\n      },\n      \"retainOrder\": true\n    },\n    \"Recall Order of Definitions\": {\n      \"type\": \"multiple_choice_question\",\n      \"points\": 1,\n      \"body\": \"Which of the following statements about the order of definitions is NOT correct?\",\n      \"answers\": [\n        \"Given dataclasses A and B, if dataclass A has an attribute of type B, then you must define dataclass B before dataclass A\",\n        \"Given dataclass A and function X, if function X returns an instance of dataclass A, then you must define dataclass A before function X\",\n        \"Given functions X and Y, if function X calls function Y, then you must define function X before function Y\",\n        \"In general, you must define the dataclass A before you can make an instance of A\",\n        \"In general, you must define the function X before you can call the function X\",\n        \"In general, you must define a variable before you can use the variable\"\n      ]\n    },\n    \"Recall Allows Iteration\": {\n      \"type\": \"multiple_answers_question\",\n      \"points\": 1,\n      \"body\": \"Which of the following can be iterated over directly with a `for` loop?\",\n      \"answers\": [\n        \"Strings\",\n        \"Integers\",\n        \"Instances of dataclasses\",\n        \"Lists\"\n      ]\n    },\n    \"Write Multiple Nested Access\": {\n      \"type\": \"short_answer_question\",\n      \"points\": 2,\n      \"body\": \"Given the following code:\\n\\n```python\\nfrom dataclasses import dataclass\\n\\n@dataclass\\nclass Position:\\n    x: int\\n    y: int\\n    \\n@dataclass\\nclass Rectangle:\\n    start: Position\\n    end: Position\\n    color: str\\n    \\n@dataclass\\nclass Button:\\n    box: Rectangle\\n    text: str\\n\\n@dataclass\\nclass World:\\n    save: Button\\n    load: Button\\n```\\n\\nAssuming we had an instance of a `World` stored in a variable named `world`, what expression would correctly access the World's Save button's starting X coordinate?\"\n    },\n    \"Determine Temporary Unpacking Equivalence\": {\n      \"type\": \"multiple_answers_question\",\n      \"points\": 1,\n      \"body\": \"Given the following code:\\n\\n```python\\nfrom dataclasses import dataclass\\n\\n@dataclass\\nclass Location:\\n    city: str\\n    state: str\\n\\n@dataclass\\nclass Trip:\\n    origin: Location\\n    destination: Location\\n    duration: int\\n    \\nmy_trip = Trip(Location(\\\"Newark\\\", \\\"DE\\\"),\\n               Location(\\\"Baltimore\\\", \\\"MD\\\"),\\n               90)\\n```\\nWhich of the following code blocks will print the text `DE`?\",\n      \"answers\": [\n        \"<pre>my_origin = my_trip.origin\\nprint(my_origin.state)</pre>\",\n        \"<pre>my_origin = my_trip.origin\\nprint(state)</pre>\",\n        \"<pre>my_state = my_trip.origin.state\\nprint(my_state)</pre>\",\n        \"<pre>my_trip.origin.state\\nprint()</pre>\",\n        \"<pre>print(my_trip.origin.state)</pre>\",\n        \"<pre>print(my_trip.state.origin)</pre>\",\n        \"<pre>print(Trip.origin.state)</pre>\"\n      ]\n    }\n  }\n}","ip_ranges":"","name":"8A2) Nested Dataclasses","on_change":"","on_eval":"","on_run":"","owner_id":1,"owner_id__email":"acbart@udel.edu","points":1,"public":true,"reviewed":false,"sample_submissions":[],"settings":"","starting_code":"","subordinate":false,"tags":[],"type":"quiz","url":"bakery_nesting_2d_dataclasses_quiz","version":2},"ip":"216.73.216.157","submission":{"_schema_version":3,"assignment_id":1162,"assignment_version":2,"attempts":0,"code":"","correct":false,"course_id":37,"date_created":"2026-05-20T12:41:59.665752+00:00","date_due":"","date_graded":"","date_locked":"","date_modified":"2026-05-20T12:41:59.665752+00:00","date_started":"","date_submitted":"","endpoint":"","extra_files":"","feedback":"","grading_status":"NotReady","id":2036757,"score":0.0,"submission_status":"Started","time_limit":"","url":"submission_url-410ffe28-5661-4232-ae51-33fc3058e781","user_id":2044660,"user_id__email":"","version":0},"success":true}
