author | Anoop Jacob Thomas<anoop@fossee.in> |
Sat, 18 Dec 2010 12:54:49 +0530 | |
changeset 524 | b602b4dcc87d |
parent 522 | d33698326409 |
permissions | -rw-r--r-- |
522
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
1 |
Objective Questions |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
2 |
------------------- |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
3 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
4 |
.. A mininum of 8 questions here (along with answers) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
5 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
6 |
1. In Python a block is represented by |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
7 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
8 |
a. Curly braces |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
9 |
#. Begin and End keywords |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
10 |
#. Indentation |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
11 |
#. Curly braces + Indentation |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
12 |
#. All of the above |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
13 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
14 |
Answer: Indentation |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
15 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
16 |
2. Indentation is not mandatory in Python |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
17 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
18 |
a. True |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
19 |
#. False |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
20 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
21 |
Answer: False |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
22 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
23 |
3. A ``for`` loop in Python, |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
24 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
25 |
a. is a simple iterator |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
26 |
#. is a condition based loop |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
27 |
#. can iterate only over integer list of elements |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
28 |
#. All of the above |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
29 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
30 |
Answer: is a simple iterator |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
31 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
32 |
4. ``range()`` function can generate negative numbers |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
33 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
34 |
a. True |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
35 |
#. False |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
36 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
37 |
Answer: True |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
38 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
39 |
5. ``range(a,b)`` function returns, |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
40 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
41 |
a. A tuple of elements from a to b including a and b |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
42 |
#. A tuple of elements from a to b excluding b |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
43 |
#. A list of elements from a to b including a and b |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
44 |
#. A list of elements from a to b excluding b |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
45 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
46 |
Answer: A list of elements from a to b excluding b |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
47 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
48 |
6. ``linspace(1,100,2)`` and ``range(1,100,2)`` produces the same output, |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
49 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
50 |
a. True |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
51 |
#. False |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
52 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
53 |
Answer: False |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
54 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
55 |
7. What is the output of the below code snippet? |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
56 |
:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
57 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
58 |
y = 1 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
59 |
for x in range(21): |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
60 |
y*=x |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
61 |
print y |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
62 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
63 |
a. Product of natural numbers up to 20(including) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
64 |
#. Product of natural numbers up to 21(including) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
65 |
#. Zero |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
66 |
#. Error |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
67 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
68 |
Answer: Zero |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
69 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
70 |
8. What is the output of the below code snippet? |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
71 |
:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
72 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
73 |
y = 1 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
74 |
for x in range(1,21): |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
75 |
y*=x |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
76 |
print y |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
77 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
78 |
a. Product of natural numbers up to 20(including) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
79 |
#. Product of natural numbers up to 21(including) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
80 |
#. Zero |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
81 |
#. Error |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
82 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
83 |
Answer: Product of natural numbers up to 20(including) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
84 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
85 |
9. What is the output of the below code snippet? |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
86 |
:: |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
87 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
88 |
y = 1 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
89 |
for x in range(1,21) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
90 |
y*=x |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
91 |
print y |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
92 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
93 |
a. Product of natural numbers up to 20(including) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
94 |
#. Product of natural numbers up to 21(including) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
95 |
#. Zero |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
96 |
#. Error |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
97 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
98 |
Answer: Error |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
99 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
100 |
Larger Questions |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
101 |
---------------- |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
102 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
103 |
.. A minimum of 2 questions here (along with answers) |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
104 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
105 |
1. Write a python script to calculate the sum of the first 1000 |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
106 |
natural numbers? |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
107 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
108 |
2. Write a python script to find out prime numbers up to 500. |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
109 |
[`hint`: a number ``A`` which is divisible by only ``1`` and ``A`` |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
110 |
is a prime number.] |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
111 |
|
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
112 |
3. Write a python script to find out the difference between the |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
113 |
square of sum of first 100 natural numbers and sum of squares of |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
114 |
first 100 natural numbers. |
d33698326409
Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
115 |