getting_started_with_strings/questions.rst
changeset 522 d33698326409
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting_started_with_strings/questions.rst	Wed Dec 01 16:51:35 2010 +0530
@@ -0,0 +1,80 @@
+Objective Questions
+-------------------
+
+.. A mininum of 8 questions here (along with answers)
+
+1. List the type of quotes that can be used to define strings. 
+ 
+   Answer: 'single quotes', "double quotes", 
+           '''triple single quotes'''
+           """triple double quotes"""
+   
+#. Given the strings ``s`` and ``S``, ``s='Hello World'`` and
+   ``S="Hello World``. s and S are different strings. True or False?
+
+#. What is the output of::
+   
+     s = 'It's all here'
+
+   Answer: ``SyntaxError``
+
+#. Write code to assign s, the string ``' is called the apostrophe``
+
+   Answer: ``s = "`is called the apostrophe"``
+
+#. Given strings s and t, ``s = "Hello"`` and ``t = "World"``. What is
+   the output of s + t?
+
+   Answer: HelloWorld
+
+#. Given strings s and t, ``s = "Hello"`` and ``t = "World"`` and an
+   integer r, ``r = 2``. What is the output of s * r + s * t?
+
+   Answer: HelloHelloWorldWorld
+
+#. Given strings s and t, ``s = "Hello"`` and ``t = "World"`` and an
+   integer r, ``r = 2``. What is the output of s * 'r' ? 
+
+   Answer: TypeError - can't multiply a sequence by non-int
+
+#. Given the string ``s = "Hello"``, we wish to change it to
+   ``hello``. what is the result of::
+   
+     s[0] = 'h'
+
+   Answer: TypeError - 'str' object does not support item assignment. 
+
+#. Given the string ``s = "Hello"``, we wish to change it to
+   ``hello``. what is the result of::
+   
+     s = "hello"
+
+   Answer: s is changed to "hello"
+
+#. Which type of string can be written in multiple lines, with line
+   breaks. (Note: more than one answer may be correct.)
+
+   #. triple double quoted strings
+   #. single quoted strings
+   #. double quoted strings
+   #. triple single quoted strings
+
+   Answer: triple double quoted strings and triple single quoted strings
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+1. Given the string s, ``s = F.R.I.E.N.D.S``, obtain the string
+   "FRIENDS". 
+
+   Answer::
+   
+     s = s[0] + s[2] + s[4] + s[6] + s[8] + s[10] + s[12] 
+
+2. Assign the string ``Today's Quote: "Don't believe in any quote,
+   including this."`` to the variable ``quote``. 
+
+   Answer: 
+   quote = """Today's Quote: "Don't believe in any quote, including this."""