If you are a current student, please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.csail.mit.edu) to authenticate, and then you will be redirected back to this page.
Error on line 19 of Python tag (line 20 of source): kerberos = cs_user_info['username'] KeyError: 'username'
You have 120 minutes to do this exam. This exam is open notes and open internet, though you are not to use a C/C++ compiler or Python evaluator. You are also not to communicate with anybody else during the exam except for staff members.
Error on line 5 of question tag. csq_soln = kerberos NameError: name 'kerberos' is not defined
The array x
is declared and defined as shown:
char x[30] = "one, two, three.";
Error on line 10 of question tag. csq_msg_function = what_was_submitted NameError: name 'what_was_submitted' is not defined
If somebody did the following:
x[7]= NULL;
what would the be printed out when the following call is made:
Serial.println(x);
Serial.println(x);
?"one, two, three." | |
"one" | |
"one, tw" | |
"one, two" | |
"one, two, t" | |
None of the above |
Assuming x
has still been modified like above (x[7]=NULL;
), what would happen if you printed out the following:
Serial.println(x+8);
Serial.println(x+8);
?", three." | |
"o, three." | |
"" | |
"one, tw" | |
None of the above |
Consider a C/C++ function with the following declaration:
void fsm(int input, char* output);
The function fsm
is stateful and behaves with the following synchronous state diagram (one transition per function call regardless of input).
In addition, the function assigns a value to char* output
based on the following logic:
- If State is 4, output is "blastoff!"
- Otherwise, output is "" (empty).
Answer the following questions:
Assume you start in State 0. If the sequence of inputs provided to fsm
is: 0,0,3,2,1,0,3
, what is the result of printing output
on each step?
["blastoff!","","","","","blastoff!",""] | |
["","","","","","",""] | |
["","","","","","blastoff!",""] | |
["","","","blastoff!","","",""] | |
["","","","","blastoff!","",""] |
What will the state of the FSM be after the following sequence of inputs: 0,0,3,4,5,2,0
0 | |
1 | |
2 | |
3 | |
4 |