summaryrefslogtreecommitdiff
path: root/day1/day1quiz1.tex
diff options
context:
space:
mode:
Diffstat (limited to 'day1/day1quiz1.tex')
-rw-r--r--day1/day1quiz1.tex158
1 files changed, 158 insertions, 0 deletions
diff --git a/day1/day1quiz1.tex b/day1/day1quiz1.tex
index d0da0dd..ee1fe83 100644
--- a/day1/day1quiz1.tex
+++ b/day1/day1quiz1.tex
@@ -58,4 +58,162 @@ On the top right hand corner please write down the following:
\end{itemize}
\end{frame}
+\begin{frame}[fragile]
+\frametitle{\incqno }
+Draw (roughly) the plot obtained by the following:
+\begin{lstlisting}
+In []: x = linspace(0, 2*pi, 3)
+In []: plot(x, sin(x))
+\end{lstlisting}
+\end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% Describe the plot produced by the following:
+%% \begin{lstlisting}
+%% In []: x = linspace(0, 2*pi, 50)
+%% In []: plot(x, cos(x), 'go')
+%% \end{lstlisting}
+%% \end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How will you plot the previous graph with line width set to 3? How will
+you set the $x$ and $y$ labels of the plot?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How will you set the x and y axis limits so that the region of interest
+is in the rectangle $(0, -1.5)$ (left bottom coordinate) and $(2\pi,
+1.5)$ (right top coordinate)?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+What ipython magic command do you use to obtain the lines of code you have already typed in the interpreter? What command do you use to save them?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+The following code snippet has an error/bug:
+\begin{lstlisting}
+In []: y = linspace(0, 2*pi, 50)
+In []: plot(y, sin(y))
+In []: clf()
+In []: plot(y, cos(y))
+In []: legend(['sin(y)', 'cos(y)'])
+\end{lstlisting}
+What is the error? How do you fix it?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ In []: a = [1, 2, 5, 9]
+ In []: a[0:-1]
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ How do you combine two lists \emph{a} and \emph{b} to produce one list?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ In []: a = [1, 2, 5, 9]
+ \end{lstlisting}
+ How do you add the value 10 to the end of this list?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+Write the code to read a file \texttt{data.txt} and print each line of it?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the result of the following code snippet:
+\begin{lstlisting}
+In []: x = linspace(0, 10, 50)
+In []: y = linspace(50, 100, 100)
+In []: plot(x, y)
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+The following code snippet has an error/bug:
+\begin{lstlisting}
+In []: l = [0.1, 0.2, 0.3, 0.4]
+In []: t = [0.69, 0.90, 1.19, 1.30]
+In []: tsq = []
+In []: for time in t:
+ ....: tsq.append(time*time)
+ ....: plot(l, tsq)
+\end{lstlisting}
+What is the error? How do you fix it?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ A sample line from a Comma Separated Values (CSV) file:\\
+ \vspace*{0.2in}
+ \emph{Rossum, Guido, 42, 56, 34, 54}\\
+ \vspace*{0.2in}
+ What code would you use to separate the line into fields?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ In []: a = [1, 2, 5, 9]
+ \end{lstlisting}
+ How do you find the length of this list?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ In [1]: d = {
+ 'a': 1,
+ 'b': 2
+ }
+ In [2]: print d['c']
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+In []: sc = {'A': 10, 'B': 20,
+ 'C': 70}
+\end{lstlisting}
+Given the above dictionary, what command will you give to plot a
+pie-chart?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+In []: marks = [10, 20, 30, 50, 55,
+ 75, 83]
+\end{lstlisting}
+Given the above marks, how will you calculate the \alert{mean} and
+\alert{standard deviation}?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+In []: marks = [10, 20, 30, 50, 55,
+ 75, 83]
+\end{lstlisting}
+How will you convert the list \texttt{marks} to an \alert{array}?
+\end{frame}
+
\end{document}