# Test Midterm

## Spring 2020

The questions below are due on Tuesday April 07, 2020; 07:34:00 PM.

You are not logged in.

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.
A Python Error Occurred:

Error on line 19 of Python tag (line 20 of source):



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.

A Python Error Occurred:

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.";


A Python Error Occurred:

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);


What would be returned from calling Serial.println(x);?
 "one, tw" "one, two, t" "one, two" "one" "one, two, three." 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);


What would be returned from calling 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).

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