# HG changeset patch # User nishanth # Date 1278439293 -19800 # Node ID f8e25dea5222826f0d44a52cff75dcc534257a54 # Parent 281c4bcf848f737d367bc6a40994e7c5d8586f73 updated timing for each question. increased timing actually diff -r 281c4bcf848f -r f8e25dea5222 question_bank.xml --- a/question_bank.xml Fri Jul 02 14:26:41 2010 +0530 +++ b/question_bank.xml Tue Jul 06 23:31:33 2010 +0530 @@ -6,7 +6,7 @@ Describe the plot produced by the following code -30 +90 In []: x = linspace(0, 2*pi, 50) @@ -23,7 +23,7 @@ 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? -30 +60 \%hist \%save @@ -36,7 +36,7 @@ How do you set the x and y labels of a plot to "x" and "sin(x)" ? -60 +75 xlabel \( \" x \" \) ylabel \( \"sin\(x\)\" \) @@ -65,7 +65,7 @@ How do you combine two lists a and b to produce one list? -30 +45 a \+ b @@ -78,7 +78,7 @@ If a = [1, 2, 5, 9] how do you add 10 to the end of this list ? -30 +60 a\.append \( 10 \) @@ -93,7 +93,7 @@ Write the code to read a file "data.txt" and print each line of it? -60 +90 correct this manually @@ -115,7 +115,7 @@ ....: plot(l, tsq) -60 +75 plot @@ -129,7 +129,7 @@ What code would you use to separate the line into fields? -30 +45 \.split \( " , " \) @@ -143,7 +143,7 @@ If a = [1, 2, 5, 9] how do you find the length of this list? -30 +45 len \( a \) @@ -162,7 +162,7 @@ In [2]: print d['c'] -30 +60 error @@ -180,7 +180,7 @@ In []: sc = {'A': 10, 'B': 20, 'C': 70} -60 +75 pie \( sc\.values \( \) \) @@ -197,7 +197,7 @@ In []: marks = [10, 20, 30, 50, 55, 75, 83] -30 +60 mean \( marks \) @@ -214,7 +214,7 @@ In []: marks = [10, 20, 30, 50, 55, 75, 83] -30 +45 array \( marks \) @@ -232,7 +232,7 @@ In []: a[1,0] = 0 -60 +75 \[ \[ 1 , 2 \] , \[ 0 , 4 \] \] @@ -267,7 +267,7 @@ If x = array([[1,2,3,4]]) How to change x to array([[1,2,0,4]]) ? -60 +75 x\[ 0 \]\[ 2 \] = 0 @@ -288,7 +288,7 @@ -60 +90 x\[ \: , 1 \: 3 \] @@ -308,7 +308,7 @@ [14,7,1]]) -30 +60 9 @@ -325,7 +325,7 @@ [3, 4]]) -30 +45 a\.T @@ -359,7 +359,7 @@ What command do you use to find the inverse of a matrix and its eigenvalues? -30 +45 inv .* eigvals @@ -372,7 +372,7 @@ Given a 4x4 matrix A and a 4-vector b , what command do you use to solve for the equation Ax = b ? -45 +60 solve \( A , b \) @@ -385,7 +385,7 @@ How do you calculate the roots of the polynomial, y = 1 + 6*x + 8*x^2 + x^3 -45 +75 roots \( \[ 1 , 8 , 6 , 1 \] \) @@ -398,7 +398,7 @@ Two arrays a and b are numerically almost equal, what command do you use to check if this is true? -30 +60 allclose \( a , b \) @@ -412,7 +412,7 @@ What is the largest integer value that can be represented by Python? -30 +45 No Limit @@ -431,7 +431,7 @@ What is the result of 17.0 / 2? -15 +45 8.5 @@ -444,7 +444,7 @@ Which of the following is not a type in Python? -30 +45 int @@ -464,7 +464,7 @@ How do you create a complex number with real part 2 and imaginary part 0.5 ? -30 +45 2 \+ 0\.5j @@ -478,7 +478,7 @@ What is the difference between print x and print x, -30 +75 correct manually @@ -491,7 +491,7 @@ What does 't' * 40 produce? -30 +45 40 @@ -530,7 +530,7 @@ In []: 47 % 3 -45 +60 2 @@ -543,7 +543,7 @@ How do you find the presence of an element x in the list a -30 +60 x in a @@ -559,7 +559,7 @@ In []: set([1, 2, 8, 2, 13, 8, 9]) -45 +75 set \( \[ 1 , 2 , 8 , 13 , 9 \] \) @@ -578,7 +578,7 @@ In []: print a -60 +75 \{ \'a\' \: 10 , \'b\' \: 2 \} @@ -598,7 +598,7 @@ In []: a.extend([5, 6]) -45 +75 \[ 1 , 2 , 3 , 5 , 6 \] @@ -615,7 +615,7 @@ In []: a[1] = 10 -30 +60 error @@ -634,7 +634,7 @@ print x+1, y+10 -60 +90 2 20 @@ -647,7 +647,7 @@ How many items can a function return ? -30 +45 One