using_sage_to_teach/questions.rst
changeset 262 0038edaf660c
parent 256 a3aa223c1662
--- a/using_sage_to_teach/questions.rst	Fri Oct 08 23:55:07 2010 +0530
+++ b/using_sage_to_teach/questions.rst	Sun Oct 10 13:42:57 2010 +0530
@@ -1,90 +1,36 @@
 Objective Questions
 -------------------
 
- 1. If ``a = [1, 1, 2, 3, 3, 5, 5, 8]``. What is set(a)
-
-   a. set([1, 1, 2, 3, 3, 5, 5, 8])
-   #. set([1, 2, 3, 5, 8])
-   #. set([1, 2, 3, 3, 5, 5])
-   #. Error
-
-   Answer: set([1, 2, 3, 5, 8])
-
- 2. ``a = set([1, 3, 5])``. How do you find the length of a?
-
-   Answer: len(a)
-
- 3. ``a = set([1, 3, 5])``. What does a[2] produce?
-
-   a. 1
-   #. 3
-   #. 5
-   #. Error
+ 1. which default argument, when used with ``@interact`` gives a slider 
+    starting at 0 and ending in 10
 
-   Answer: Error
-
- 4. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
-    is the value of ``odd | squares``?
-
-   Answer: set([1, 3, 4, 5, 7, 9, 16])
-
- 5. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
-    is the value of ``odd - squares``?
+   a. (0..11)
+   #. range(0, 11)
+   #. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+   #. (0..10)
 
-   Answer: set([3, 5, 7])
-
- 6. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
-    is the value of ``odd ^ squares``?
+   Answer: (0..10)
 
-   Answer: set([3, 4, 5, 7, 16])
-
- 7. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
-    does ``odd * squares`` give?
+ 2. What is the input widget resulted by using ``n = [2, 4, 5, 9]`` in the
+    default arguments along with ``@interact``
 
-   a. set([1, 12, 45, 112, 9])
-   #. set([1, 3, 4, 5, 7, 9, 16])
-   #. set([])
-   #. Error
-
-   Answer: Error
-
- 8. ``a = set([1, 2, 3, 4])`` and ``b = set([5, 6, 7, 8])``. What is ``a + b``
+   a. input field
+   #. set of buttons
+   #. slider
+   #. None
 
-   a. set([1, 2, 3, 4, 5, 6, 7, 8])
-   #. set([6, 8, 10, 12])
-   #. set([5, 12, 21, 32])
-   #. Error
-
- 9. ``a`` is a set. how do you check if if a varaible ``b`` exists in ``a``?
+   Answer: set of buttons
 
-   Answer: b in a
-
- 10. ``a`` and ``b`` are two sets. What is ``a ^ b == (a - b) | (b - a)``?
-
-   a. True
-   #. False
+ 3. what is the type of ``n`` in the following function::
 
-   Answer: False
-
-
-Larger Questions
-----------------
-
- 1. Given that mat_marks is a list of maths marks of a class. Find out the
-    no.of duplicates marks in the list.
-
-   Answer::
+        @interact
+        def f(n=2.5):
+            # do something with n
 
-     unique_marks = set(mat_marks)
-     no_of_duplicates = len(mat_marks) - len(unique_marks)
-
- 2. Given that mat_marks is a list of maths marks of a class. Find how many
-    duplicates of each mark exist.
+   a. int
+   #. float
+   #. string
+   #. complex
 
-   Answer::
+   Answer: float
 
-     marks_set = set(mat_marks)
-     for mark in marks_set:
-         occurences = mat_marks.count(mark)
-         print occurences - 1, "duplicates of", mark, "exist"
-