day2quiz.tex
author Puneeth Chaganti <punchagan@fossee.in>
Mon, 04 Jan 2010 19:09:51 +0530
changeset 338 63b69ed765d0
parent 334 2214b5dba4d4
child 344 19754ed6050f
permissions -rwxr-xr-x
Merged with mainline.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     2
% Quiz slides day 1 quiz 1
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     3
%
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     4
% Author: FOSSEE <info at fossee  dot in>
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     5
% Copyright (c) 2005-2009, FOSSEE Team
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     7
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     8
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     9
\documentclass[14pt,compress]{beamer}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    10
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    11
\mode<presentation>
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    12
{
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    13
  \useoutertheme{split}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    14
  \setbeamercovered{transparent}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    15
}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    16
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    17
\definecolor{darkgreen}{rgb}{0,0.5,0}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    18
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    19
\usepackage{listings}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    20
\lstset{language=Python,
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    21
    basicstyle=\ttfamily\bfseries,
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    22
    commentstyle=\color{red}\itshape,
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    23
  stringstyle=\color{darkgreen},
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    24
  showstringspaces=false,
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    25
  keywordstyle=\color{blue}\bfseries}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    26
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    27
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    28
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    29
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    30
% Macros
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    31
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    32
\newcounter{qno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    33
\setcounter{qno}{0}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    34
\newcommand{\incqno}{\addtocounter{qno}{1}{Question \theqno}}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    35
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    36
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    37
% Title page
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    38
\title[Basic Python]{Python for science and engineering: Day 2, Quiz 1}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    39
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    40
\author[FOSSEE Team] {FOSSEE}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    41
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    42
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    43
\date[] {\today \\ Day 2, Quiz 1}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    44
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    45
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    46
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    47
\begin{document}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    48
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    49
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    50
  \titlepage
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    51
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    52
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    53
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    54
  \frametitle{Write your details...}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    55
On the top right hand corner please write down the following:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    56
  \begin{itemize}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    57
    \item Name:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    58
    \item University/College/Company:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    59
    \item Student/Teacher/Professional:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    60
  \end{itemize}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    61
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    62
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    63
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    64
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    65
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    66
  What is the largest integer value that can be represented natively by Python?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    67
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    68
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    69
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    70
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    71
  What is the result of 17.0 / 2?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    72
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    73
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    74
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    75
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    76
  Which of the following is not a type in Python?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    77
  \begin{enumerate}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    78
    \item int
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    79
    \item float
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    80
    \item char
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    81
    \item string
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    82
  \end{enumerate}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    83
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    84
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    85
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    86
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    87
How do you create a complex number with real part 2 and imaginary part
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    88
0.5.
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    89
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    90
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    91
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    92
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    93
  What is the difference between \kwrd{print} \emph{x} and \kwrd{print} \emph{x,} ?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    94
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    95
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    96
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    97
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    98
  What does '*' * 40 produce?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    99
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   100
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   101
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   102
\frametitle{\incqno }
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   103
    What is the output of:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   104
    \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   105
In []: ', '.join(['a', 'b', 'c'])
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   106
    \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   107
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   108
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   109
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   110
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   111
  How do you find the presence of an element \emph{x} in the list \emph{a}?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   112
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   113
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   114
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   115
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   116
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   117
In []: set([1, 2, 8, 2, 13, 8, 9])
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   118
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   119
  What is the output?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   120
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   121
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   122
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   123
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   124
  \begin{lstlisting}
332
f2ca851199d4 Changed few questions in day1quiz1 and added day 2 quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   125
In []: 47 % 3 
306
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   126
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   127
  What is the output?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   128
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   129
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   130
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   131
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   132
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   133
In []: a = 12
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   134
In []: a *= 1+1
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   135
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   136
  What is the value of a?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   137
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   138
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   139
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   140
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   141
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   142
In []: a = {'a': 1, 'b': 2} 
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   143
In []: a['a'] = 10
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   144
In []: print a
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   145
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   146
  What is the output?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   147
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   148
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   149
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   150
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   151
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   152
In []: for i in range(3, 10, 2):
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   153
  ...:     print i
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   154
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   155
  What is the output?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   156
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   157
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   158
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   159
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   160
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   161
In []: a = [1, 2, 3] 
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   162
In []: a.extend([5, 6])
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   163
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   164
  What is the value of a?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   165
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   166
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   167
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   168
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   169
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   170
In []: a = (1, 2, 3)
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   171
In []: a[1] = 10
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   172
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   173
  What is the result?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   174
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   175
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   176
\begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   177
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   178
  \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   179
def func(x, y=10):
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   180
    print x+1, y+10
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   181
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   182
func(1)
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   183
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   184
  \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   185
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   186
  What is the output?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   187
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   188
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   189
\begin{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   190
    \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   191
  How many items can a function return?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   192
\end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   193
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   194
%% \begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   195
%%     \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   196
%%     Consider a module called \lstinline+gcd.py+ looking like this:
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   197
%%     \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   198
%% def gcd(a, b):
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   199
%%    ...
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   200
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   201
%% if __name__ == '__main__':
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   202
%%     print gcd(10, 25)
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   203
%%     \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   204
%% If this module is imported, will it print the gcd of 10 and 25?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   205
%% \end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   206
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   207
%% \begin{frame}[fragile]
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   208
%%     \frametitle{\incqno}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   209
%%   \begin{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   210
%% In [1]: print hello 
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   211
%%   \end{lstlisting}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   212
%%   Exactly what exception will you get if you run this on a fresh
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   213
%%   interpreter?
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   214
%% \end{frame}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   215
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   216
\end{document}
57291186d598 Updated the quiz tex files of both day 1 and day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   217