quiz.tex
author Madhusudan.C.S <madhusudancs@gmail.com>
Mon, 26 Oct 2009 12:42:53 +0530
changeset 167 5f13be28532d
parent 94 8c92864c184b
permissions -rw-r--r--
Merged Puneeth and Madhu branches.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     2
% Tutorial slides on Python.
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     3
%
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     4
% Author: FOSSEE <info at fossee  dot in>
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     5
% Copyright (c) 2005-2009, FOSSEE Team
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     7
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     8
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
     9
\documentclass[14pt,compress]{beamer}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    10
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    11
\mode<presentation>
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    12
{
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    13
  \useoutertheme{split}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    14
  \setbeamercovered{transparent}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    15
}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    16
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    17
\definecolor{darkgreen}{rgb}{0,0.5,0}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    18
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    19
\usepackage{listings}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    20
\lstset{language=Python,
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    21
    basicstyle=\ttfamily\bfseries,
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    22
    commentstyle=\color{red}\itshape,
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    23
  stringstyle=\color{darkgreen},
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    24
  showstringspaces=false,
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    25
  keywordstyle=\color{blue}\bfseries}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    26
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    27
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    28
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    29
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    30
% Title page
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    31
\title[Basic Python]{Python: Quiz}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    32
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    33
\author[FOSSEE Team] {FOSSEE}
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    34
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    35
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    36
\date[] {11, October 2009\\Day 2, Session 0}
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    37
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    38
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    39
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    40
\begin{document}
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    41
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    42
\begin{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    43
  \titlepage
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    44
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    45
94
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    46
\begin{frame}
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    47
  \frametitle{Write your details...}
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    48
On the top right hand corner please write down the following:
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    49
  \begin{itemize}
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    50
    \item  Name:
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    51
    \item Affliation:
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    52
    \item Occupation:
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    53
  \end{itemize}
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    54
\end{frame}
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    55
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    56
\begin{frame}{}
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    57
  What is the largest integer value that can be represented by Python?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    58
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    59
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    60
\begin{frame}{}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    61
  What is the result of 17.0 / 2?
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    62
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    63
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    64
\begin{frame}{}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    65
  What does '*' * 40 produce?
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    66
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    67
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    68
\begin{frame}{}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    69
  Which of the following is not a type in Python?
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    70
  \begin{enumerate}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    71
    \item int
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    72
    \item float
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    73
    \item char
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    74
    \item string
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    75
  \end{enumerate}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    76
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    77
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    78
\begin{frame}[fragile]{}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    79
  What happens when we run this code?
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    80
  \begin{lstlisting}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    81
a = False
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    82
b = True
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    83
c = True
94
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
    84
if (a and b) or c:
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    85
    print "You are correct!"
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    86
  \end{lstlisting}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    87
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    88
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    89
\begin{frame}{}
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    90
  What is the difference between \kwrd{print} \emph{x} and \kwrd{print} \emph{x,} ?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    91
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    92
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    93
\begin{frame}{}
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    94
  A sample line from a Comma Separated Values (CSV) file:\\
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    95
  \vspace*{0.2in}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    96
  \emph{Rossum, Guido, 42, 56, 34, 54}\\
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    97
  \vspace*{0.2in}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
    98
  What method would you use to separate the line into fields?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
    99
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   100
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   101
\begin{frame}{}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   102
  How many items can a function return?
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   103
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   104
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   105
\begin{frame}[fragile]{}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   106
  \begin{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   107
  >>> a = [1, 2, 5, 9]
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   108
  >>> a[:-1]
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   109
  \end{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   110
  What is the output?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   111
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   112
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   113
\begin{frame}{}
94
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
   114
  How do you get the alternate elements of a list \emph{p}?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   115
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   116
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   117
\begin{frame}{}
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   118
  How do you combine the two lists \emph{a} and \emph{b}?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   119
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   120
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   121
\begin{frame}{}
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   122
  How do you find the presence of an element \emph{x} in the list \emph{a}?
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   123
\end{frame}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   124
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   125
\begin{frame}[fragile]{}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   126
  \begin{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   127
  >>> a = (1, 2, 5, 7)
94
8c92864c184b Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 89
diff changeset
   128
  >>> a[1] = 3
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   129
  \end{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   130
  What is the output?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   131
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   132
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   133
\begin{frame}[fragile]{}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   134
  \begin{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   135
  for x in "abcd":
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   136
      print x
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   137
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   138
  a
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   139
  b
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   140
  c
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   141
  d
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   142
  \end{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   143
  How do you get the following output? 
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   144
  \begin{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   145
    0 a
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   146
    1 b
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   147
    2 c
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   148
    3 d
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   149
  \end{lstlisting}
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   150
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   151
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   152
\begin{frame}{}
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   153
  What can you use as the keys of a dictionary?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   154
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   155
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   156
\begin{frame}[fragile]{}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   157
  \begin{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   158
  >>> d = {
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   159
      'a': 1,
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   160
      'b': 2
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   161
      }
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   162
  >>> print d['c']
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   163
  \end{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   164
  What is the output?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   165
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   166
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   167
\begin{frame}{}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   168
  How do you obtain all the keys of the dictionary?
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   169
  \pause
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   170
  \\all the values?
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   171
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   172
89
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   173
\begin{frame}[fragile]{}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   174
  \begin{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   175
  >>> set([1, 2, 8, 2, 13, 8, 9])
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   176
  \end{lstlisting}
98ebba820e91 Edited quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 86
diff changeset
   177
  What is the output?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   178
\end{frame}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   179
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   180
\end{document}
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   181
85
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   182
\begin{enumerate}
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   183
  \item Which version of Python were you using?
85
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   184
  \item List some key differences between IPython and Vanilla Python
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   185
  \item What is the biggest integer number that can be represented by Python?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   186
  \item What is the result of 17.0 / 2?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   187
  \item What does '*' * 40 produce?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   188
  \item List all the basic types available in Python.
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   189
  \item What happens when we run this code?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   190
  a = False
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   191
  b = True
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   192
  c = True
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   193
  if a and b or c:
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   194
      print ``You are correct!''
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   195
  \item Select last 3 alternative elements in any given list.
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   196
  \item Give the difference between print x and print x,
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   197
  \item A single line of CSV file should be separated into fields. What method would you use to achieve this?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   198
  \item How many items can a function return?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   199
  \item If function returns more than one item/object what is the return type of the function?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   200
  \item How do you document a function?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   201
  \item Given a list l, what will its slice l[:-1] evaluate to?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   202
  \item How do you get a slice of the list where the slice has only alternate elements?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   203
  \item How do you add another list at the end of a given list?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   204
  \item How do you find if a given element is present in the list or not?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   205
  \item You are given a tuple a = (1, 2, 5, 7). What happens when you do a[1] = 3?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   206
  \item We use for to loop through the list elements. What do we have to do if we want to iterate through the elements of the list as well as get the index of the elements of the list as we iterate through?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   207
  \item What is the difference between import math and from math import *?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   208
  \item List at least 5 Standard Library Modules.
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   209
  \item How do you create a Python module of your own?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   210
  \item What can be the keys of a dictionary?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   211
  \item What happens when you try to access a key in the dictionary that does not exist?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   212
  \item How do you avoid such an exception?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   213
  \item How do you obtain all the keys of the dictionary?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   214
  \item How do you obtain all the values of the dictionary?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   215
  \item What will the set contain when you create a set from a list containing duplicate elements?
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   216
  \item Name any 2 types of Exception.
8ca53181bee6 Added quiz questions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 64
diff changeset
   217
  \item Whats are the 2 IPython command you use for debugging?
86
f657495cf8b2 Final set of changes.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 85
diff changeset
   218
\end{enumerate}