Guided Practice Sheet Python
Guided Practice Sheet Python
(a) my_day_2
(b) 2nd_day
(c)Day_two
(d) _2
(a) eval
(b) assert
(c) nonlocal
(d) pass
(a) init
(b) in
(c) it
(d) on
(a) Lists
(b) Dictionary
(c) Tuples
(d) Class
(a) x^y
(b) x**y
(c) x^^y
(d) none of these
14 +13 % 15
(a) 14
(b) 27
(c) 12
(d) 0
7. Evaluate the expression given below if A = 16 and B = 15.
A%B//A
(a) 0.0
(b) 0
(c) 1.0
(d) 1
x = int(13.25 4/2)
(a) 17
(b) 14
(c) 15
(d) 23
(a) 8/(4/2)
(b) (8/4)/2
10. Which among the following list of operators has the highest precedence?
(a) float('12')
(b) int('12')
(c) float('12.5')
(d) int('12.5')
12. Which of the following statement prints the shown output below?
hello\example\test.txt
(a) print("hello\example\test.txt")
POOVIZHI.M MCA., M.PHIL., LECTURER IN COMPUTER SCIENCE
GUIDED PRACTICE SHEET PYTHON REVISION TOUR
(b) print("hello\\example\\test.txt")
(c) print("hello\"example \"test.txt")
(d) print("hello"\example"\test.txt")
13. Which value type does input() return?
(a) Boolean
(b) String
(c) Int
(d) Float
(a) @
(b) %
(c) +
(d) #
15. Which of the following four code fragments will yield following output?
Eina
Mina
Dika
(a) //
(b) ?
(c) <
(d) and
(a) position
(b) integer position
(c) index
(d) location
(b) in
(c) into
(d) inside
19. The keys of a dictionary must be of types.
(a) Integer
(b) mutable
(c) immutable
(d) any of these
20. Following set of commands is executed in shell, what will be the output?
>>>str = "hello"
>>>str[ : 2]
>>>
(a) he
(b) lo
(c) olleh
(d) hello
(a) list
(b) dictionary
(c) array
(d) tuple
L = 1, 23, 'hello', 1
(a) list
(b) dictionary
(c) array
(d) tuple
23. To store values in terms of key and value, what core data type does
Python provide?
(a) list
(b) tuple
(c) class
(d) dictionary
3 + 3.00, 3**3.0
POOVIZHI.M MCA., M.PHIL., LECTURER IN COMPUTER SCIENCE
GUIDED PRACTICE SHEET PYTHON REVISION TOUR
AL = [1, 2, 3, 4, 5]
String1 = "my"
String2 = "work"
print(String1 + string2)
(a) my work
(b) work
(c) mywork
(d) my
String1 = "my"
String2 = "work"
print(String1 + string2.upper())
(a) mywork
(b) MY Work
POOVIZHI.M MCA., M.PHIL., LECTURER IN COMPUTER SCIENCE
GUIDED PRACTICE SHEET PYTHON REVISION TOUR
(c) myWORK
(d) My Work
(a) "7"
(b) "34"
(c) 34
(d) 24
(a) Line 3
(b) Line 2
(c) Line 4
(d) Line 1
(a) list
(b) dictionary
(c) array
(d) tuple
(a) two2
(b) _main
(c) hello_rsp1
(d) 2 hundred
(a) 300
(b) 100200
(c) 100+200
(d) 200
36. Which amongst the following is a mutable data type in Python?
(a) int
(b) string
(c) tuple
(d) list
39. The statement: bval = str i > str2 shall return. .... As the output if two
strings str1 and str2 contains "Delhi" and "New Delhi".
(a) True
(b) Delhi
(c) New Delhi
(d) False
(a) 11 15 16
(b) 11 16 15
(c) 11 15 15
(d) 16 11 15
41. The process of arranging the array elements in a specified order is termed
as:
(a) Indexing
(b) Slicing
(c) Sorting
(d) Traversing
42. Which of the following Python functions is used to iterate over a sequence
of number by specifying a numeric end value within its parameters?
(a) range()
(b) len()
(c) substring()
(d) random()
43. What is the output of the following?
(a)
0
1
2
(b)
a
b
c
(c)
0
a
1
b
2
c
(d)
2
a
2
b
2
c
x = 123
for i in x:
print(i)
(a) 1 2 3
(b) 123
(c) error
(d) infinite loop
(a) +
(b) *
(c) -
(d) all of the above
46. What will be the output when the following code is executed?
>>> str1="helloworld"
>>> stri[:-1]
(a) dlrowolleh
(b) hello
(c) world
(d) helloworld
(a) 2
(b) 0
(c) 1
(d) Error
(a) [0, 1, 2, 3]
(b) [0, 1, 2, 3, 4]
(c) [0.0, 0.5, 1.0, 1.5]
(d) [0.0, 0.5, 1.0, 1.5, 20]
(a) Day={1:'monday',2:'tuesday',3:'wednesday'}
(b) Day=(1;'monday',2;'tuesday',3;'wednesday')
(c) Day=[1:'monday',2:'tuesday',3:'wednesday']
(d) Day={1 monday',2 tuesday',3 wednesday']
(a) list
(b) dictionary
(c) array
(d) tuple
Type –B-Fill-Ups
1. The smallest individual unit in a program is known as a .
2. A token is also called a .
3. A is a word having special meaning and role as specified by programming
language.
4. The data types whose values cannot be changed in place are called types.
5. In a Python expression, when conversion of a value's data type is done
9. Part of a string containing some contiguous characters from the string is called
10. The operator when used with a list/string and an integer, replicates the
list/string
2. The value of the expressions 4/ (3*(2 - 1)) and 4/3*(2- 1) is the same.
['a', b, c']