Python 3.4.3 Test Answer
( Spoken Tutorial )
01. Given the string ``s = "Hello"``, we wish to change it to ``hello``. what is the result of s[0] = 'h' ?
Ans:- Error--'str' object does not support item assignment.
02. Suppose I made 2 plots overlaid on one another. I am using legend command to distinguish between the two. I used legend([log(x) , log(y)]) to add legend to plot.
Ans:- The command is wrong, log(x) and log(y) should be in inverted commas, rest is fine
03. Given ``odd = set([1, 3, 5, 7, 9])``
``squares = set([1, 4, 9, 16])``.What is the value of ``odd ^ squares``?
Ans:- set([3, 4, 5, 7, 16])
04. If ``a = [1, 1, 2, 3, 3, 6,6,4]``. What is set(a)
Ans:- set([1, 2, 3, 6, 4])
05. %hist command is used to
Ans:- To retrieve the commands which we used till now
06. Predict the output for ones_like([12, 13, 14, 15]) ?
Ans:- array([1, 1, 1, 1])
07. Which method can be used to find out the roots of any arbitrary function?
Ans:- fsolve()
08. Consider the following statements. Which of the following are correct ?
2. simply_trig(f) simplifies the trigonometric part of f(x)
3. f_integral() computes the integral of f(x)
4. f.substitute(theta = 45) computes the value of f(theta) at theta = 45
Ans:- 4
09. ``x = array([1, 2, 3], [5, 6, 7])`` is a valid statement?
Ans:- False
10. What is the output of following?
list = [1,2,3,4,5,6,7,8,9,10]
l = mean(list[1::2])
print(l)
Ans:- 5.0
0 Comments