author | nishanth |
Thu, 22 Apr 2010 04:24:19 +0530 | |
changeset 46 | b45bb982ae24 |
parent 39 | 0fa055b8ea98 |
child 47 | 8a837762531b |
permissions | -rw-r--r-- |
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 | 6 |
Describe the plot produced by the following code |
7 |
</description> |
|
8 |
<time_limit> |
|
9 |
30 |
|
10 |
</time_limit> |
|
11 |
<code> |
|
12 |
In []: x = linspace(0, 2*pi, 50) |
|
13 |
In []: plot(x, cos(x), 'go') |
|
14 |
</code> |
|
15 |
<expected_answer> |
|
16 |
Correct this question manually |
|
17 |
</expected_answer> |
|
18 |
</question> |
|
19 |
||
20 |
<question> |
|
21 |
<description> |
|
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? |
|
23 |
</description> |
|
24 |
<time_limit> |
|
25 |
30 |
|
26 |
</time_limit> |
|
27 |
<expected_answer> |
|
28 |
\%hist \%save |
|
29 |
</expected_answer> |
|
30 |
</question> |
|
31 |
||
32 |
<question> |
|
33 |
<description> |
|
34 |
How do you set the x and y labels of a plot to "x" and "sin(x)" ? |
|
35 |
</description> |
|
36 |
<time_limit> |
|
37 |
60 |
|
38 |
</time_limit> |
|
39 |
<expected_answer> |
|
40 |
xlabel \( \" x \" \) ylabel \( \"sin\(x\)\" \) |
|
41 |
xlabel \( \" x \" \) ylabel \( \'sin\(x\)\' \) |
|
42 |
xlabel \( \' x \' \) ylabel \( \"sin\(x\)\" \) |
|
43 |
xlabel \( \' x \' \) ylabel \( \'sin\(x\)\' \) |
|
44 |
</expected_answer> |
|
45 |
</question> |
|
46 |
||
47 |
<question> |
|
48 |
<description> |
|
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 | 55 |
xlim \( 0 , 2 \* pi \) [;,\n+] ylim \( -1\.5 , 1\.5 \) |
56 |
</expected_answer> |
|
57 |
</question> |
|
58 |
||
59 |
<question> |
|
60 |
<description> |
|
61 |
How do you combine two lists a and b to produce one list? |
|
62 |
</description> |
|
63 |
<time_limit> |
|
64 |
30 |
|
65 |
</time_limit> |
|
66 |
<expected_answer> |
|
67 |
a \+ b |
|
68 |
</expected_answer> |
|
69 |
</question> |
|
70 |
||
71 |
<question> |
|
72 |
<description> |
|
73 |
If a = [1, 2, 5, 9] how do you add 10 to the end of this list ? |
|
74 |
</description> |
|
75 |
<time_limit> |
|
76 |
30 |
|
77 |
</time_limit> |
|
78 |
<expected_answer> |
|
79 |
a\.append \( 10 \) |
|
80 |
a = a \+ \[ 10 \] |
|
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 | 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 | 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 | 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 | 99 |
The following code snippet has an error/bug. |
100 |
What is the error? |
|
101 |
</description> |
|
102 |
<code> |
|
103 |
In []: l = [0.1, 0.2, 0.3, 0.4] |
|
104 |
In []: t = [0.69, 0.90, 1.19, 1.30] |
|
105 |
In []: tsq = [] |
|
106 |
In []: for time in t: |
|
107 |
....: tsq.append(time*time) |
|
108 |
....: plot(l, tsq) |
|
109 |
</code> |
|
110 |
<time_limit> |
|
111 |
60 |
|
112 |
</time_limit> |
|
113 |
<expected_answer> |
|
114 |
plot |
|
115 |
</expected_answer> |
|
116 |
</question> |
|
117 |
||
118 |
<question> |
|
119 |
<description> |
|
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 | 127 |
\.split \( " , " \) |
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 | 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 | 143 |
|
46 | 144 |
<question> |
145 |
<description> |
|
146 |
What is the output of the following code snippet |
|
147 |
</description> |
|
148 |
<code> |
|
149 |
In [1]: d = { |
|
150 |
'a': 1, |
|
151 |
'b': 2 |
|
152 |
} |
|
153 |
In [2]: print d['c'] |
|
154 |
</code> |
|
155 |
<time_limit> |
|
156 |
30 |
|
157 |
</time_limit> |
|
158 |
<expected_answer> |
|
159 |
error |
|
160 |
Error |
|
161 |
ERROR |
|
162 |
</expected_answer> |
|
163 |
</question> |
|
164 |
||
165 |
<question> |
|
166 |
<description> |
|
167 |
Given the below dictionary, what command will you give to plot a pie-chart? |
|
168 |
</description> |
|
169 |
<code> |
|
170 |
In []: sc = {'A': 10, 'B': 20, |
|
171 |
'C': 70} |
|
172 |
</code> |
|
173 |
<time_limit> |
|
174 |
60 |
|
175 |
</time_limit> |
|
176 |
<expected_answer> |
|
177 |
pie \( sc\.values \( \) \) |
|
178 |
pie \( sc\.values \( \) , labels = sc\.keys \( \) \) |
|
179 |
</expected_answer> |
|
180 |
</question> |
|
181 |
||
182 |
<question> |
|
183 |
<description> |
|
184 |
Given the below marks, how will you calculate the mean? |
|
185 |
</description> |
|
186 |
<code> |
|
187 |
In []: marks = [10, 20, 30, 50, 55, |
|
188 |
75, 83] |
|
189 |
</code> |
|
190 |
<time_limit> |
|
191 |
30 |
|
192 |
</time_limit> |
|
193 |
<expected_answer> |
|
194 |
mean \( marks \) |
|
195 |
sum \( marks \) \/ len \( marks \) |
|
196 |
</expected_answer> |
|
197 |
</question> |
|
198 |
||
199 |
<question> |
|
200 |
<description> |
|
201 |
How will you convert the list marks to an array? |
|
202 |
</description> |
|
203 |
<code> |
|
204 |
In []: marks = [10, 20, 30, 50, 55, 75, 83] |
|
205 |
</code> |
|
206 |
<time_limit> |
|
207 |
30 |
|
208 |
</time_limit> |
|
209 |
<expected_answer> |
|
210 |
array \( marks \) |
|
211 |
</expected_answer> |
|
212 |
</question> |
|
213 |
||
33
d28d0957a5ab
added intro page and manual submit button in question page
nishanth
parents:
29
diff
changeset
|
214 |
</day1quiz1> |
29 | 215 |
|
33
d28d0957a5ab
added intro page and manual submit button in question page
nishanth
parents:
29
diff
changeset
|
216 |
<day1quiz2> |
29 | 217 |
</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
|
218 |
|
456b7b9e3d13
created a question bank xml file and created a seed_que command for adding questions to db from xml
nishanth
parents:
diff
changeset
|
219 |
</questionbank> |