Changed few questions in day1quiz1 and added day 2 quiz.
--- a/day1quiz1.tex Wed Nov 11 12:30:18 2009 +0530
+++ b/day1quiz1.tex Tue Dec 29 19:01:43 2009 +0530
@@ -40,7 +40,7 @@
\author[FOSSEE Team] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {31, October 2009\\Day 1, Quiz 1}
+\date[] {14, December 2009\\Day 1, Quiz 1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -115,26 +115,14 @@
\end{lstlisting}
\end{frame}
-\begin{frame}[fragile]
+\begin{frame}
\frametitle{\incqno }
-What would be the result?
-\begin{lstlisting}
- In [1]: x
- array([[0, 1, 2],
- [3, 4, 5],
- [6, 7, 8]])
- In [2]: x[::-1,:]
-\end{lstlisting}
+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}
\frametitle{\incqno }
-How to read and print each line of a file.
-\end{frame}
-
-\begin{frame}
-\frametitle{\incqno }
-How to get list of third column of a data file.
+How to read and print each line of a file?
\end{frame}
\begin{frame}[fragile]
@@ -156,5 +144,19 @@
Setting x and y axis limits.
\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}
+
\end{document}
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/day2quiz.tex Tue Dec 29 19:01:43 2009 +0530
@@ -0,0 +1,217 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Quiz slides day 1 quiz 1
+%
+% Author: FOSSEE <info at fossee dot in>
+% Copyright (c) 2005-2009, FOSSEE Team
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\documentclass[14pt,compress]{beamer}
+
+\mode<presentation>
+{
+ \useoutertheme{split}
+ \setbeamercovered{transparent}
+}
+
+\definecolor{darkgreen}{rgb}{0,0.5,0}
+
+\usepackage{listings}
+\lstset{language=Python,
+ basicstyle=\ttfamily\bfseries,
+ commentstyle=\color{red}\itshape,
+ stringstyle=\color{darkgreen},
+ showstringspaces=false,
+ keywordstyle=\color{blue}\bfseries}
+
+\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Macros
+
+\newcounter{qno}
+\setcounter{qno}{0}
+\newcommand{\incqno}{\addtocounter{qno}{1}{Question \theqno}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Title page
+\title[Basic Python]{Python for science and engineering: Day 2, Quiz 1}
+
+\author[FOSSEE Team] {FOSSEE}
+
+\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\date[] {\today \\ Day 2, Quiz 1}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\begin{document}
+
+\begin{frame}
+ \titlepage
+\end{frame}
+
+\begin{frame}
+ \frametitle{Write your details...}
+On the top right hand corner please write down the following:
+ \begin{itemize}
+ \item Name:
+ \item University/College/Company:
+ \item Student/Teacher/Professional:
+ \end{itemize}
+\end{frame}
+
+
+\begin{frame}
+\frametitle{\incqno }
+ What is the largest integer value that can be represented natively by Python?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ What is the result of 17.0 / 2?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ Which of the following is not a type in Python?
+ \begin{enumerate}
+ \item int
+ \item float
+ \item char
+ \item string
+ \end{enumerate}
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How do you create a complex number with real part 2 and imaginary part
+0.5.
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ What is the difference between \kwrd{print} \emph{x} and \kwrd{print} \emph{x,} ?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ What does '*' * 40 produce?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ What is the output of:
+ \begin{lstlisting}
+In []: ', '.join(['a', 'b', 'c'])
+ \end{lstlisting}
+\end{frame}
+
+\begin{frame}
+ \frametitle{\incqno}
+ How do you find the presence of an element \emph{x} in the list \emph{a}?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: set([1, 2, 8, 2, 13, 8, 9])
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: 47 % 3
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: a = 12
+In []: a *= 1+1
+ \end{lstlisting}
+ What is the value of a?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: a = {'a': 1, 'b': 2}
+In []: a['a'] = 10
+In []: print a
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: for i in range(3, 10, 2):
+ ...: print i
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: a = [1, 2, 3]
+In []: a.extend([5, 6])
+ \end{lstlisting}
+ What is the value of a?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+In []: a = (1, 2, 3)
+In []: a[1] = 10
+ \end{lstlisting}
+ What is the result?
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{\incqno}
+ \begin{lstlisting}
+def func(x, y=10):
+ print x+1, y+10
+
+func(1)
+
+ \end{lstlisting}
+
+ What is the output?
+\end{frame}
+
+\begin{frame}
+ \frametitle{\incqno}
+ How many items can a function return?
+\end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno}
+%% Consider a module called \lstinline+gcd.py+ looking like this:
+%% \begin{lstlisting}
+%% def gcd(a, b):
+%% ...
+
+%% if __name__ == '__main__':
+%% print gcd(10, 25)
+%% \end{lstlisting}
+%% If this module is imported, will it print the gcd of 10 and 25?
+%% \end{frame}
+
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno}
+%% \begin{lstlisting}
+%% In [1]: print hello
+%% \end{lstlisting}
+%% Exactly what exception will you get if you run this on a fresh
+%% interpreter?
+%% \end{frame}
+
+\end{document}
+