\documentstyle{article} \begin{document} \large{ \begin{center} CSCI220 \\ Fall 1992 Midterm Exam \\ October 2, 1992 \end{center} This is an open book exam. The total maximum attainable score for this exam is 100. The score for each question is given so that you can budget your time. Partial credit may be given. You will be graded on clarity and conciseness as well as correctness. Good luck! \vspace{0.2in} Problem 1 [50 points]. Do Exercise 1.4 in the textbook. Do not panic! This is a very simple program! Follow these steps: \begin{enumerate} \item Invent a loop invariant. Use {\em Pre} and {\em Post} to guide you. \item Prove that what you have invented is indeed a loop invariant. Does it hold after initialization? (Remember to use {\em Pre} as well as the initialization statement for this.) Does it hold before the $n$th execution of the {\bf while} loop? \item Prove that {\em Post} follows from the loop invariant and the negation of the {\bf while} condition. \end{enumerate} \vspace{0.2in} Problem 2 [part (a): 40 points; part (b): 10 points] Do exercise 2.3 in the textbook. Clarification: the array is sorted {\em in ascending order} and it contains only integers. Hint: This analysis is {\em very} similar to that of {\em LinearSearch}. } %end of large \end{document}