212 </question> |
209 </question> |
213 |
210 |
214 </day1quiz1> |
211 </day1quiz1> |
215 |
212 |
216 <day1quiz2> |
213 <day1quiz2> |
|
214 |
|
215 <question> |
|
216 <description> |
|
217 What is the value of a after executing this code. |
|
218 </description> |
|
219 <code> |
|
220 In []: a = array([[1, 2], |
|
221 [3, 4]]) |
|
222 In []: a[1,0] = 0 |
|
223 </code> |
|
224 <time_limit> |
|
225 60 |
|
226 </time_limit> |
|
227 <expected_answer> |
|
228 \[ \[ 1 , 2 \] , \[ 0 , 4 \] \] |
|
229 </expected_answer> |
|
230 </question> |
|
231 |
|
232 <question> |
|
233 <description> |
|
234 What will be printed? |
|
235 </description> |
|
236 <code> |
|
237 In []: x = array(([1,2,3,4], |
|
238 [2,3,4,5])) |
|
239 In []: x[-2][-3] = 4 |
|
240 In []: print x |
|
241 </code> |
|
242 <time_limit> |
|
243 90 |
|
244 </time_limit> |
|
245 <expected_answer> |
|
246 array \( \( \[ 4 , 2 , 3 , 4 \] , \[ 2 , 3 , 4 , 5 \] \) \) |
|
247 array \( \[ \[ 4 , 2 , 3 , 4 \] , \[ 2 , 3 , 4 , 5 \] \] \) |
|
248 \[ \[ 4 , 2 , 3 , 4 \] , \[ 2 , 3 , 4 , 5 \] \] |
|
249 \( \[ 4 , 2 , 3 , 4 \] , \[ 2 , 3 , 4 , 5 \] \) |
|
250 </expected_answer> |
|
251 </question> |
|
252 |
|
253 <question> |
|
254 <description> |
|
255 If x = array([[1,2,3,4]]) How to change x to array([[1,2,0,4]]) ? |
|
256 </description> |
|
257 <time_limit> |
|
258 60 |
|
259 </time_limit> |
|
260 <expected_answer> |
|
261 x\[ 0 \]\[ 2 \] = 0 |
|
262 </expected_answer> |
|
263 </question> |
|
264 |
|
265 <question> |
|
266 <description> |
|
267 |
|
268 x = array([[1,2,3,4], |
|
269 [3,4,2,5]]) |
|
270 |
|
271 How do you get the following slice of x ? |
|
272 |
|
273 array([[2,3], |
|
274 [4,2]]) |
|
275 |
|
276 </description> |
|
277 <time_limit> |
|
278 60 |
|
279 </time_limit> |
|
280 <expected_answer> |
|
281 x\[ \: , 1 \: 3 \] |
|
282 x\[ \: , 1 \: -1 \] |
|
283 x\[ \: , -3 \: -1 \] |
|
284 </expected_answer> |
|
285 </question> |
|
286 |
|
287 <question> |
|
288 <description> |
|
289 What is the output of x[::3,::3] |
|
290 </description> |
|
291 <code> |
|
292 In []: x = array([[9,18,27], |
|
293 [30,60,90], |
|
294 [14,7,1]]) |
|
295 </code> |
|
296 <time_limit> |
|
297 30 |
|
298 </time_limit> |
|
299 <expected_answer> |
|
300 9 |
|
301 </expected_answer> |
|
302 </question> |
|
303 |
|
304 <question> |
|
305 <description> |
|
306 How do you get the transpose of this array? |
|
307 </description> |
|
308 <code> |
|
309 In []: a = array([[1, 2], |
|
310 [3, 4]]) |
|
311 </code> |
|
312 <time_limit> |
|
313 30 |
|
314 </time_limit> |
|
315 <expected_answer> |
|
316 a\.T |
|
317 </expected_answer> |
|
318 </question> |
|
319 |
|
320 <question> |
|
321 <description> |
|
322 What does this produce? |
|
323 </description> |
|
324 <code> |
|
325 In []: a = array([[1, 2], |
|
326 [3, 4]]) |
|
327 In []: b = array([[1, 1], |
|
328 [2, 2]]) |
|
329 In []: a*b |
|
330 </code> |
|
331 <time_limit> |
|
332 45 |
|
333 </time_limit> |
|
334 <expected_answer> |
|
335 array \( \[ \[ 1 , 2 \] , \[ 6 , 8 \] \] \) |
|
336 \[ \[ 1 , 2 \] , \[ 6 , 8 \] \] |
|
337 </expected_answer> |
|
338 </question> |
|
339 |
|
340 <question> |
|
341 <description> |
|
342 What command do you use to find the inverse of a matrix and its eigenvalues? |
|
343 </description> |
|
344 <time_limit> |
|
345 30 |
|
346 </time_limit> |
|
347 <expected_answer> |
|
348 inv .* eigvals |
|
349 </expected_answer> |
|
350 </question> |
|
351 |
|
352 <question> |
|
353 <description> |
|
354 Given a 4x4 matrix A and a 4-vector b , what command do you use to solve for the equation Ax = b ? |
|
355 </description> |
|
356 <time_limit> |
|
357 45 |
|
358 </time_limit> |
|
359 <expected_answer> |
|
360 solve \( A , b \) |
|
361 </expected_answer> |
|
362 </question> |
|
363 |
|
364 <question> |
|
365 <description> |
|
366 How do you calculate the roots of the polynomial, y = 1 + 6*x + 8*x^2 + x^3 |
|
367 </description> |
|
368 <time_limit> |
|
369 45 |
|
370 </time_limit> |
|
371 <expected_answer> |
|
372 roots \( \[ 1 , 8 , 6 , 1 \] \) |
|
373 </expected_answer> |
|
374 </question> |
|
375 |
|
376 <question> |
|
377 <description> |
|
378 Two arrays a and b are numerically almost equal, what command do you use to check if this is true? |
|
379 </description> |
|
380 <time_limit> |
|
381 30 |
|
382 </time_limit> |
|
383 <expected_answer> |
|
384 allclose \( a , b \) |
|
385 allclose \( b , a \) |
|
386 </expected_answer> |
|
387 </question> |
|
388 |
217 </day1quiz2> |
389 </day1quiz2> |
218 |
390 |
219 </questionbank> |
391 </questionbank> |