-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a0d595
commit 58df8ce
Showing
1 changed file
with
39 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,46 @@ | ||
[multipart] | ||
ex = """ | ||
Alright fam. `Let's go.` | ||
""" | ||
|
||
[[questions]] | ||
type = "MultipleChoice" | ||
multipart = "ex" | ||
prompt.prompt = "Hmm" | ||
prompt.prompt = """ | ||
What does it mean if a variable `x` is immutable? | ||
``` | ||
example | ||
intro h | ||
apply | ||
``` | ||
""" | ||
prompt.distractors = [ | ||
"A", | ||
"B" | ||
"`x` is stored in the immutable region of memory.", | ||
"After being defined, `x` can be changed at most once.", | ||
"You cannot create a reference to `x`." | ||
] | ||
answer.answer = "C" | ||
context = "sup" | ||
id = "81b6552e-0250-4bb2-82ee-95a1d5858d03" | ||
answer.answer = "`x` cannot be changed after being assigned to a value." | ||
context = """ | ||
Immutable means "not mutable", or not changeable. | ||
""" | ||
id = "18ea4c61-c7c3-433f-add5-d3d3156e3e71" | ||
|
||
[[questions]] | ||
type = "ShortAnswer" | ||
prompt.prompt = "What is the keyword used after `let` to indicate that a variable can be mutated?" | ||
answer.answer = "mut" | ||
context = """ | ||
For example, you can make a mutable variable `x` by writing: `let mut x = 1`. | ||
""" | ||
id = "dbbaea6a-f469-464f-9d60-99ae98456b6a" | ||
|
||
[[questions]] | ||
type = "MultipleChoice" | ||
multipart = "ex" | ||
prompt.prompt = "Alright?" | ||
prompt.distractors = [ | ||
"D", | ||
"E" | ||
] | ||
answer.answer = "F" | ||
context = "no" | ||
id = "81708e95-41b7-45b9-bca4-5dab003a67aa" | ||
type = "Tracing" | ||
prompt.program = """ | ||
fn main() { | ||
let x = 1; | ||
println!("{x}"); | ||
x += 1; | ||
println!("{x}"); | ||
} | ||
""" | ||
answer.doesCompile = false | ||
answer.lineNumber = 4 | ||
context = """ | ||
This is a compiler error because line 4 tries to mutate `x` when `x` is not marked as `mut`. | ||
""" | ||
id = "bba6a299-b20f-4685-934a-792a591df3c0" |