\documentstyle[11pt,zed-csp]{article}

\oddsidemargin -0.1in
\evensidemargin -0.1in
\topmargin -0.5in
\textwidth 6.5in
\textheight 9.5in
\parindent 0.25in
\parskip 0.0in
\pagestyle{empty}
\renewcommand{\labelenumiii}{(\roman{enumiii})}


\begin{document}


\begin{center} OLLSCOIL NA h\'{E}IREANN GAILLIMH

\vspace{0.1in}
NATIONAL UNIVERSITY OF IRELAND GALWAY

\vspace{0.15in}
{ ---------------------------------------------  }

SEMESTER II\\
AUTUMN EXAMINATIONS 2000

{ ---------------------------------------------  }

Second University Examination in Arts

\vspace{0.15in}
{\bf PROGRAMMING (CT218) }

\end{center}
\vspace{0.2in}

\hspace{2.3in}Professor D.\ Bell

\hspace{2.3in}Professor\ G.\ Lyons

\hspace{2.3in}Dr.\ M.\ Mc Gettrick

\hspace{2.3in}Mr.\ F.\ Smith

\vspace{0.1in}
\begin{center}
Time allowed: {\it three} hours.

Attempt {\it five} questions.

{\bf Please use a separate answer book for each section}
\end{center}


\vspace{0.3in}
\begin{center}
{\Large\bf Section A}
\end{center}

\begin{enumerate}

\item 
\begin{enumerate}

\item
Draw the binary tree that results from inserting
into an initially empty tree the following words in
the order given:
$$\hbox{\bf moscow, pusan, porto, oviedo, trieste, malmo}$$


\item
Calculate the depth of the tree in part (a). For the six 
words given, what is the (i) minimum,
(ii) maximum depth for all possible orderings?
Draw a sample tree which has minimum tree depth.

\item
For the initial tree in part (a), how many comparisons
need to be made using Binary Tree Search to find the word
{\bf trieste}?

\end{enumerate}

\vspace{0.3in}
\item
\begin{enumerate}
\item
Draw the graph corresponding to the adjacency matrix
\begin{displaymath}
\left( \begin{array}{ccc}
1 & 0 & 2\\
0 & 1 & 1\\
0 & 1 & 0\\
\end{array}\right)
\end{displaymath}

Use matrix multiplication to calculate how many distinct
ways there are of going from vertex (node) 3 to vertex 1
in three steps (i.e. paths of length 3)

\item
Describe the Selection Sort Algorithm. Use it to sort the 
six words given in question 1. (a), writing down the 
intermediate steps.

\end{enumerate}

\newpage
\item
\begin{enumerate}

\item
Explain the difference between procedures and functions in
Visual Basic.

\item
Explain what is meant by the precedence of an operator. Which
of the following has lowest precedence:
${\tt XOR}, <, \land, + $?
\item
Calculate the result of the following expressions:
\begin{enumerate}
\item
$4+1<6\ \hbox{\tt XOR TRUE}$
\item
$\hbox{\tt TRUE AND NOT}\ 5-2=2*2$
\item
$\hbox{\tt NOT FALSE AND}\ 5+4/2>7$
\end{enumerate}

\end{enumerate}

\vspace{0.3in}
\item
\begin{enumerate}

\item
Give examples of Visual Basic code to illustrate the difference
between a {\tt MessageBox} and an {\tt InputBox}. Illustrate also
the difference between a {\tt MessageBox} used in procedure and 
in function format.

\item
Describe {\bf two} of the following in Visual Basic, indicating any
events and properties associated with them: (1) Label, 
(2) TextBox, 
(3) CheckBox.


\end{enumerate}


\vspace{0.3in}
\begin{center}
{\Large\bf Section B}
\end{center}

\item
\begin{enumerate}
\item Describe the difference between the two main file types in Visual Basic.
\item For each file type, give an example of a situation where their use would be appropriate and the use of the other would be inappropriate.
\item For each of the file types give code that finds the fourth element in the file. Which file type is most suited to this kind of operation?
\end{enumerate}

\vspace{0.3in}
\item
\begin{enumerate}
\item What is Object Linking and Embedding (OLE)?
\item What is the difference between a linked object and an embedded object?
\item List five object types that could be linked or embedded into a Visual Basic program. For each highlight the advantages of linking or embedding the object.\end{enumerate}

\vspace{0.3in}
\item
\begin{enumerate}
\item What is the purpose of the Timer control?
\item Give an example of a situation where the timer control would be useful.
\item What is the Interval Property of a Timer and how is it set?
\item What is the AutoRedraw property?
\item When should the AutoRedraw property be set to flase?
\end{enumerate}

\vspace{0.3in}
\item
Write Visual Basic code for each of the following.

\begin{enumerate}
\item Extract the first three elements in a string.
\item Check if an integer is between 10 and 20.
\item Sum the integers in a 10 element array.
\item Search an unsorted array of integers for the value 12.
\item Search a sorted array of integers for the value 16.
\end{enumerate}


\end{enumerate}


\end{document}
