Please use this identifier to cite or link to this item:
Show simple item record
https://sei.ubc.ca/handle/seima/1762
Full metadata record
DC Field | Value | Language |
---|---|---|
dc.contributor | Steve Wolfman | |
dc.contributor.author | Steve Wolfman | |
dc.date.accessioned | 2019-09-13T23:51:21Z | - |
dc.date.available | 2019-09-13T23:51:21Z | - |
dc.date.issued | 2008-02-22 | |
dc.identifier.uri | https://cwseispace.elearning.ubc.ca/handle/seima/1762 | - |
dc.description | First set of concept questions. The "boilerplate code" question is designed to be given BEFORE any substantial discussion of how function calls work. Students should give their best guess of what it displays. The point is that, even never having really worked with code before, many students can correctly predict the outcome. It's to build their confidence so that they'll TRY to predict in the future. Make clear that, even where predictions go wrong, that's a learning opportunity! And, be sure to discuss how students came about "wrong" answers and how these answers are important (because they show how intelligent humans will interpret the code, which helps us learn more about programming and process descriptions and also is valuable data for when we design our own languages to express process!). Note: for some reason PRS refuses to export these questions as PDF :(. The questions simply trace values through the following code. One additional question asks what order the code is executed in (trying to get at the idea that: first the function is declared (the computer "learns" a new command called tryMe), then the alert is executed, which sends us back into executing the code for tryMe). function tryMe(num1, num2) { var x, y, z; alert("The value in x after 'var x, y, z;' is: " + x); x = num1; alert("The value in x after 'x = num1;' is: " + x); alert("The value in num1 after 'x = num1;' is: " + num1); y = num2; alert("The value in y after 'y = num2;' is: " + y); alert("The value in num2 after 'y = num2;' is: " + num2); x = y; // y = x; alert("The value in x after 'x = y;' is: " + x); alert("The value in y after 'x = y;' is: " + y); z = x + y; alert("The value in z after 'z = x + y;' is: " + z); z = z + 1; alert("The value in z after 'z = z + 1;' is: " + z); alert("The value in x after 'z = z + 1;' is: " + x); alert("The value in y after 'z = z + 1;' is: " + y); alert("The value in x just before the return statement is: " + x); alert("The value in y just before the return statement is: " + y); alert("The value in z just before the return statement is: " + z); alert("The value in num1 just before the return statement is: " + num1); alert("The value in num2 just before the return statement is: " + num2); return z; } alert( tryMe(3, 4) ); - | |
dc.publisher | UBC Science Education Initiative Materials Archive | |
dc.rights | CC BY-NC 3.0 | |
dc.rights.uri | https://creativecommons.org/licenses/by-nc/3.0/ | |
dc.subject | Connecting with Computer Science | |
dc.title | JavaScript - Set 1 | |
dc.type | Learning Object | |
dcterms.accessRights | Open | |
dcterms.educationLevel | Undergraduate (Lower Division) | |
dcterms.rightsHolder | Author(s) of Item | |
ubc.itemType | Concept/Clicker Questions | |
ubc.accessibilityFeature | unknown | en_US |
ubc.accessibilityHazard | unknown | en_US |
ubc.date.issuedYear | 2008 | |
ubc.course | CPSC 101 | |
Appears in Collections: | UBC-CPSC 101: Connecting with Computer Science |
Files in This Item:
File | Description | Size | Format | |
---|---|---|---|---|
boilerplate.html | 24.77 kB | HTML | View/Open | |
class-6-js.xml | 24.77 kB | XML | View/Open |
This item is licensed under Creative Commons License