\noindent May 21, 1990 \hfil Name: \vbox{\hrule width 3in}\break
\advance\vsize by .5in
\parskip=0pt
\nopagenumbers
\bigskip
\noindent{\bf THE MAYBE VIRUS}
\bigskip
\noindent Robert T. Morris is taking 6.004 and has written the
following C code:

\bigskip
\def\{{\char`\{}
\def\}{\char`\}}

{\narrower\tt\obeylines\catcode32=13\def {\ }
/* MAYBE Virus, by RTM, 21-May-90. */
long int infect\_maybe(name)
     char *name;
\{
   short int address;
   struct passwd *pw;
   long int i,successes;

   i = 0;
   successes = 0;

   while (i < 10) \{

      address = bind(name);
      pw = getpwuid(0);

      /*
       * Comment A: insert code to infiltrate remote MAYBE here.
       * Increment successes if infiltration is successful.
       */

      i++;
   \}

   return(successes);
\}

}
\bigskip

{\bf 6.} {\it[4 points]} What code should replace comment A?

\vskip .2in

\hfil{\bf (Give C code)}\break

{\bf 7.} {\it[8 points]} Translate this code into S-machine code so
that it can run on your Maybe.

\vskip .3in

\hfil{\bf (Give S-machine code)}\break

{\bf 8.} {\it[4 points]} At first, the virus doesn't propagate because
of a timing problem with the I/O card.  What is the best remedy for
this?

\vskip .2in

\hfil{\bf (Give method of destroying I/O card)}\break

{\bf 9.} {\it[4 points]} Professor Dally grows concerned because his
MAYBE is running abnormally quickly.  He finds another routine in the
virus that makes random changes to microcode.  What is the probability
that random modifications in the MAYBE's ROM would make it run faster?

\vskip .2in

\hfil{\bf Probability: \vbox{\hrule width 1in}}\break
\null\hfil{\bf (Explain briefly)}\break

{\bf 10.} {\it[4 points]} Morris is caught by SPODSA (the Secret Police
of the Office of the Dean of Student Affairs).  What should his
punishment be?

\vskip .2in

\hfil{\bf (Be creative)}\break

\vfill

\noindent6.004 Final Exam \hfil -- 5 -- \hfil Spring Term, 1990\break
\hfil\fiverm AMG/BJ/MH\break
\eject
\end
