basic-data-type/questions.rst
changeset 320 223044cf254f
child 337 c65d0d9fc0c8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/basic-data-type/questions.rst	Wed Oct 13 17:10:38 2010 +0530
@@ -0,0 +1,83 @@
+Objective Questions
+-------------------
+
+.. A mininum of 8 questions here (along with answers)
+
+1. How large can an integer in Python be?
+
+   Any Size.
+   
+  
+2. How do you define a complex number in Python?
+
+   Using the following notation.
+   
+   [Real part] + [Imaginary part] j
+   example ::
+   
+   c= 3.2 + 4.6j
+
+
+
+3. Look at the following piece of code ::
+   
+   In []: f or t 
+   Out[]:True
+
+   What can you comment about the data type of f and t ? 
+
+4. One major diffence between tuples and lists?
+
+   Tuples are immutable while lists are not.
+
+
+5. Look at the following sequence ::
+
+   In []:t=true
+   NameError: name 'true' is not defined
+
+   What might be the reason for error here?
+
+   In this scenario , it seems the programmer wanted to create a variable t with the boolean value True with a capital T. Since no variable by the name true(small t) is known to the interpreter it gives a NameError. 
+
+
+6. Put the following string in a variable quotation.
+   "God doesn't play dice" -Albert Einstein
+
+   quotation='''"God doesn't play dice" -Albert Einstein'''
+
+7. Given a tuple ::
+
+   tup=(7,4,2,1,3,6,5,8)
+   tup[-2]
+  
+   5
+
+8. What is the syntax for checking containership in Python?::
+
+   element in sequence 
+   'l' in "Hello"
+    True
+
+9. Split this string on whitespaces? ::
+
+   string="Split this string on whitespaces?"
+
+   string.split()
+   
+10. What is the answer of 5/2 and 5.0/2 . If yes , why.
+
+    Yes, There is a difference. 
+    Because one is integer division and other is float division. 
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+1. Given two lists for example,
+   list1=[1,2,3,4] and list2=[1,2,3,4,5,6,7] write a program to remove one list from the other.
+
+
+#. Write a program to check if a string is palindrome?
+