author | anand |
Thu, 11 Nov 2010 00:03:57 +0530 | |
changeset 472 | fcdec2d28c9a |
parent 262 | 0038edaf660c |
permissions | -rw-r--r-- |
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
1 |
Objective Questions |
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
2 |
------------------- |
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
3 |
|
262 | 4 |
1. which default argument, when used with ``@interact`` gives a slider |
5 |
starting at 0 and ending in 10 |
|
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
6 |
|
262 | 7 |
a. (0..11) |
8 |
#. range(0, 11) |
|
9 |
#. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
|
10 |
#. (0..10) |
|
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
11 |
|
262 | 12 |
Answer: (0..10) |
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
13 |
|
262 | 14 |
2. What is the input widget resulted by using ``n = [2, 4, 5, 9]`` in the |
15 |
default arguments along with ``@interact`` |
|
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
16 |
|
262 | 17 |
a. input field |
18 |
#. set of buttons |
|
19 |
#. slider |
|
20 |
#. None |
|
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
21 |
|
262 | 22 |
Answer: set of buttons |
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
23 |
|
262 | 24 |
3. what is the type of ``n`` in the following function:: |
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
25 |
|
262 | 26 |
@interact |
27 |
def f(n=2.5): |
|
28 |
# do something with n |
|
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
29 |
|
262 | 30 |
a. int |
31 |
#. float |
|
32 |
#. string |
|
33 |
#. complex |
|
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
34 |
|
262 | 35 |
Answer: float |
256
a3aa223c1662
added script to using_sage_to_teach
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
36 |