diff -r 88a01948450d -r d33698326409 basic-data-type/questions.rst --- a/basic-data-type/questions.rst Wed Nov 17 23:24:57 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -Objective Questions -------------------- - -.. A mininum of 8 questions here (along with answers) - -.. #[Puneeth: ``Answer: Any size.``. Demarcate the answer from the -.. question.] - -1. How large can an integer in Python be? - - Answer: Any Size. - - -#. How do you define a complex number in Python? - - Using the following notation. - - [Real part] + [Imaginary part] j - example :: - - Answer: c= 3.2 + 4.6j - - -#. 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 ? - -#. One major diffence between tuples and lists? - - Answer: Tuples are immutable while lists are not. - - - - -#. Put the following string in a variable quotation. - "God doesn't play dice" -Albert Einstein - - quotation='''"God doesn't play dice" -Albert Einstein''' - -#. Given a tuple :: - - tup=(7,4,2,1,3,6,5,8) - tup[-2] - - 5 - -.. #[Puneeth: ``Answer: Any size.``. Demarcate the answer from the -.. question.] - -#. What is the syntax for checking containership in Python?:: - - element in sequence - 'l' in "Hello" - True - -#. Split this string on whitespaces? :: - - string="Split this string on whitespaces?" - - string.split() - -#. 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. 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. - - - -#. Convert the string "I,learnt,python,through,spoken,tutorial" - to "I,learnt through spoken tutorial" - -.. #[Puneeth: comparison has not been taught, has it? does this depend -.. on any other LO?]