[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-655810-105":59,"doc-detail-655810-en":130},{"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":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","box-and-pointer-diagrams-rules-for-drawing-and-reading-csse-120","Box-and-Pointer Diagrams - Rules for Drawing and Reading - CSSE 120","","Box-and-pointer diagrams provide a visual snapshot of variables, references, and object values at a given program point. The material explains how variables point to objects, how containers hold references to other objects, and how assignment and function calls create new references. It gives step-by-step drawing rules for non-container objects, variables, and container objects, then shows how re-assignment changes arrows while mutation changes the contents of containers without changing their referenced objects. It also warns about mutable objects’ risks.",{"@graph":69,"@context":122},[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":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/box-and-pointer-diagrams-rules-for-drawing-and-reading-csse-120/655810/",{"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/box-and-pointer-diagrams-rules-for-drawing-and-reading-csse-120/655810.png","ImageObject",300,407,{"name":92,"@type":93},"\tJames","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-10-29","2026-10-25",true,{"@type":102,"interactionType":103,"userInteractionCount":19},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What does a box-and-pointer diagram show at a given point in a program?","Question",{"text":112,"@type":113},"It shows variables and the objects they refer to, including how container objects hold references and how values are represented in boxes.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How do assignments and function calls affect variables in these diagrams?",{"text":117,"@type":113},"They cause variables to refer to objects, so the arrows from the variable boxes point to the newly referenced objects after the code runs.",{"name":119,"@type":110,"acceptedAnswer":120},"What is the difference between re-assigning a variable and mutating a container object?",{"text":121,"@type":113},"Re-assigning changes the arrow out of the variable box to point to a new object, while mutation changes the contents “inside” the container object without changing which object the container variable refers to.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},655810,1792964051,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":19,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":24,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":129,"read_time":143},2336474466412,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","CSSE 120 – Introduction to Software Development Box and Pointer Diagrams – Page 1 of 5  \nIntroduction to Box-and-Pointer Diagrams  \nA Box-and-Pointer Diagram displays a snapshot of the variables and their values at a given  \npoint of execution of a program. For example, after the code below executes:  \nx = 48  \nz = x  \np1 = zg.Point(100, 150)  \nthe corresponding box-and-pointer diagram is as shown to the right. (We will work through the details of this and other examples in this exercise.)  \n\n|  Box and Pointer diagram: |  |\n| --- | --- |\n| x\u003Cbr>z\u003Cbr>p1 | 48\u003Cbr>\u003Cbr>\u003Cbr>\u003Cbr>\u003Cbr>x y ... |\n\nIn this reading and the exercise that accompanies it, you will learn how to draw and read box-and-pointer diagrams. Additionally, you will see how they clarify the following key ideas (all of which you’ll examine in this exercise):  \n• Variables are REFERENCES to objects.  \n• Assignment (e.g. x = 100) causes a variable to refer to an object.  \n• Function calls ([e.g.](e.g. foo)[ foo](e.g. foo)(54, x)) also cause variables to refer to objects.  \n• Some types of objects are mutable, which means that the “insides” of such an object can be re-assigned. (We’ll be more explicit shortly.) Other types of objects are immutable.  \nObjects, Variables and References  \nRecall that in Python, every piece of data is an object. Objects have a type (which determines what the object can do and the types of data that the object contains/knows) and a value.  \nVariables are REFERENCES to objects – we say that the variable refers to an object, or points to an object, or is the name for an object (several ways to say the same thing, in this context) .  \nSome objects contain references to other objects; these objects are called containers. Azg. Point is a container (as is any object of a user-defined class) . Lists, strings and tuples are containers. Numbers are not containers.  \nWe will see that box-and-pointer diagrams help clarify what we mean by references.  \nCSSE 120 – Introduction to Software Development Box and Pointer Diagrams – Page 2 of 5  \nHow to Draw a Box-and-Pointer Diagram  \nRule 1 : Draw a NON-CONTAINER OBJECT by putting its value inside a box, as in these examples:  \n48  \n10.13  \nRule 2 : Draw a VARIABLE using a box labeled with the variable’s name and with arrows from the box to the object to which the variable currently refers.  \nFor example, after this code executes:  \nx = 48  \n\n|  Box and Pointer diagram: |  |\n| --- | --- |\n| x | 48 |\n\nthe corresponding box-and-pointer diagram is as shown above and to the right.  \nRule 3 : Draw a CONTAINER OBJECT by making a box for it, and then creating sub-boxes that are drawn as if they were variables, but with field names for fields of an object and indices for items of a sequence.  \nFor example, after this code executes:  \nx = 48  \np = zg.Point(100, 150) numbers = [4, 30.2, 10]  \nthe corresponding box-and-pointer diagram is as shown to the right. The ellipsis (…) for the zg.Point object reflects the fact that zg.Points have an outline color, etc.  \n\n|  Box and Pointer diagram: |  |  |\n| --- | --- | --- |\n| x | 48 |  |\n| p |  | |\n| x y ...\u003Cbr>4 30.2 10\u003Cbr>numbers \u003Cbr>0 1 2\u003Cbr>|  |  |\n\nCSSE 120 – Introduction to Software Development Box and Pointer Diagrams – Page 3 of 5  \nRe-assigning a variable  \nRecall that variables are REFERENCES to objects – we say that the variable refers to an object, or points to an object, or is the name for an object (several ways to say the same thing, in this context) . Box-and-pointer diagrams help clarify what we mean by references, as in the following example:  \nThe box-and-pointer diagram on the right shows the situation after the code on the left runs.  \nx = 48  \n\n|  Box and Pointer diagram: |  |\n| --- | --- |\n| x | 48 |\n\nIf we now RE-assign the variable x, as shown in the example to the right, the arrow out of the box for x changes – it points to the new value for x.  \nNote that we put an  through the old arrow to indicate that the old arrow no longer exists.  \nx = x + 3  \nW","cbCaidgno9CaJkRJ","https://ap.wps.com/l/cbCaidgno9CaJkRJ","pdf",243385,"English","# Introduction to Box-and-Pointer Diagrams\n## Objects, Variables and References\n# How to Draw a Box-and-Pointer Diagram\n## Re-assigning a variable\n## Mutable objects","[{\"question\":\"What does a box-and-pointer diagram show at a given point in a program?\",\"answer\":\"It shows variables and the objects they refer to, including how container objects hold references and how values are represented in boxes.\"},{\"question\":\"How do assignments and function calls affect variables in these diagrams?\",\"answer\":\"They cause variables to refer to objects, so the arrows from the variable boxes point to the newly referenced objects after the code runs.\"},{\"question\":\"What is the difference between re-assigning a variable and mutating a container object?\",\"answer\":\"Re-assigning changes the arrow out of the variable box to point to a new object, while mutation changes the contents “inside” the container object without changing which object the container variable refers to.\"}]","Box-and-Pointer Diagrams - Rules for Drawing and Reading - CSSE 120 | PDF",13]