quiz.tex
changeset 86 f657495cf8b2
parent 85 8ca53181bee6
child 89 98ebba820e91
equal deleted inserted replaced
85:8ca53181bee6 86:f657495cf8b2
     1 \documentclass[a4paper,10pt]{book}
     1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
     2 % Tutorial slides on Python.
       
     3 %
       
     4 % Author: FOSSEE <info at fossee  dot in>
       
     5 % Copyright (c) 2005-2009, FOSSEE Team
       
     6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
     7 
       
     8 
       
     9 \documentclass[14pt,compress]{beamer}
       
    10 
       
    11 \mode<presentation>
       
    12 {
       
    13   \useoutertheme{split}
       
    14   \setbeamercovered{transparent}
       
    15 }
       
    16 
       
    17 \definecolor{darkgreen}{rgb}{0,0.5,0}
       
    18 
       
    19 \usepackage{listings}
       
    20 \lstset{language=Python,
       
    21     basicstyle=\ttfamily\bfseries,
       
    22     commentstyle=\color{red}\itshape,
       
    23   stringstyle=\color{darkgreen},
       
    24   showstringspaces=false,
       
    25   keywordstyle=\color{blue}\bfseries}
       
    26 
       
    27 \newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
       
    28 
       
    29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    30 % Title page
       
    31 \title[Basic Python]{Python: Quiz}
       
    32 
       
    33 \author[FOSSEE Team] {FOSSEE Authors}
       
    34 
       
    35 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
       
    36 \date[] {11, October 2009\\Day 1, Session 0}
       
    37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     2 
    38 
     3 
    39 
     4 \begin{document}
    40 \begin{document}
       
    41 
       
    42 \begin{frame}
       
    43   \titlepage
       
    44 \end{frame}
       
    45 
       
    46 \begin{frame}{}
       
    47   What is the biggest integer number that can be represented by Python?
       
    48 \end{frame}
       
    49 
       
    50 \begin{frame}{}
       
    51   What is the result of 17.0 / 2?
       
    52 \end{frame}
       
    53 
       
    54 \begin{frame}{}
       
    55   What does '*' * 40 produce?
       
    56 \end{frame}
       
    57 
       
    58 \begin{frame}{}
       
    59   Which of the following is not a type in Python?
       
    60   \begin{enumerate}
       
    61     \item int
       
    62     \item float
       
    63     \item char
       
    64     \item string
       
    65   \end{enumerate}
       
    66 \end{frame}
       
    67 
       
    68 \begin{frame}[fragile]{}
       
    69   What happens when we run this code?
       
    70   \begin{lstlisting}
       
    71 a = False
       
    72 b = True
       
    73 c = True
       
    74 if a and b or c:
       
    75     print "You are correct!"
       
    76   \end{lstlisting}
       
    77 \end{frame}
       
    78 
       
    79 \begin{frame}{}
       
    80   What is the difference between print x and print x, ?
       
    81 \end{frame}
       
    82 
       
    83 \begin{frame}{}
       
    84   A single line of CSV file should be separated into fields. What method would you use to achieve this?
       
    85 \end{frame}
       
    86 
       
    87 \begin{frame}{}
       
    88   How many items can a function return?
       
    89 \end{frame}
       
    90 
       
    91 \begin{frame}{}
       
    92   If function returns more than one item/object what is the return type of the function?
       
    93 \end{frame}
       
    94 
       
    95 \begin{frame}{}
       
    96   Given a list a, what will its slice a[:-1] evaluate to?
       
    97 \end{frame}
       
    98 
       
    99 \begin{frame}{}
       
   100   How do you get a slice of the list where the slice has only alternate elements?
       
   101 \end{frame}
       
   102 
       
   103 \begin{frame}{}
       
   104   How do you combine 2 lists?
       
   105 \end{frame}
       
   106 
       
   107 \begin{frame}{}
       
   108   How do you find the presence of a given element in the list?
       
   109 \end{frame}
       
   110 
       
   111 \begin{frame}{}
       
   112   You are given a tuple a = (1, 2, 5, 7). What is the result of a[1] = 3?
       
   113 \end{frame}
       
   114 
       
   115 \begin{frame}{}
       
   116   We use \kwrd{for} to loop through the elements of a list. What do we have to do if we want to iterate through the elements of a list as well as get the index of the elements of the list as we iterate through?
       
   117 \end{frame}
       
   118 
       
   119 \begin{frame}{}
       
   120   What is the difference between import math and from math import *?
       
   121 \end{frame}
       
   122 
       
   123 \begin{frame}{}
       
   124   What can be the keys of a dictionary?
       
   125 \end{frame}
       
   126 
       
   127 \begin{frame}{}
       
   128   What happens when you try to access a key in the dictionary that does not exist?
       
   129 \end{frame}
       
   130 
       
   131 \begin{frame}{}
       
   132   How do you avoid such an exception?
       
   133 \end{frame}
       
   134 
       
   135 \begin{frame}{}
       
   136   How do you obtain all the keys of the dictionary?
       
   137   \pause
       
   138   \\all the values?
       
   139 \end{frame}
       
   140 
       
   141 \begin{frame}{}
       
   142   What will the set contain when you create a set from a list containing duplicate elements?
       
   143 \end{frame}
       
   144 
       
   145 \end{document}
       
   146 
     5 \begin{enumerate}
   147 \begin{enumerate}
     6   \item Which version of Python were you using? 
   148   \item Which version of Python were you using?
     7   \item List some key differences between IPython and Vanilla Python
   149   \item List some key differences between IPython and Vanilla Python
     8   \item What is the biggest integer number that can be represented by Python?
   150   \item What is the biggest integer number that can be represented by Python?
     9   \item What is the result of 17.0 / 2?
   151   \item What is the result of 17.0 / 2?
    10   \item What does '*' * 40 produce?
   152   \item What does '*' * 40 produce?
    11   \item List all the basic types available in Python.
   153   \item List all the basic types available in Python.
    37   \item How do you obtain all the values of the dictionary?
   179   \item How do you obtain all the values of the dictionary?
    38   \item What will the set contain when you create a set from a list containing duplicate elements?
   180   \item What will the set contain when you create a set from a list containing duplicate elements?
    39   \item Name any 2 types of Exception.
   181   \item Name any 2 types of Exception.
    40   \item Whats are the 2 IPython command you use for debugging?
   182   \item Whats are the 2 IPython command you use for debugging?
    41 \end{enumerate}
   183 \end{enumerate}
    42 \end{document}