CH 1 - Chapter Clearance
CH 1 - Chapter Clearance
CHAPTER
CLEARANC
E SHEET
STD: XII
COMPUTER
SCIENCE(083)
CHAPTER
1
REVIEW
OF
PYTHON
BASICS 1
MAHATMA
(Affiliated to Central Board of Secondary Education - New Delhi)
CHAPTER CLEARANCE SHEET
STD: XII COMPUTER SCIENCE (083)
CHAPTER 1 – REVIEW OF PYTHON BASICS
2
3
STATE TRUE OR FALSE
4
1. Python is a low level language.
5
2. Python is a free source language.
3. Python converts low level language to high level
language.
4. Python is a compiler.
5. Python is case sensitive language.
6. Python was named after famous BBC comedy show
namely Monty Python‟s Flying Circus.
7. Python is not a Cross-platform Language.
8. All identifiers in Python are in lower case.
9. An identifier is a user defined name given to a
variable or a constant in a program.
10. Operators with the same precedence are evaluated
in right to left manner.
11. Interactive mode is used when a user wants to run a
single line or one block of code.
12. Script mode is used when the user is working with
more than one single code or a block of code.
13. In Python, a variable may be assigned a value of
one type, and then later assigned a value of a
different type.
14. In Python, a variable must be declared before it is
assigned a value.
15. Variable names can be of any length.
16. Python does not allow same variable to hold
different data literals / data types.
17. print(int(6>7-6-7*4) ) will print boolean value.
18. Logical operator not has highest precedence among
all the logical operators.
19. “is” is a membership operator in python.
20. Following code will produce True as
output: x=10>5>1 and -3<-2<-1
print(x)
21. The value of expression 3/5*(7-2) and 3/(5*(7-2)) is
same.
22. The expression 4**3**2 is evaluated as (4**3)**2
23. () have higher precedence that any other operator.
24. print() always inserts a newline after each output.
25. >>> 2*4+36/2-9
In the above expression 36/2 will be evaluated
first by python.
26. When syntax error is encountered, Python displays
the name of the error and a small description about
6
the error.
27. "In Python, data type of a variable depends on its
value"
28. “Python identifiers are dynamically typed.”
29. -88.0 is the output of the print(3-10**2+99/11)
30. “Comments in Python begin with a "$" symbol.”
ASSERTION & REASON
1. A: Python is an interpreted language.
R: Python programs are executed by an interpreter.
2. A: Python is portable and platform independent.
R:Python program can run on various operating
systems and hardware platforms.
3. A: Python is case-sensitive.
R:Python does not use indentation for blocks
and nested blocks.
4. A: Python program is executed line by line.
R: Python is compiled language.
5. A: Python is an object oriented language
R: Python is a cross platform language
6. A: Python is case-sensitive.
R: NUMBER and number are not same in Python
7. A: Python is a high-level object-oriented programming
language.
R: It can run on different platforms like Windows,
Linux, Unix, and Macintosh.
8. A: An identifier cannot have the same name
as of a keyword.
R: Python interpreter will not be able to differentiate
Between a keyword and an identifier having the
same name as of a keyword.
9. >>>print('Good'+' Morning') #Output :Goodmorning
A: Incorrect Output
R: There is a syntax error
10. A: In Python comments are interpreted and are
shown on the output screen.
R: Single line comments in python starts
with # character
11. A: Python uses the concept of L-value and
R-value, that is derived from the typical
mode of evaluation on the left and right side
of an assignment statement
7
R: name = “Raj‟
In the above code the value “Raj‟ is fetched
(Rvalue) and stored in the variable named – name
(L value)
12. A : Age=18; print(age)
R : Variables are case sensitive
13. A:>>> print(type((3 + 33)<(-4 - 44)))
R : As output is True which is a boolean value
14. num1=input("enter a number")
print(num1+2)
A: The above code will give error message when
executed.
R:input() returns a string datatype. We cannot add
string datatype with a numeric datatype. So,
performing arithmetic operation on it will result in
error.
15. var1=10
var1="hello"
A: The above code is invalid. We cannot assign a
data of different data type to an existing variable.
R: Python supports implicit type casting. So it
is possible to assign a data of different data type to
an existing variable.
16. A: You will get an error if you use double quotes
inside a string that is surrounded by double
quotes:
txt = "We are the so-called "Vikings" from the
north."
R: To fix this problem, use the escape
character \":
17. A: Variables whose values can be changed after
they are created and assigned are called immutable.
R: When an attempt is made to update the value
of an immutable variable, the old variable is
destroyed and a new variable is created by the
same name in memory.
18. A:To do arithmetic python uses arithmetic
(+,*,//,**, -, /,%)
R:Each of these operators is a binary operator
19. A: The relational operator determine the relation
8
among different operand
R:It returns the boolean value
20. A:not has a lower priority than non-Boolean
operators
R: So not a==b is interpreted as not(a==b)
21. A:The ** operators is evaluated from right to left
R:All operators are left associative
22. A: for the given expression
v1='1'
v2= 1
v3= v1==v2 #value of v3 is False
R: Integer value cannot be compared with
string value.
23. A: following given expression will result into
TypeError
str1="ABC" ;v1=2
str3=str1*v1
R: operator “*‟ cannot be applied on string
24. A:int(“A‟) The above statement will result into error
R: “A‟ is not recognized by Python
25. A: a=9, b=int(9.2) Both a and b have same value
R:b is converted to integer explicitly
26. A: In an expression, associativity is the solution
to the order of evaluation of those operators
which clashes due to same precedence.
R: Operators in an expression may have equal
precedence due to which the order of
evaluation
cannot be decided just by precedence.
27. A:SyntaxError: Missing parentheses in call to
„print‟.
R:SyntaxError: It is raised when there is an error in
the syntax of the Python code.
28. A: NameError: name 'X' is not defined
R:NameError: It is raised when the requested module
definition is not found.
29. A:ZeroDivisionError: division by zero
R:ZeroDivisionError: It is raised when the
denominator in a division operation is zero.
30. A:TypeError: can only concatenate str(not "int") to
str
9
R:TypeError: It is raised when an operator is
supplied with a value of incorrect data type.
31. A: An example of an infinite loop is : while(1):
R: A loop that continues repeating without a
terminating (ending) condition is an infinite loop.
32. A: The statements within the body of for loopare
executed till the range of values is exhausted.
R: for loop cannot be nested.
33. Analize the following code:
for i in range(1,4):
for j in range (1,i+1):
print(j,end=‟ ‟)
print()
A: output is
1
12
123
R: Here, range function will generate value 1,2,3 in
the outer loop and the inner loop will run for each
value of “i” used in outer loop.
35. A: for loop in Python makes the loop easy to
calculate factorial of a number
R: While loop is an indefinite iteration that is
used when a loop repeats unknown number of
times and end when some condition is met.
36. A: range(0,5) will produce list as [0,1,2,3,4]
R:These are the numbers in arithmetic
progression(a.p.) that begins with lower limit 0
and goes up till upper limit -1.
37. A: To print the sum of following series
1 + 3 + 5…….n. Ravi used the range function in
for loop as follows :range(1,n+1,2) # 3 parameters
R: In range function first parameter is start value,
second parameter is stop value & the third
parameter is step value.
38. x = 0
for i in range(3,9,3):
x = x * 10
+ i print(x)
A: The output of the above code will be 9.
10
R:The loop will run for 2 times.
39. for i in range(1, 6):
for j in range(1, i):
print("*", end=" ")
print()
A: In a nested loop, the inner loop must
terminate before the outer loop.
R:The above program will throw an error.
40. A: break statement terminates the loop.
R: The else clause of a Python loop executes
when the loop
continues normally.
41. A:break statement appears in a nested loop.
R:If the break statement is inside the inner loop
then it will not terminate the inner loop then it
will terminate the outer loop only
42. A: break statement terminates the loop it lies within.
R: continue statement forces the next iteration of
the loop to take place, skipping any code in
between.
43. A: The math.pow(2,4)gives the output: 16.0
R: The math.pow() method receives two float
arguments, raise the first to the second and
return the result.
12
(a) CS_class_XII (b) csclass12
(c) _csclass12 (d) 12CS
17. The input() function always returns a value of.type.
a) Integer b) float c) string d) Complex
18. To include non-graphic characters in python, which
of the following is used?
a. Special Literals b. Boolean Literals
c. Escape Character Sequence d. Special Literal –
None
19. Which of the following cannot be a variable name?
(a) _init_ (b) in (c) it (d) on
20. Which is valid keyword?
(a) Int (b) WHILE (c) While (d) if
21. Predict the output of the following:
(i) >>>print(10 or 40) (ii) >>> print(22.0//5)
22. Which of the following is an invalid operator in
Python?
(a) - (b) //= (c) in (d) =%
23. Which of the following operators is the correct option
for power(a,b)?
(a) a^b (b) a **b (c) a ^^b (d) a^*b
24. Which of the characters is used in python to
make a single line comment?
(a)/ (b) // (c) # (d)!
25. Which of the following is not a core data type in
python?
(a)List (b) Dictionary (c) Tuple (d) Class
26. Which of the following has the highest precedence
in python?
(a)Exponential (b) Addition
(c) Parenthesis (d) Division
27. What is math.factorial(4.0)?
(a) 20 (b) 24 (c) 16 (d) 64
28. Identify the invalid variable name from the
following.
Adhar@Number, none, 70outofseventy, mutable
29. Which of the following belongs to complex datatype
(a) -12+2k (b) 4.0 (c) 3+4J (d) -2.05I
30. None is a special data type with a single value. It
is used to
signify the absence of value in a situation
(a) TRUE (b) FALSE (c) NONE (d) NULL
13
31. If x=3.123, then int(x) will give ?
(a) 3.1 (b) 0 (c) 1 (d) 3
32. To execute the following code in Python, Which
module need to be imported?
>>>print( .mean([1,2,3])
33. Find the invalid identifier from the following
(a) Marks@12 (b) string_12 (c)_bonus
(d)First_Name
34. Find the invalid identifier from the following
(a) KS_Jpr (b) false (c) 3rdPlace (d) _rank
35. Find the valid identifier from the following:
(a) Tot$balance (b) TRUE (c) 4thdata (d) break
36. Which one of the following is False regarding data
types in Python?
(a) In python, explicit data type conversion is
possible
(b) Mutable data types are those that can be
changed.
(c) Immutable data types are those that
cannot be changed.
(d) None of the above
37. Which statement will give the output as : True
from the following :
a) >>>not -5 b) >>>not 5 c) >>>not 0 d)
>>>not(5-1)
38. Evaluate the following expression: 1+(2-3)*4**5//6
(a) -171 (b) 172 (c) -170 (d) 170
39. The correct output of the given expression is:
True and not False or False
(a) False (b) True (c) None (d) Null
40. What will the following expression be evaluated to
in Python?
print(6*3 / 4**2//5-8)
(a) -10 (b) 8.0 (c) 10.0 (d) -8.0
41. Evaluate the following expressions:
>>>(not True) and False or True
(a) True (b) False (c) None (d) NULL
42. >>> 16 // (4 + 2) * 5 + 2**3 * 4
(a) 42 (b) 46 (c) 18 (d) 32
43. Evaluate the following expression:
True and False or Not True
(a) True (b) False (c) NONE (d) NULL
14
44. The below given expression will evaluate to
22//5+2**2**3%5
(a)5 (b) 10 (c) 15 (d) 20
45. Which of the following is not a valid identifier name
in Python?
a) First_Name b) _Area c) 2nd_num d) While
46. Evaluate the following Python expression
print(12*(3%4)//2+6)
(a)12 (b)24 (c) 10 (d) 14
47. Give the output of the following code:
>>>import math
>>>math.ceil(1.03)+math.floor(1.03)
a) 3 b) -3.0 c) 3.0 d) None of the above
48. >>>5 == True and not 0 or False
(a) True (b) False (c) NONE (d) NULL
49. Predict the output of the following:
from math import*
A=5.6
print(floor(A),ceil(A))
(a) 5 6 (b) 6 5 (c) -5 -6 (d) -6 -5
50. Predict the output of the following code:
import math
print(math.fabs-10))
(a) 1 (b) -10 (c) -10.0 (d) 10
51. Which of the following function is used to know the
data type of a variable in Python?
(a) datatype() (b) typeof() (c) type() (d) vartype()
52. Identify the invalid Python statement from the
following.
(a) _b=1 (b) b1= 1 (c) b_=1 (d) 1 = _b
53. A=10
B=A
Following the execution of above statements, python
has Created how many objects and how many
references?
(a) One object Two reference
(b) One object One reference
(c) Two object Two reference
(d) Two object One reference
54. What is the output of the following code?
15
a,b=8/4/2, 8/(4/2)
print(a,b)
(a) Syntax error (b) 1.0,4.0 (c) 4.0,4.0 (d) 4,4
55. Predict output for following code
v1= True
v2=1
print(v1==v2, v1 is v2)
(a) True False (b) False True
(c) True True (d) False False
56. Find output for following given program
a=1
0
b=2
0
c=1
print(a !=b and not c)
(a) 10 (b) 20 (c) True (d) False
57. Find output of following given
program : str1_ = "Aeiou"
str2_ = "Machine learning has no
alternative" for i in str1_:
if i not in
str2_:
print(i,end='')
(a) Au (b) ou (c) Syntax Error (d) value Error
58. Find output for following given code
a=12
print(not(a>=0 and a<=10))
(a) True (b) False (c) 0 (d)1
59. What will be value of diff ?
c1='A'
c2='a'
diff= ord(c1)-
ord(c2)
print(diff)
(a) Error : unsupported operator „-‟ (b)
32 (c)-32 (d)0
60. What will be the output after the following
statements?
x = 27
16
y=9 (a) 26 11 (b) 25 11
while x < 30 and y < 15: (c) 30 12 (d) 26
10 x = x + 1
y=y+1
print(x,y)
61. What output following program will produce
v1='1'
v2= 1
v3=v1==v2
(a) Type Error (b) Value Error
(c)True will be assigned to v3(d)False will be
assigned to v3
62. Which of the following operators has highest
precedence:
+,-,/,*,%,<<,>>,( ),**
(a) ** (b) ( ) (c) % (d)-
63. Which of the following results in an error?
(a) float(„12‟) (b) int(„12‟) (c) float(‟12.5‟) (d)
int(„12.5‟)
64. Which of the following is an invalid statement?
(a) xyz=1,000,000 (b) x y z = 100 200 300
(c) x,y,z=100,200,300 (d) x=y=z=1,000,000
65. Which of the following defines SyntaxError?
(a) It is raised when the file specified in a
program statement cannot be opened.
(b) It is raised when there is an error in the syntax
of the Python code.
(c) It is raised when the requested module definition is
not found.
(d) It is raised due to incorrect indentation in the
program code.
66. Which of the following defines ValueError?
(a) It is raised when the file specified in a
program statement cannot be opened.
(b) It is raised when there is an error in the syntax
of the Python code.
(c) It is raised when a built-in method or
operation receives an argument that has the right
data type but Mismatched or inappropriate
values.
17
(d) It is raised due to incorrect indentation in the
program code.
67. It is raised when the denominator in a division
operation is
zero.
(a) IndexError (b) IndentationError
c) ZeroDivisionError (d) TypeError
68. It is raised when the index or subscript in a
sequence is out of range.
(a) IndexError (b) IndentationError
(c) ZeroDivisionError (d) TypeError
69. It is raised when a local or global variable name is not
defined.
(a) IndexError (b) IndentationError
(c) ZeroDivisionError (d) NameError
70. It is raised due to incorrect indentation in the
program code.
(a) IndexError (b) IndentationError
(c) ZeroDivisionError (d) NameError
71. It is raised when an operator is supplied with a
value of incorrect data type.
(a) IndexError (b) TypeError
(c) ZeroDivisionError (d) NameError
72. It is raised when the result of a calculation exceeds
the maximum limit for numeric data type.
(a) OverFlowError (b) TypeError
(c) ZeroDivisionError (d) NameError
73. IndentationError is a type of:
(a) SyntaxError (b) Logical Error
(c) Runtime Error (d) Other
74. Which of following is not a decision-making
statement?
(a) if-elif statement (b) for statement
(c) if -else statement (d) if statement
75. In a Python program, a control structure:
(a) Defines program-specific data structures
(b) Directs the order of execution of the statements in
the program
(c) Dictates what happens before the program starts
and after it terminates
18
(d) Noneof the above
76. Which one of the following is a valid Python if
statement?
(a) if a>=9: (b) if (a>=9) (c) if (a=>9) (d) if a>=9
77. if 4+5==10:
print("TRUE")
else:
print("false")
print ("True")
(a) False (b) True (c) false (d) None of these
78. Predict the output of the following code:
x=3
if x>2 or x<5 and x==6:
print("ok")
else:
print(“no output”)
(a) ok (b) okok (c) no output (d) none of above
79. Evaluate the following expression and identify the correct
answer. 16 - (4 + 2) * 5 + 2**3 * 4
a) 54 b) 46 c) 18 d) 32
80. identify one possible output of this code out of
the following options:
from random import*
Low=randint(2,3)
High=randrange(5,7)
for N in range(Low,High):
print(N,end=' ')
(a) 3 4 5 (b) 2 3 (c) 4 5 (d) 3 4 5 6
81. Given the nested if-else below, what will be the
value x when the source code executed
successfully:
x=0
(a) 0 (b) 4
a=5
b=5
(c) 2 (d) 3
if a>0:
if b<0:
x=x+5
elif a>5:
x=x+4
19
else:
x=x+3
else:
x=x+2
print (x)
82. Which of the following is False regarding loops in
Python?
(a) Loops are used to perform certain tasks
repeatedly.
(b) while loop is used when multiple statements are
to executed repeatedly until the given condition
becomes true.
(c) while loop is used when multiple statements are
to executed repeatedly until the given condition
becomes false
(d) for loop can be used to iterate through the
elements of lists.
83. The for loop in Python is an
(a) Entry Controlled Loop (b) Exit Controlled Loop
(c) Both of the above (d) None of the above
84. What abandons the current iteration of the loop?
(a) continue (b) break (c) stop (d) infinite
85. The following code contains an infinite loop. Which
is the best explanation for why the loop does not
terminate?
n = 10
answer = 1
while n > 0:
answer = answer + n
n=n+1
print(answer)
(a) n starts at 10 and is incremented by 1 each
time through the loop, so it will always be
positive.
(b) Answer starts at 1 and is incremented by n
each time, so it will always be positive.
(c) You cannot compare n to 0 in the while loop.
(d) You must Compare it to another variable.
20
In the while loop body, we must set n to False,
and this Code does not do that.
(a) 1 12233
(b) 1 23123123
(c) 1 11213212223313233
(d) 1 12131212223313233
87. When does the else statement written after loop
executes?
(a) When break statement is executed in the loop
(b) When loop condition becomes false
(c) Else statement is always executed
(d) None of the above
88. What will be the output of the following Python
code?
for x in range(1, 4):
for y in range(2, 5):
if x * y > 6:
break
print(x*y, end=“#”)
(a) 2#3#4#4#6#8#6#9#12# (b) 2#3#4#5#4#6#6#
(c) 2#3#4#4#6#6# (d) 2#3#4#6
89. Examine the given Python program and
select the purpose of the program from the
following options: N=int(input("Enter the number"))
for i in range(2,N):
if (N%i==0):
print(i)
(a) To display the proper factors(excluding 1 and
the number N itself)
(b) To check whether N is a prime or Not
(c) To calculate the sum of factors of N
(d) To display all prime factors of the Number N.
90. If A=rndom.randint(B,C) assigns a random value
21
between 1 and 6(both inclusive) to the identifier A,
what should be the values of B and C, if all
required modules have already been imported?
(a) B=0, C=6 (b) B=0,C=7 (c) B=1,C=7 (d) B=1,C=6
91. Predict the output of the following code:
import statistics as S
D=[4,4,1,2,4]
print(S.mean(D),S.mode(D))
(a) 1 4 (b) 4 1 (c) 3 4 (d) 4 3
92. The continue statement is used:
(a) To pass the control to the next iterative statement
(b) To come out from the iteration
(c) To break the execution and passes the control to
else statement
(d) To terminate the loop
93. Common types of exception in python are:
(a) Syntax Error (b) Zero division error
(c) (a) and (b) (d) None of these
94. Which of the following is an incorrect logical operator
in python?
(a) not (b) in (c) or (d) and
95. Which of the following is not a function/method of the
random module in python?
(a) randfloat( ) (b) randint( )
(c) random( ) (d) randrange( )
96. Which of the following symbols are used for comments
in Python?
(a) // (b) & (c) /**/ (d) #
97. print (id(x)) will print .
(a) Value of x (b) Datatype of x
(c) Size of x (d) Memory address of x
98. What will the following expression be evaluated to in
Python?
>>> print((4.00/(2.0+2.0)))
a)Error b)1.0 c)1.00 d)1
99. Which of the following datatype in python is used to
represent any real number :
(a) int (b) complex (c) float (d) bool
100 >>> print( ( - 33 // 13) * (35 % -2)* 15/3)
(a) 10.0 (b) -15.0 (c) 15.0 (d) -10.0
22
101 Which of the following statement(s) would give an
error after executing the following code?
x= int("Enter the Value of x:"))
#Statement 1 for y in range[0,21]:
#Statement 2
if x==y: #Statement 3
print (x+y) #Statement 4
else: #Statement 5
print (x-y) # Statement 6
(a) Statement 4 (b) Statement 5
(c) Statement 4 & 6 (d) Statement 1 & 2
TOPIC - STRINGS
STATE TRUE OR FALSE
1. String is mutable data type.
2. Python considered the character enclosed in triple
quotes as String.
3. String traversal can be done using „for‟ loop only.
4. Strings have both positive and negative indexes.
5. The find() and index() are similar functions.
6. Indexing of string in python starts from 1.
7. The Python strip() method removes any spaces or
specified characters at the start and end of a string.
8. The startswith() string method checks whether a
string starts with a particular substring.
9. "The characters of string will have two-way indexing."
ASSERTION & REASONING
1. A: Strings are immutable.
R: Individual elements cannot be changed in string
in place.
2. A: String is sequence datatype.
R: A python sequence is an ordered collections of
items where each item is indexed by an integer.
3. A:a=‟3‟
b=‟2‟
c=a+b
The value of c will be 5
R: “+‟ operator adds integers but concatenates strings
23
4. A:a = "Hello"
b = "llo"
c=a-b
print(c)
This will lead to output: "He"
R: Python string does not support - operator
5. A:str1="Hello" and str1="World" then print(str1*3)
will give error.
R : * replicates the string hence correct output will
be HelloHelloHello
6. A: str1=”Hello” and str1=”World” then
print(“wo‟ not in str) will print false
R : not in returns true if a particular substring is not
present in the specified string.
7. A: The following command
>>>"USA12#'.upper() will return False.
R: All cased characters in the string are uppercase
and requires that there be at least one cased
character
8. A: Function isalnum() is used to check whether
characters in the string are alphabets or numbers.
R: Function isalnum() returns false if it either contains
alphabets or numbers
9. A: The indexes of a string in python is both forward
and backward.
R: Forward index is from 0 to (length-1) and
backward index is from -1 to (-length)
10. A: The title() function in python is used to convert
the first character in each word to Uppercase and
remaining characters to Lowercase in the string and
returns an updated string.
R: Strings are immutable in python.
OBJECTIVE TYPE QUESTIONS (MCQ)
1. What is the output of 'hello'+1+2+3?
(a) hello123 (b) hello6 (c) Error (d) Hello+6
24
2. If n=”Hello” and user wants to assign n[0]=‟F‟ what
will be the result?
(a) It will replace the first character
(b It’s not allowed in Python to assign a value to
an individual character using index
(c) It will replace the entire word Hello into F
(d) It will remove H and keep rest of the characters
3. In list slicing, the start and stop can be given
beyond limits. If it is then:
(a) Raise exception IndexError
(b) Raise exception ValueError
(c) Return elements falling between specified start and
stop values
(d) Return the entire list
4. Select the correct output of the code:
Str=“Computer”
Str=Str[-4:]
print(Str*2)
a. uter b. uterretu c. uteruter d. None of these
5. Given the Python declaration s1=”Hello”. Which of
the following statements will give an error?
(a) print(s1[4]) (b) s2=s1 (c) s1=s1[4] (d) s1[4]=”Y”
6. Predict the output of the following
code: RS=''
S="important"
for i in S:
RS=i+RS
print(RS)
7. What will the following code print?
>>> print(max("zoo 145 com"))
(a) 145 (b) 122 (c) z (d) zoo
8. Ms. Hetvee is working on a string program. She
wants to display last four characters of a string
object named s. Which of the following is statement
is true?
a. s[4:] b. s[:4] c. s[-4:] d. s[:-4]
9. What will be the output of following code snippet:
msg = “Hello Friends”
msg [ : : -1]
25
a)Hello b) Hello Friend c) 'sdneirF olleH' d) Friend
10. Suppose str1= „welcome‟. All the following
expression produce the same result except one.Which
one?
(a) str[ : : -6] (b) str[ : : -1][ : : -6]
(c) str[ : :6] (d) str[0] + str[- 1]
11. Consider the string state = "Jharkhand". Identify the
appropriate statement that will display the lastfive
characters of the string state?
(a) state [-5:] (b) state [4:]
(c) state [:4] (d) state [:-4]
12. Which of the following statement(s) would give an
error during execution?
S=["CBSE"] # Statement 1
S+="Delhi" # Statement 2
S[0]= '@' # Statement 3
S=S+"Thank you" # Statement 4
(a) Statement 1 (b) Statement 2
(c) Statement 3 (d) Statement 4
13. Select the correct output of the following string
operations mystring = "native"
stringList = ["abc","native","xyz"]
print(stringList[1] == mystring, end =“ “)
print(stringList[1] is mystring)
a)True True b)False False c)False True d)True False
14. Select the correct output of the code :
n = "Post on Twitter is trending"
q = n.split('t')
print( q[0]+q[2]+q[3]+q[4][1:] )
(a)Pos on witter is rending
(b)Pos on Twitter is ending
(c) Poser witter is ending
(d) Poser is ending
15. What will be the result of the following command:-
>>>"i love python".capitalize()
(a) 'I Love Python' (b) 'I love python'
(c) 'I LOVE PYTHON' (d) None of the above
16. The number of element return from the partition
function is: >>>"I love to study
26
Java".partition("study")
(a) 1 (b) 3 (c) 4 (d) 5
17. Predict the output of the following:
S='INDIAN'
L=S.partition('N')
G=L[0] + '-' + L[1] + '-' + L[2]
print(G)
(a) I-N-DIA-N(b) I-DIA- (c) I-DIAN (d) I-N-DIAN
18. What will be the output of the following command:
>>>string= "A quick fox jump over a lazy fox"
>>>string.find("fox",9,34)
(a) 28 (b) 29 (c) 8 (d) 7
19. Select the correct option for output
X="abcdef"
i='a'
while i in X:
print(i, end=" ")
(a) Error (b) a (c) infinite loop (d) No output
20. What is the output of the following code?
S1="Computer2023"
S2="2023"
print(S1.isdigit(), S2.isdigit())
a)False True b) False False
c) True False d) True True
21. What will be the output of the following statement
given: txt="cbse. sample paper 2022"
print(txt.capitalize())
a) CBSE. sample paper 2022
b) CBSE. SAMPLE SAPER 2022
c) cbse. sample paper 2022
d) Cbse. Sample Paper 2022
22. Select the correct output of the code:
a = "Year 2022 at all the best"
a = a.split('a')
b = a[0] + "-" + a[1] + "-" + a[3]
print (b)
a) Year – 0- at All the best
b) Ye-r 2022 -ll the best
c) Year – 022- at All the best
d) Year – 0- at all the best
27
23. Select the correct output of the code:
mystr = „Python programming is
fun!‟ mystr = mystr.partition('pro')
mystr='$'.join(mystr)
(a) Python $programming is fun!
(b) Python $pro$gramming is fun!
(c) Python$ pro$ gramming is fun!$
(d) P$ython $p$ro$gramming is $fun!
24. Identify the output of the following Python statement:
s="Good Morning"
print(s.capitalize( ),s.title( ), end="!")
(a) GOOD MORNING!Good Morning
(b) Good Morning! Good Morning
(c) Good morning! Good Morning!
(d) Good morning Good Morning!
25. What is the output of the following code?
Str1="Hello World"
Str1.replace('o','*')
Str1.replace('o','*')
(a) Hello World (b) Hell* W*rld
(c) Hello W*rld (d) Error
26. State whether the statement is True or False?
No matter the underlying data type, if values are
equal returns true.
27. Predict the output of the following:
S="Hello World!"
print(S.find("Hello"))
(a) 0 (b) 3 (c) [2,3,7] (d) (2,3,7)
28. Which of the following is not a valid Python
String operation?
(a) 'Welcome'+'10' (b)'Welcome'*10
(c) 'Welcome'*10.0 (d) '10'+'Welcome'
print(s)
For eg: if the input is 'I AM , WHAT I AM", it
should print i am what i am
Choose the correct option to complete the code .
a. s = s.replace(c, '') b. s = s.replace(c, '\0')
c. s = s.replace(c, None) d. s = s.remove(c)
33. Which of the following statement(s) would give an
error after executing the following code?
str= "Python Programming"#S1
x= '2' #S2
print(str*2) #S3
print(str*x) #S4
(a) S1 (b) S2 (c) S3 (d) S4
TOPIC - LIST
29
STATE TRUE OR FALSE
1. List immutable data type.
2. List hold key and values.
3. Lists once created cannot be changed.
4. The pop() and remove() are similar functions.
5. The append() can add an element in the middle of the list.
6. Del statement deletes sub list from a list.
7. Sort() and sorted() both are similar function.
8. l1=[5,7,9,4,12] 5 not in l1
9. List can be extend
10. Mutable means only we can insert elements
11. Index of last element in list is n-1, where n is total
number
of elements.
12. We can concatenate only two list at one time.
13. L.pop() method will return deleted element immediately
14. L.insert() method insert a new element at the beginning of
the list only.
15. If index is not found in insert() I.e. L.insert(102,89) then it
will add 89 at the end of the list.
16. L.reverse() will accept the parameters to reverse the
elements of the list.
17. L.sort(reverse=1) will reverse the list in descending order
18. L.pop() used to delete the element based on the element
of the list.
19. L.clear() used to clear the elements of the list but memory
will exists after clear.
20. L.append() append more than one element at the end of
the list.
21. L=[10,20,30]
L.extend([90,100])
print(L)
output of the above code is: [10,20,30,
[90,100]]
22. After sorting using L.sort() method, the index number of
the list element will change.
23. L.remove() used to delete the element of the list based
on its value, if the specified value is not there it will
return Error.
ASSERTION & REASONING
1. A: list is mutable data Type
R: We can insert and delete as many elements from
list
30
2. A: Elements can be added or removed from a list
R: List is an immutable datatype.
3. A: List can be changed after creation
R: List is mutable datatype.
4. A: Following code will result into output:
True a=[10,20]
b=a[:]
print(a is b)
R: "is" is used for checking whether or not
both the operands is using same memory
location
5. A: list() is used to convert string in to list element
R: string will be passed into list() it will be
converted into list elements
6. A: reverse() is used to reverse the list elements.
Reason: it can reverse immutable data type
elements also
7. A: pop() can delete elements from the last index of list
R: this function can remove elements from the last
index only.
8. A: len() displays the list length
R: it is applicable for both mutable and immutable
data type.
9. A: Usha wants to sort the list having name of
students of her class in descending order using
sorted() function
R: sorted() function will sort the list in ascending order
10. A: Raju is working on a list of numbers. He wants
to print the list values using traversing method.
He insists that list can be traversed in forward
direction and backward direction i.e. from
beginning to last and last to beginning.
R: List can be traversed from first element to last
element only.
11. A: Anu wants to delete the elements from the list
using pop() function.
R: Her friend Pari suggested her to use del () function
to delete more than one elements from the list.
12. A: Students in the Lab practical were asked to store
31
the elements in a List data type in which we can
perform all the operations like addition , deletion ,
deletion , traversal.
R: List is mutable data type
OBJECTIVE TYPE QUESTIONS(MCQ)
1. Which point can be considered as difference between
string and list?
(a) Length (b) Indexing and Slicing
(c) Mutability (d) Accessing individual elements
2. What is the output when we execute list(“hello”)?
(a) [“h‟, “e‟, “l‟, “l‟, “o‟] (b) [“hello‟] (c) [“llo‟] (d)
[“olleh‟].
3. Given a List L=[7,18,9,6,1], what will be the output
of L[-2::-1]?
(a) [6, 9, 18, 7] (b) [6,1] (c) [6,9,18] (d) [6]
4. If a List L=['Hello','World!'] Identify the correct output of
the following Python command: >>> print(*L)
(a) Hello World! (b) Hello,World!
(c)'Hello','World!' (d) 'Hello','World!'
5. Consider the list aList=["SIPO", [1,3,5,7]].
What would the following code print?
(a) S, 3 (b) S, 1 (c) I, 3 (d) I, 1
6. Suppose list1 is [1, 3, 2], What is list1 * 2 ?
a) [2, 6, 4] (b) [1, 3, 2, 1, 3]
(c) [1, 3, 2, 1, 3, 2] (d) [1, 3, 2, 3, 2, 1]
7. Suppose list1 = [0.5 * x for x in range(0,4)], list1 is
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, 2.0]
8. >>> L1=[6,4,2,9,7]
>>> print(L1[3:]= "100"
(a) [6,4,2,9,7,100] (b) [6,4,2,100]
(c) [6,4,2,1,0,0] (d) [6,4,2, „1‟,‟0‟,‟0‟]
9. Which statement is not correct?
a) The statement x = x + 10 is a valid statement
b) List slice is a list itself.
c) Lists are immutable while strings are mutable.
d) Lists and strings in pythons support two way indexing
10. Which one is the correct output for the following code?
a=[1,2,3,4]
b=[sum(a[0:x+1])
for x in range(0,len(a)):
32
print (b)
(a) 10 (b) [1,3,5,7] (c) 4 (d) [1,3,6,10]
11. What will be the output for the following python
code:
L=[10,20,30,40,50]
L=L+5
print(L)
(a) [10,20,30,40,50,5] (b) [15,25,35,45,55]
(c) [5,10,20,30,40,50] (d) Error
12. Select the correct output of the code:
L1, L2 = [10, 23, 36, 45, 78], [ ]
for i in range :
L2.insert(i, L1.pop( ) )
print(L1, L2, sep=‟@‟)
(a) [78, 45, 36, 23, 10] @ [ ]
(b) [10, 23, 36, 45, 78] @ [78, 45, 36, 23, 10]
(c) [10, 23, 36, 45, 78] @ [10, 23, 36, 45, 78]
(d) [ ] @ [78, 45, 36, 23, 10]
13. The append() method adds an element at
(a) First (b) Last
(c) Specified index (d) At any location
14. The return type of x in the below code is
txt = "I could eat bananas all day"
x = txt.partition("bananas")
(a) string (b) List (c) Tuple (d) Dictionary
15. S1: Operator + concatenates one list to the end of
another list.
S2: Operator * is to multiply the elements inside the
list. Which option is correct?
(a) S1 is correct, S2 is incorrect
(b) S1 is incorrect, S2 is incorrect
(c) S1 is incorrect, S2 is incorrect
(d) S1 is incorrect, S2 is correct
16. Which of the following statement is true for extend()
list method?
(a) Adds element at last
(b) Adds multiple elements at last
(c) Adds element at specified index
(d) Adds elements at random index
17. What will be the output of the following code:
33
Cities=[‘Delhi’,’Mumbai’]
for I in Cities:
Cities[0],Cities[1]=Cities[1],Cities[0]
print(Cities)
a) []
b) [‘Delhi’, ‘Mumbai’]
c) [‘Mumbai’, ‘Delhi’]
d) [‘Mumbai’, ‘Delhi’, ‘Delhi’, ‘Mumbai’]
18. What is the output of the functions shown
below? min(max(False,-3,-4),2,7)
(a) -3 (b) -4 (c) True (d) False
19. If we have 2 Python Lists as follows:
L1=[10,20,30]
L2=[40,50,60]
If we want to generate a list L3 as:
then best Python command out of the following is:
(a) L3=L1+L2 (b) L3=L1.append(L2)
(c) L3=L1.update(L2) (d) L3=L1.extend(L2)
20. Identify the correct output of the following Python code:
L=[3,3,2,2,1,1]
L.append(L.pop(L.pop()))
print(L)
(a) [3,2,2,1,3] (b)[3,3,2,2,3]
(c)[1,3,2,2,1] (d)[1,1,2,2,3,3]
21. Predict the output of the following:
L1=[1,4,3,2]
L2=L1
L1.sort()
print(L2)
(a) [1,4,3,2] (b)[1,2,3,4] (c) 1 4 3 2 (d) 1 2 3 4
22. If PL =['Basic','C','C++']
Then what will be the status of the list PL after
PL.sort(reverse=True) ?
(a) ['Basic','C','C++'] (b) ['C++','C','Basic']
(c) ['C','C++','Basic'] (d) PL=['Basic','C++','C']
23. Given list1 = [34,66,12,89,28,99]
Statement 1: list1.reverse()
Statement 2: list1[::-1]
Which statement modifies the contents of original list1.
34
(a) Statement 1 (b) Statement 2
(c) Both Statement 1 and 2. (d) None of the mentioned
24. which command we use can use To remove string "hello"
from list1, Given, list1=["hello"]
(a) list1.remove("hello") (b) list1.pop(list1.index('hello'))
(c) Both A and B (d) None of these
25. How would you create a loop to iterate over the
contents of the list given as
Days = [31, 28, 31, 30, 31, 30, 31, 31,30] and print out
each element?
(a) for days in range(Days):
print(days)
(b) for days in Days:
print(days)
(c) for days in range(len(Days)):
print(days)
(d) for days in Days:
print(monthDays)
25. Predict the output of the following:
S=[['A','B'],['C','D'],['E','F']]
print(S[1][1])
(a)'A' (b) 'B' (c) 'C' (d) 'D'
26. Predict the output of the following:
L1=[1,2,3]
L2=[4,5]
L3=[6,7]
L1.extend(L2)
L1.append(L3)
print(L1)
(a) [1,2,3,4,5,6,7] (b)[1,2,3,[4,5],6,7]
(c) [1,2,3,4,5,[6,7]] (d)[1,2,3,[4,5],[6,7]]
27. State True or False "There is no conceptual limit to
the size of a list."
28. The statement del l[1:3] do which of the following
task?
a. deletes elements 2 to 4 elements from the list
b. deletes 2nd and 3rd element from the list
c. deletes 1st and 3rd element from the list
d. deletes 1st, 2nd and 3rd element from the list
29. Which of the following will give output as: [23, 2,
35
9, 75]? If list1=[6,23,3,2,0,9,8,75]
(a) print(list1[1:7:2]) (b) print(list1[0:7:2])
(c) print(list1[1:8:2]) (c) print(list1[0:8:2])
30. Find the output
values = [[3, 4, 5, 1 ], [33, 6, 1, 2]]
for row in values:
row.sort()
for element in row:
print(element, end = " )
print()
(a). The program prints on row 3 4 5 1 33 6 1 2
(b). The program prints two rows 3 4 5 1
followed by 33 6 1 2
(c). The program prints two rows 3 4 5 1
followed by 33 6 1 2
(d). The program prints two rows 1 3 4 5
followed by 1 2 6 33
TOPIC - TUPLES
STATE TRUE OR FALSE
1. Tuple data structure is mutable
2. tuples allowed to have mixed lengths.
3. tuple have one element for Ex: S=(10)
4. We Can concatenate tuples.
5. The elements of the of a tuple can be deleted
6. A tuple storing other tuples is called as nested tuple
7. The + Operator adds one tuple to the end of another tuple
8. A tuple can only have positive indexing.
ASSERTION & REASONING
1. A: Tuples are ordered
R: Items in a tuple has an defined order that will not be
changed.
2. A: A tuple can be concatenated to a list, but a list
cannot be concatenated to a tuple.
R: Lists are mutable and tuples are immutable in Python
3. A: Tuple is an in inbuilt data structure
R: Tuple data structure is created by the programmers
and not by the creator of the python
4. a=(1,2,3)
a[0]=4
A: The above code will result in error
R: Tuples are immutable. So we cant change them.
36
5. A: A tuple cannot be sorted inline in python and therefore
sorted () returns a sorted list after sorting a tuple.
R: Tuples are non-mutable data type
6. >>> tuple1 = (10,20,30,40,50)
>> tuple1.index(90)
A: Above statements gives ValueError in python
R: ValueError: tuple.index(x): x not in tuple
7. T1 = (10, 20, (x, y), 30)
print(T1.index(x))
A: Above program code displays the index of the element
„x‟
R: Returns the index of the first occurrence of the
element in the given tuple
8. >>>tuple1 = (10,20,30,40,50,60,70,80)
>>>tuple1[2:]
Output: (30, 40, 50, 60, 70, 80)
A: Output given is incorrect
R: Slicing in above case ends at last index
9. A:t=(10,20,30)
t[1]=45
the above mentioned question will throw an error.
R: Tuple are used to store sequential data in a
program
10. A: Forming a tuple from individual values is called
packing
R: Many individual data can be packed by
assigning them to one single variable, where
data is separated by
comma.
OBJECTIVE TYPE QUESTIONS (MCQ)
1. Which of the following statement creates a tuple?
a) t=[1,2,3,4] b) t={1,2,3,4}
c) t=<1,2,3,4> d) t=(1,2,3,4)
2. Which of the following operation is supported in
python with respect to tuple t?
a) t[1]=33 b) t.append(33) c) t=t+t d) t.sum()
3. Which of the following is not a supported
operation in Python?
(a) “xyz”+ “abc” (b) (2)+(3,) (c) 2+3 (d) [2,4]+[1,2]
4. Predict the output:
T=('1')
37
print(T*3)
(a) 3 (b) ('1','1','1') (c) 111 (d) ('3')
5. Identify the errors in the following
code: MyTuple1=(1, 2, 3) #Statement1
MyTuple2=(4) #Statement2
MyTuple1.append(4) #Statement3
print(MyTuple1, MyTuple2)
#Statement4
(a) Statement 1 (b) Statement 2
(c) Statement 3 (d) Statement 2 &3
6. Suppose a tuple Tup is declared as
Tup = (12, 15, 63, 80) which of the following is
incorrect?
(a) print(Tup[1]) (b) Tup[2] = 90
(c) print(min(Tup)) (d) print(len(Tup))
7. Predict the output of the following code:
t1=(2,3,4,5,6)
print(t1.index(4))
(a) 4 (b) 5 (c) 6 (d) 2
8. Given tp = (1,2,3,4,5,6). Which of the following two
statements will give the same output?
print(tp[:-1]) # Statement 1
print(tp[0:5]) # Statement 2
print(tp[0:4]) # Statement 3
print(tp[-4:]) # Statement 4
(a) Statement 1 and 2 (b) Statement 2 and 4
(c) Statement 1 and 4 (d) Statement 1 and 3
9. What will be the output for the following Python
statement?
T=(10,20,[30,40,50],60,70)
T[2][1]=100
print(T)
(a) (10,20,100,60,70) (b) 10,20,[30,100,50],60,70)
(c) (10,20,[100,40,50],60,70) (d) None of these
10. Which of the following is an unordered collection of
elements
(a) List (b) Tuple (c) Dictionary (d) String
11. Consider the following statements in Python and the
question that follows:
i. Tuple is an ordered list
38
ii.Tuple is a mutable data type
From the above statements we can say that
(a) Only (i) is correct
(b) Only (ii) is correct
(c) Both (i) and (ii) are correct
(d) None of (i) and (ii) are correct
12. Which of the following is not a tuple in Python?
(a) (1,2,3) (b) (“One”,”Two”,”Three”)
(c) (10,) (d) (“One”)
13. Suppose a tuple T is declared as T=(10,20,30) and a list
L=["mon", "tue", "wed","thu", "fri", "sat", "sun"], which
of the following is incorrect ?
a) min(L) b) L[2] = 40
c) T[3] = “thurs” d) print( min(T))
14. Suppose a Python tuple T is declared as:
T=('A','B','C')
Which of the following command is invalid?
(a) T=('D') (b) T=('D',) (c) T+=('D') (d) T+=('D',)
15. Predict the output:
tup1 = (2,4,[6,2],3) tup1[2]
[1]=7
print(tup1)
(a)Error (b) (2,4,[6,2],3) (c)(2,4,[6,7],3) (d)(2,4,6,7,3)
16. Consider a tuple t=(2,4,5), which of the following
will give error?
(a) list(t)[-1]=2 (b) print(t[-1])
(c) list(t).append(6) (d) t[-1]=7
17. Suppose a tuple T1 is declared as T1 = (10, 20, 30,
40, 50) which of the following is incorrect?
a)print(T[1]) b) T[2] = -29
c) print(max(T)) d) print(len(T))
18. What will be the output of the following Python
code?
T1= ( )
T2=T1 * 2
print(len(T2))
(a) 0 (b) 2 (c) 1 (d) Error
19. Predict the output:
Tup=(3,1,2,4)
sorted(Tup)
39
print(Tup)
(a) (3,1,2,4) (b) (1,2,3,4) (c) [3,1,2,4] (d) [1,2,3,4]
20. Predict the output of the following: S=([1,2],
[3,4],[5,6])
S[2][1]=8
print(T)
(a) ([1,2],[8,4],[5,6])
(b) ([1,2],[3,4],[8,6])
(c) ([1,2],[3,4],[5,8])
(d) Will generate an Error as a Tuple is immutable
TOPIC - DICTIONARY
STATE TRUE OR FALSE
1. Dictionary values are immutable
2. List can be converted in Dictionary
3. It is always not necessary to enclose dictionary in { }.
4. Dictionary keys are unique and always of string type
5. D.popitem() is used to delete the last items of the
dictionary.
6. D.get() method is used to insert new key:value pair
inside of the dictionary.
ASSERTION & REASONING
1. A: Dictionaries are mutable.
R: Individual elements can be changed in dictionary
in place.
2. A: Dictionary in Python holds data items in key-value
pairs
R: Immutable means they cannot be changed after
creation.
3. A: Key of dictionary can’t be changed.
R: Dictionary Key’s are immutable.
4. A: Key of dictionary must be single element.
R: Key of dictionary is always string type.
5. A: Dictionary and set both are same because both
enclosed in { }.
R: Dictionary is used to store the data in a key-value
pair format.
6. A: The pop() method accepts the key as an
argument and remove the associated value
R: pop() only work with list because it is mutable.
7. A: The items of the dictionary can be deleted by
40
using the del keyword.
R: del is predefined keyword in python.
42
13. Which of the following operation(s)
supported in Dictionary?
(a) Comparison(only = and !=) (b) Membership
(c) Concatenation (d) Replication
14. Predict the output of the following:
D1={1:10,4:56,100:45}
D2={1:10,4:56,45:100}
print(D1==D2)
(a) True (b) False
(c) Cannot Compare the dictionaries (d) Error
15. Predict the output of the following:
D1={1:10,4:56,100:45}
D2={1:10,4:56,45:100}
print(D1<=D2)
(a) True (b) False
(c) Cannot Compare the dictionaries (d) Error
16. Write a python command to create list of keys
from a dictionary.
dict={'a':'A', 'b':'B','c':'C', 'd':'D'}
(a) dict.keys() (b) keys() (c) key.dict() (d) None of
these
17. What will the following code do?
dict={“Phy”:94,”Che”:70,”Bio”:82,”Eng”:95}
dict.update({“Che”:72,”Bio”:80})
(a) It will create new dictionary as
dict={“Che”:72,”Bio”:80} and old dict will be
deleted.
(b) It will throw an error as dictionary cannot be
updated.
(c) It will simply update the dictionary as
dict={“Phy”:94,”Che”:72,”Bio”:80,
“Eng”:95}
(d) It will not throw any error but it will not do any
changes in dict.
43
18. Consider the coding given below and fill in the
blanks:
Dict_d={„BookName‟:‟Python‟,‟Author‟:”Arundh
ati Roy”}
Dict_d.pop() # Statement 1
List_L=[“java”,”SQL”,”Python”]
List_L.pop() # Statement 2
(i) In the above snippet both statement 1 and 2 deletes
the last element from the object Dict_d and
List_L (True/False).
(ii) Statement (1/2) alone deletes the last
element
in its object
19. Identify the output of following code
d={'a':'Delhi','b':'Mumbai','c':'Kolkata'}
for i in d:
if i in d[i]:
x=len(d[i])
print(x)
(a) 6 (b) 0 (c) 5 (d) 7
20. What will be the output of the following
code? D1={1: "One",2: "Two", 3: "C"}
D2={4: "Four",5: "Five"}
D1.update(D2)
print (D1)
a) {4: "Four",5: "Five"}
b) Method update() doesn’t exist for dictionary
c) {1:"One",2:"Two", 3: "C"}
d) {1:"One",2: "Two",3: "C",4:"Four",5: "Five"}
21. Given the following dictionaries
Dict1={'Tuple': 'immutable', 'List': 'mutable',
'Dictionary': 'mutable', 'String': 'immutable'}
Which of the following will delete key:value
pair for key=”Dictionary‟ in the above mentioned
dictionary?
a) del Dict1['Dictionary'] b)Dict1[‘Dictionary’].delete( )
c) delete (Dict1.["Dictionary"]) d)del(Dict1.[‘Dictionary’])
SHORT ANSWER QUESTIONS
44
1. When was Python developed and by whom?
2. State some distinguishable features of Python.
3. What is the difference between mutable and immutable objects in
Python language?
4. What is the difference between interactive and script mode in Python?
5. What are Tokens in Python?
6. Name the types of tokens?
7. Explain each type of token with appropriate example.
8. Discuss the components of a Python program.
9. What is a variable in Python? What are the 3 components that a
variable possess? Explain with example.
10. What are the classification of datatype? Explain with example.
11. What is Dynamic typing? Give example.
12. What are the various types of operators in Python?
13. Discuss the various ways of converting one datatype to another
datatype? Name the terminologies used in this case.
14. In how many ways can you work in Python.
15. What are comments in Python? How are single line and multiline
comments used? (OR)
16. How are executable statements made as non-executable
statements? Explain
17. Categorize the flow of execution.
18. Explain each category of flow of execution with syntax and example.
19. Convert the following for loop to while loop.
for j in range(10, 2, -2):
print(j+3)
20. What is a String in Python? Explain
21. Explain the string operators.
22. What are the different ways of traversing a string?
23. What do you mean by slicing a string?
24. Discuss the built in string functions.
25. Explain any 8 string methods which will return Boolean values as
result?
26. Explain the following string methods with appropriate example.
split(), lower() upper(), capitalize(), title(), replace(), find(), lstrip(),
rstrip(), strip(), join(), swapcase(), partition(),
27. What are different ways of unpacking a string?
45
28. What are different ways of creating a list?
29. What is list comprehension? Explain with syntax and example.
30. What is List slicing? Give example.
31. What are built in list function?
32. Explain the list methods offered by Python.
33. Explain Tuples in Python and how can it be created and iterated?
34. Explain Tuple slicing.
35. List down the tuple Built in functions and tuple methods.
36. What are Dictionaries in python? How are dictionaries iterated?
37. How is a dictionary element updated?
38. What are built in dictionary functions?
39. Discuss the dictionary methods available in Python.
40. Write a Python script to check if a given key already exists in a
dictionary.
41. Write a Python program to remove duplicate characters of a
given string.
****BEST OF LUCK****
46