question_bank.xml
author nishanth
Thu, 22 Apr 2010 05:33:07 +0530
changeset 47 8a837762531b
parent 46 b45bb982ae24
child 49 3643f59f141e
permissions -rw-r--r--
added all the day1 quiz2 questions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
456b7b9e3d13 created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
diff changeset
     1
<questionbank>
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
     2
<day1quiz1>
28
456b7b9e3d13 created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
diff changeset
     3
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
     4
<question>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
     5
<description>
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
     6
Describe the plot produced by the following code
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
     7
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
     8
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
     9
30
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    10
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    11
<code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    12
In []: x = linspace(0, 2*pi, 50)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    13
In []: plot(x, cos(x), 'go')
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    14
</code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    15
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    16
Correct this question manually
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    17
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    18
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    19
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    20
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    21
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    22
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?
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    23
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    24
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    25
30
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    26
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    27
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    28
\%hist \%save
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    29
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    30
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    31
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    32
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    33
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    34
How do you set the x and y labels of a plot to "x" and "sin(x)" ?
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    35
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    36
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    37
60
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    38
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    39
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    40
xlabel \( \" x \" \) ylabel \( \"sin\(x\)\" \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    41
xlabel \( \" x \" \) ylabel \( \'sin\(x\)\' \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    42
xlabel \( \' x \' \) ylabel \( \"sin\(x\)\" \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    43
xlabel \( \' x \' \) ylabel \( \'sin\(x\)\' \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    44
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    45
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    47
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    48
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    49
How will you set the x and y axis limits so that the region of interest is in the rectangle (0, -1.5) and (2 pi, 1.5)?
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    50
</description>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    51
<time_limit>
39
0fa055b8ea98 implemented correct_quiz function and added it at the time of closing quiz and modified question bank
nishanth
parents: 33
diff changeset
    52
90
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    53
</time_limit>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    54
<expected_answer>
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    55
xlim \( 0 , 2 \* pi \) [;,\n+] ylim \( -1\.5 , 1\.5 \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    56
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    57
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    58
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    59
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    60
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    61
How do you combine two lists a and b to produce one list?
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    62
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    63
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    64
30
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    65
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    66
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    67
a \+ b
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    68
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    69
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    70
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    71
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    72
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    73
If a = [1, 2, 5, 9] how do you add 10 to the end of this list ?
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    74
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    75
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    76
30
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    77
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    78
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    79
a\.append \( 10 \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    80
a = a \+ \[ 10 \]
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    81
a \+= \[ 10 \]
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    82
</expected_answer>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    83
</question>
28
456b7b9e3d13 created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
diff changeset
    84
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    85
<question>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    86
<description>
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    87
Write the code to read a file "data.txt" and print each line of it?
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    88
</description>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    89
<time_limit>
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    90
60
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    91
</time_limit>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    92
<expected_answer>
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    93
correct this manually
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    94
</expected_answer>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    95
</question>
28
456b7b9e3d13 created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
diff changeset
    96
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    97
<question>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
    98
<description>
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
    99
The following code snippet has an error/bug.
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   100
What is the error?
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   101
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   102
<code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   103
In []: l = [0.1, 0.2, 0.3, 0.4]
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   104
In []: t = [0.69, 0.90, 1.19, 1.30]
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   105
In []: tsq = []
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   106
In []: for time in t:
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   107
 ....:     tsq.append(time*time)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   108
 ....:     plot(l, tsq)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   109
</code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   110
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   111
60
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   112
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   113
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   114
plot
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   115
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   116
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   117
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   118
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   119
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   120
"Rossum, Guido, 42, 56, 34, 54" is a sample line from a Comma Separated Values (CSV) file
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   121
What code would you use to separate the line into fields?
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   122
</description>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   123
<time_limit>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   124
30
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   125
</time_limit>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   126
<expected_answer>
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   127
\.split \( " , " \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   128
\.split \( ' , ' \)
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   129
</expected_answer>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   130
</question>
29
ea1c0110e989 fixed the display of question
nishanth
parents: 28
diff changeset
   131
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   132
<question>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   133
<description>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   134
If a = [1, 2, 5, 9] how do you find the length of this list?
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   135
</description>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   136
<time_limit>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   137
30
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   138
</time_limit>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   139
<expected_answer>
39
0fa055b8ea98 implemented correct_quiz function and added it at the time of closing quiz and modified question bank
nishanth
parents: 33
diff changeset
   140
len \( a \)
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   141
</expected_answer>
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   142
</question>
29
ea1c0110e989 fixed the display of question
nishanth
parents: 28
diff changeset
   143
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   144
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   145
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   146
What is the output of the following code snippet
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   147
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   148
<code>
47
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   149
In [1]: d = {'a': 1,
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   150
             'b': 2
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   151
            }
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   152
In [2]: print d['c']
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   153
</code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   154
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   155
30
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   156
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   157
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   158
error
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   159
Error
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   160
ERROR
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   161
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   162
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   163
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   164
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   165
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   166
Given the below dictionary, what command will you give to plot a pie-chart?
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   167
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   168
<code>
47
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   169
In []: sc = {'A': 10, 'B': 20, 'C': 70}
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   170
</code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   171
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   172
60
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   173
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   174
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   175
pie \( sc\.values \( \) \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   176
pie \( sc\.values \( \) , labels = sc\.keys \( \) \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   177
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   178
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   179
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   180
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   181
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   182
Given the below marks, how will you calculate the mean?
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   183
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   184
<code>
47
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   185
In []: marks = [10, 20, 30, 50, 55, 75, 83] 
46
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   186
</code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   187
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   188
30
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   189
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   190
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   191
mean \( marks \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   192
sum \( marks \) \/ len \( marks \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   193
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   194
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   195
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   196
<question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   197
<description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   198
How will you convert the list marks to an array?
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   199
</description>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   200
<code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   201
In []: marks = [10, 20, 30, 50, 55, 75, 83]
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   202
</code>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   203
<time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   204
30
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   205
</time_limit>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   206
<expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   207
array \( marks \)
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   208
</expected_answer>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   209
</question>
b45bb982ae24 added few more questions
nishanth
parents: 39
diff changeset
   210
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   211
</day1quiz1>
29
ea1c0110e989 fixed the display of question
nishanth
parents: 28
diff changeset
   212
33
d28d0957a5ab added intro page and manual submit button in question page
nishanth
parents: 29
diff changeset
   213
<day1quiz2>
47
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   214
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   215
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   216
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   217
What is the value of a after executing this code.
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   218
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   219
<code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   220
In []: a = array([[1, 2],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   221
                  [3, 4]])
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   222
In []: a[1,0] = 0
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   223
</code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   224
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   225
60
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   226
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   227
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   228
\[ \[ 1 , 2 \] , \[ 0 , 4 \] \]
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   229
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   230
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   231
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   232
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   233
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   234
What will be printed?
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   235
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   236
<code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   237
In []: x = array(([1,2,3,4],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   238
                  [2,3,4,5]))
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   239
In []: x[-2][-3] = 4
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   240
In []: print x
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   241
</code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   242
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   243
90
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   244
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   245
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   246
array \( \( \[ 4 , 2 , 3 , 4 \] , \[ 2 , 3 , 4 , 5 \] \) \)
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   247
array \( \[ \[ 4 , 2 , 3 , 4 \] , \[ 2 , 3 , 4 , 5 \] \] \)
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   248
\[ \[ 4 , 2 , 3 , 4 \] , \[ 2 , 3 , 4 , 5 \] \]
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   249
\( \[ 4 , 2 , 3 , 4 \] , \[ 2 , 3 , 4 , 5 \] \)
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   250
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   251
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   252
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   253
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   254
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   255
If x = array([[1,2,3,4]]) How to change x to array([[1,2,0,4]]) ?
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   256
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   257
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   258
60
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   259
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   260
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   261
x\[ 0 \]\[ 2 \] = 0
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   262
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   263
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   264
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   265
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   266
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   267
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   268
x = array([[1,2,3,4],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   269
           [3,4,2,5]])
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   270
		 
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   271
How do you get the following slice of x ?
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   272
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   273
array([[2,3],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   274
      [4,2]])
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   275
       
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   276
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   277
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   278
60
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   279
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   280
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   281
x\[ \: , 1 \: 3 \]
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   282
x\[ \: , 1 \: -1 \]
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   283
x\[ \: , -3 \: -1 \]
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   284
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   285
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   286
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   287
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   288
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   289
What is the output of x[::3,::3]
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   290
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   291
<code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   292
In []: x = array([[9,18,27],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   293
                  [30,60,90],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   294
                  [14,7,1]])
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   295
</code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   296
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   297
30
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   298
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   299
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   300
9
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   301
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   302
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   303
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   304
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   305
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   306
How do you get the transpose of this array?
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   307
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   308
<code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   309
In []: a = array([[1, 2],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   310
                  [3, 4]])
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   311
</code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   312
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   313
30
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   314
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   315
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   316
a\.T
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   317
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   318
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   319
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   320
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   321
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   322
What does this produce?
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   323
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   324
<code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   325
In []: a = array([[1, 2],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   326
                  [3, 4]])
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   327
In []: b = array([[1, 1],
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   328
                  [2, 2]])
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   329
In []: a*b
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   330
</code>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   331
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   332
45
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   333
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   334
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   335
array \( \[ \[ 1 , 2 \] , \[ 6 , 8 \] \] \)
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   336
\[ \[ 1 , 2 \] , \[ 6 , 8 \] \]
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   337
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   338
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   339
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   340
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   341
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   342
What command do you use to find the inverse of a matrix and its eigenvalues?
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   343
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   344
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   345
30
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   346
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   347
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   348
inv .* eigvals
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   349
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   350
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   351
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   352
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   353
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   354
Given a 4x4 matrix A and a 4-vector b , what command do you use to solve for the equation Ax = b ?
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   355
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   356
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   357
45
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   358
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   359
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   360
solve \( A , b \)
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   361
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   362
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   363
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   364
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   365
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   366
How do you calculate the roots of the polynomial, y = 1 + 6*x + 8*x^2 + x^3 
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   367
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   368
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   369
45
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   370
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   371
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   372
roots \( \[ 1 , 8 , 6 , 1 \] \)
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   373
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   374
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   375
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   376
<question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   377
<description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   378
Two arrays a and b are numerically almost equal, what command do you use to check if this is true?
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   379
</description>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   380
<time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   381
30
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   382
</time_limit>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   383
<expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   384
allclose \( a , b \)
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   385
allclose \( b , a \)
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   386
</expected_answer>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   387
</question>
8a837762531b added all the day1 quiz2 questions
nishanth
parents: 46
diff changeset
   388
29
ea1c0110e989 fixed the display of question
nishanth
parents: 28
diff changeset
   389
</day1quiz2>
28
456b7b9e3d13 created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
diff changeset
   390
456b7b9e3d13 created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
diff changeset
   391
</questionbank>