author | Puneeth Chaganti <punchagan@fossee.in> |
Wed, 20 Oct 2010 16:19:55 +0530 | |
changeset 341 | 9f7eb1ed0e08 |
parent 320 | 223044cf254f |
child 342 | 588b681e70c6 |
permissions | -rw-r--r-- |
225
94bcf44b05ad
Minor changes to questions.rst template.
Puneeth Chaganti <punchagan@fossee.in>
parents:
223
diff
changeset
|
1 |
Objective Questions |
94bcf44b05ad
Minor changes to questions.rst template.
Puneeth Chaganti <punchagan@fossee.in>
parents:
223
diff
changeset
|
2 |
------------------- |
213 | 3 |
|
223
ce0e8c99eaee
Added answer format to questions.rst.
Puneeth Chaganti <punchagan@fossee.in>
parents:
216
diff
changeset
|
4 |
.. A mininum of 8 questions here (along with answers) |
213 | 5 |
|
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
6 |
1. How do you create an empty list? :: |
223
ce0e8c99eaee
Added answer format to questions.rst.
Puneeth Chaganti <punchagan@fossee.in>
parents:
216
diff
changeset
|
7 |
|
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
8 |
empty=[] |
223
ce0e8c99eaee
Added answer format to questions.rst.
Puneeth Chaganti <punchagan@fossee.in>
parents:
216
diff
changeset
|
9 |
|
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
10 |
2. What is the most important property of sequence data types like lists? |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
11 |
|
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
12 |
The elements are in order and can be accessed by index numbers. |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
13 |
|
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
14 |
3. Can you have a list inside a list ? |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
15 |
|
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
16 |
Yes,List can contain all the other data types, including list. |
223
ce0e8c99eaee
Added answer format to questions.rst.
Puneeth Chaganti <punchagan@fossee.in>
parents:
216
diff
changeset
|
17 |
|
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
18 |
Example: |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
19 |
list_in_list=[2.3,[2,4,6],'string,'all datatypes can be there'] |
223
ce0e8c99eaee
Added answer format to questions.rst.
Puneeth Chaganti <punchagan@fossee.in>
parents:
216
diff
changeset
|
20 |
|
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
21 |
4. What is the index number of the first element in a list? |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
22 |
|
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
23 |
0 |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
24 |
nonempty = ['spam', 'eggs', 100, 1.234] |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
25 |
nonempty[0] |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
26 |
|
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
27 |
5. How would you access the end of a list without finding its length? |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
28 |
|
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
29 |
Using negative indices. We can the list from the end using negative indices. |
223
ce0e8c99eaee
Added answer format to questions.rst.
Puneeth Chaganti <punchagan@fossee.in>
parents:
216
diff
changeset
|
30 |
|
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
31 |
:: |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
32 |
nonempty = ['spam', 'eggs', 100, 1.234] |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
33 |
nonempty[-1] |
213 | 34 |
|
320
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
35 |
6. What is the function to find the length of a list? |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
36 |
|
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
37 |
len |
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
38 |
|
223044cf254f
Adding new format st-scripts with questions etc for basic-data-type and
amit
parents:
225
diff
changeset
|
39 |
7. |
213 | 40 |
|
225
94bcf44b05ad
Minor changes to questions.rst template.
Puneeth Chaganti <punchagan@fossee.in>
parents:
223
diff
changeset
|
41 |
Larger Questions |
94bcf44b05ad
Minor changes to questions.rst template.
Puneeth Chaganti <punchagan@fossee.in>
parents:
223
diff
changeset
|
42 |
---------------- |
213 | 43 |
|
223
ce0e8c99eaee
Added answer format to questions.rst.
Puneeth Chaganti <punchagan@fossee.in>
parents:
216
diff
changeset
|
44 |
.. A minimum of 2 questions here (along with answers) |
213 | 45 |
|
225
94bcf44b05ad
Minor changes to questions.rst template.
Puneeth Chaganti <punchagan@fossee.in>
parents:
223
diff
changeset
|
46 |
1. Question 1 |
216
7206fe0c03c5
Minor change to questions.rst.
Puneeth Chaganti <punchagan@fossee.in>
parents:
213
diff
changeset
|
47 |
2. Question 2 |