author | Anoop Jacob Thomas<anoop@fossee.in> |
Sat, 18 Dec 2010 12:54:49 +0530 | |
changeset 524 | b602b4dcc87d |
parent 261 | c7f0069d698a |
permissions | -rw-r--r-- |
261
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
1 |
Objective Questions |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
2 |
------------------- |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
3 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
4 |
.. A mininum of 8 questions here (along with answers) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
5 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
6 |
1. Container-ship of values can be checked in a python dictionary |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
7 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
8 |
a. True |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
9 |
#. False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
10 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
11 |
Answer: False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
12 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
13 |
2. Container-ship of only keys can be checked in a python dictionary |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
14 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
15 |
a. True |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
16 |
#. False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
17 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
18 |
Answer: True |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
19 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
20 |
3. The value in a dictionary can be |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
21 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
22 |
a. String |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
23 |
#. Integer |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
24 |
#. Any data type |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
25 |
#. None |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
26 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
27 |
Answer: Any data type |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
28 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
29 |
4. Python lists can be made as a key in dictionaries. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
30 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
31 |
a. True |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
32 |
#. False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
33 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
34 |
Answer: False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
35 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
36 |
5. Given a python dictionary ``x = {'a' : 1, 'b' : 2, 'c' : 3, 'd' : |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
37 |
4}``. When printed using ``print x`` will generate the output in |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
38 |
the order. {key-value pair ``'a':1`` identified as a, ``'b':2`` |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
39 |
identified as b and so on} |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
40 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
41 |
a. a, b, c, d |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
42 |
#. d, c, b, a |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
43 |
#. a, c, b, d |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
44 |
#. b, d, a, c |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
45 |
#. Cannot predict |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
46 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
47 |
Answer: Cannot predict |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
48 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
49 |
6. The python dictionary ``x = {'a' : ['a', 'b', 'c'], 'b' : (1, 2, 3), |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
50 |
1 : {1 : 'one', 2 : 'two'}, 10 : {10 : 'ten', 11 : 'eleven'}}`` is |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
51 |
invalid. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
52 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
53 |
a. True |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
54 |
#. False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
55 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
56 |
Answer: False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
57 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
58 |
7. Consider the python dictionary ``x = {'a' : ['a','b','c'], 'b' : |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
59 |
(1, 2, 3), 1 : {1 : 'one', 2 : 'two'}, 10 : {10 : 'ten', 11 : |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
60 |
'eleven'}}``. And after applying the code below, what will be the |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
61 |
output of ``print x['a']`` |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
62 |
:: |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
63 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
64 |
x['a'].extend(['d', 'e']) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
65 |
x['a'][3] = x[10] |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
66 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
67 |
a. Code will result in error |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
68 |
#. ['a', 'b', 'c', {11: 'eleven', 10: 'ten'}, 'e'] |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
69 |
#. {10 : 'ten', 11 : 'eleven'} |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
70 |
#. {10 : 'ten', 11 : 'eleven', 'a' : ['a', 'b', 'c']} |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
71 |
#. (1, 2, 3, ['a', 'b', 'c']) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
72 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
73 |
Answer: ['a', 'b', 'c', {11: 'eleven', 10: 'ten'}, 'e'] |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
74 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
75 |
8. Consider the python dictionary ``x = {'a' : ['a','b','c'], 'b' : |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
76 |
(1, 2, 3), 1 : {1 : 'one', 2 : 'two'}, 10 : {10 : 'ten', 11 : |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
77 |
'eleven'}}``. The code ``(1, 2, 3) in x.values()`` will return |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
78 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
79 |
a. True |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
80 |
#. False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
81 |
#. Container-ship of values cannot be checked in dictionaries |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
82 |
#. The dictionary is invalid |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
83 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
84 |
Answer: True |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
85 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
86 |
Larger Questions |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
87 |
---------------- |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
88 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
89 |
.. A minimum of 2 questions here (along with answers) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
90 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
91 |
1. Write a python script which can print the numbers from 1 to |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
92 |
999(both included) in words. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
93 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
94 |
2. Given the list of marks of students in a class, write a program to |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
95 |
find the duplicate marks. List the duplicate marks and also print |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
96 |
the number of duplicates for each. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
97 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
98 |
3. Given a list of words, find the anagrams in it and list them. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
99 |
[meats, tap, steep, tames, hare, pets, had, apt, teams, dark, |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
100 |
dealer, once, rhea, cloud, step, steam, have, could, ounce, pest, |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
101 |
head, leader, cone, rare, rear, hear, pat, mates] |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
102 |