0% found this document useful (0 votes)
191 views49 pages

G11 CSC - Worksheet For Annual Exam 2024 - 2025

The document is a worksheet for Grade 11 Computer Science, containing various questions related to Python programming concepts, including variable types, control structures, data types, and functions. It includes multiple-choice questions, assertion and reasoning questions, and practical coding scenarios. The worksheet is designed for the Annual Exam for the academic year 2024-2025.

Uploaded by

vijaya lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views49 pages

G11 CSC - Worksheet For Annual Exam 2024 - 2025

The document is a worksheet for Grade 11 Computer Science, containing various questions related to Python programming concepts, including variable types, control structures, data types, and functions. It includes multiple-choice questions, assertion and reasoning questions, and practical coding scenarios. The worksheet is designed for the Annual Exam for the academic year 2024-2025.

Uploaded by

vijaya lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Worksheet for G11 – Computer Science : Annual Exam – AY 2024 - 2025

Priyansh wants to store the value 3.5 into a variable n. Which of the following statement is correct for
1 him?
a) int n=5 b) n=5 c) 5=n d) n=’5’
Which of the following is valid identifier?
2
a) None b) #None c) 0_None d) none
What will be the output of the following code segment?
a,b=5,6
3 b,a=a,b
print(a,”+”,b)
a) 5 + 6 b) 6 + 5 c) 11 d) None
Kriza wants to divide a number and store the result without decimal places into an integer variable.
4 Suggest her an appropriate operator from the following:
a) / b) % c) // d) Both a) & b)
a='Computer Science is Science of Computers'

w=a.split(‘Sci’)
5
print(a[1])

a) Science is b) ence of Computers c) Computer d) ence is


Dhyana wants to check the more than two conditions in python program. Suggest her a control structure
that helps her to accomplish her tasks.
6
a) Simple if b) If-else c) if-elif-else d) nested if
Observe the given code and select an appropriate output:

a=’hello’

7 b=str(30)

print(a+b)

a) h b) hello c) 30 d) hello30
Rudra wants to access a second last list element of list object L. Help him to select an appropriate option
to accomplish his task.
8
a) L[2] b) L[-2] c) L[len(l)-2] d) L-2

Consider these statements:

a=56,78,32,12
9
print(type(a))

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


1
What will be the output?

a) <class ‘int’> b) <class ‘tuple’> c) <class ‘list’> d) <class ‘str’>

Observe the given declarations:

i. d={}

ii. d=dict()

iii. d=Dict()
10
iv. d=dict.fromkeys()

Which of the following are correct ways to create an empty dictionary?

a) i and ii b) i,ii and iv c) i,iii and iv d) i and iii

What will be the output of the following code segment?

a,b=2,3

a,b=b**3,a**2
11
print(a,”#”,b)

a) 8#9 b) 9#8 c) 27#4 d) 4#27

What will be the value of variable a when loop is terminated?

a=30

while a>0:

12 print(a)

a-=10

a) 0 b) 10 c) 30 d) -10

The while loop does not have an update statement is called ______

13 a) empty while loop b) infinite while loop c) do while loop d) static while loop

Observe the given code and select an appropriate output:


14

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


2
a='Welcome 2023'

s=''

for i in a:

if i.isdigit():

s=s+i+'#'

print(s)

a) 2023 b) 2023# c) 20#23 d) 2#0#2#3

Hriday has created a tuple in python: T=(5,10,15)

Now he wants add an element 20 at the end of tuple next to 15. Which of the following statement is
correct for him?
15
a) T = T + 40 b) T.append(40) c) T=T+(40,) d) Not possible

What will be the value of variable a when loop is terminated?

a=20

for i in range(10,-1,-2):

16 a-=a-2

print(a)

a) -2 b) 0 c) -1 d) 2

Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
Assertion(A): In python program variable a and A both have different
17 significance.
Reason(R): Python is case insensitive language.
Assertion(A): Expressions are programming instructions that represents
something.
18
Reason(R): Statement is a logical combination of symbols that represents a
value.

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


3
Dhruv wants to compute power of n. Select appropriate statement for him:
19
a) n^2 b) n*2 c) n^^2 d) n**2
Which of the following is not a valid relational operator?
20
a) != b) += c) <= d) =
Identify the symbol is used to write a single line comment in python.
21
a) / b) % c) // d) #
Which of the following is an escape sequence for a tab character?
22
a) \a b) \t c) \n d) \b
Which of the following are literals?
23
a) myname b) “Radha” c) 24.5 d) 24A
Data items having fixed value are called ____________.

24 a) identifiers b) functions c) keywords d) literals

Dhyana wants to check the more than two conditions in python program.

Suggest her a control structure that helps her to accomplish her tasks.
25
a) Simple if b) If-else c) if-elif-else d) nested if

a=20

for i in range(10,-1,-2):

a-=a-2
26
print(a)

a) -2 b) 0 c) -1 d) 2

What is the output produced when this code executes?

a=0

for i in range(4,8):
27
if i%2==0:

a=a+i

print(a)

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


4
a) 4 b) 8 c) 10 d) 18

a='Computer Science is Science of Computers'

w=a.split(‘Sci’)

28 print(w[1])

a) Science is b) ence of Computers c) Computer d) ence is

Which of the following functions will return the string in all caps?
29
a) upper() b) toupper() c) isupper() d) to-upper()
Which of the following functions will return the last three characters of a string s?

30 a) s[3:] b) s[:3] c) s[-3:] d) s[:-3]

Q31 and 32 are ASSERTION AND REASONING based questions. Mark the correct choice as
(e) Both A and R are true and R is the correct explanation for A
(f) Both A and R are true and R is not the correct explanation for A
(g) A is True but R is False
A is false but R is True
Assertion (A) : Both break and continue are jump statements.
Reason (R) : Both break and continue can stop the loops and hence can substitute one – another.
31

Assertion (A): The logical errors are the result of mistaken analysis of a problem.
Reason (R): Logical errors are missed by the interpreters
32

33 Which of t h e following datatype not supported by python?


(a) float (b) Complex (c) List (d) Date
34 Which of the following is a valid statement in python?
name = “bikaner’ (b) num = 1,000 (c) a+b =c (d) x=”30” +5
35 Which of following can be used for making a comment in python-
(a) & (b) # (c) @ (d) None of these
36 Given A= “[ 22,4.88,”India”, “T”]” the datatype of A is
(a) List (b) String (c) Dictionary (d) Tuple
37 What will be the result of the following code?
>>>d1 = {“abc” : 5, “def” : 6, “ghi” : 7}
>>>print (d1[abc])
(a) abc (b) 5 (c) {“abc”:5} (d) Error
38 Suppose list L is declared as
L = [5 * i for i in range (0,4)], list L is

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


5
a) [0, 1, 2, 3,] b) [0, 1, 2, 3, 4]
c) [0, 5, 10, 15] d) [0, 5, 10, 15, 20]
39 Identify declaration of M = ‘Mon’,‘23’,‘Bye’, ’6.5’
a) dictionary b) string c) tuple d) list
40 STR=”RGBCOLOR”
colors=list(STR)
How do we delete ‘B’ in given List colors?
(a) del colors[2] (b) colors.remove("B")
(c) colors.pop(2) (d) All of these
41 What is the value of x when this loop has been terminated:
x=45
while x>0:
print(x)
x=x-10
(a) 25 (b) 45 (c) 5 (d) -5
42 day_name= ['Mon', 'Tues', 'Wednes', 'Thursday', 'Friday', 'Saturday','Sunday'] print(day_name[7])
What will be the result?
(a) Sunday (b)Saturday (c)Error (d) Mon
43 Find the output of the following code-
number= [1,5,7,0,4]
print(number[2:3])
[5] (b) [7] (c) [7,0] (d) None of above
44 Predict the output of the following code:
a=5
a+=100
if(a<100):
print(“false”)
else:
print(“true”)

(a) true ( b ) false (c) no output (d) none of these


45. Which of these is not a primitive or fundamental data types?
(a) integer ` (b) Boolean (c) List (d) String
46. Which of the following will give "Simon" as output? If
str1="Hari,Simon,Vinod"
(a) print(str1[-7:-12]) (b) print(str1[-11:-7])
(c) print(str1[-11:-6]) (d) print(str1[-7:-11])
47. Which of the following is not valid string in Python?
(a) “Hello” (b) ‘Hello’
(c) “Hello’ (d) None of the Above
48. What will be the output of above Python code? abc="6/4"
print("abc")
(a) 1 (b) 6/4 (c) 1.5 (d) abc
Q49 and 50 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
49. Choose correct option:

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


6
Statement 1: t1=tuple(’python’)
Statement 2: t1[4]=’z’
A: Above code will generate error Statement2:
R: Tuple is immutable by nature.

50. Choose correct option :


T1=[3,9,0,1,7]
T2=[5,1,0,7,5.5]
Statement A: Output of print (len(T1)==len(T2) is True.
Statement R: Method len() returns the number of elements in the list.

51. Which of the following is not a valid keyword?


(a) for (b) while (c) If (d) else

52. Which of the following is not a valid data type of Python


(a) Set (b) Dictionary (c) Real (d) List

53. Identify the mutable data type from the following given options
(a) String (b) Set (c) Integer (d) Tuple

54. State True or False


“Identifier can start with an underscore “.

55. Given the following dictionary


zdic1={‘aman’:85,’pahul’:98,’divya’:75}
print(sorted(dic1))
select the correct output:
(a) [‘aman’, ‘divya’, ‘pahul’] (b) [‘pahul’, ‘divya’, ‘aman’]
(c) [75,85,98] (d) [‘aman’:85,’divya’:75,’pahul’:98]

56. Python allows us to assign a single value to several variables simultaneously. Ex – a=b=c=15. [True
/False]

57. Output of following expression will be:


26.0 + 8 * 6 - (10*3)
(a) 34.0 (b) 42.0 (c) 44.0 (d) Error

58. Name any one jump statement.


59. Which of the following can delete an element from a list if the index of the element is given?
(a) pop () (b) remove (c) del (d) all of these

60. List can contain values of these types


(a) Integers (b) float (c) strings (d) all of these
61. The input () returns the value as _________ type.

62. Directions: In the following questions, a statement of Assertion (A) is followed by a statement of
Reason (R). Mark the correct choice as.
Assertion (A): If the condition of the while loop is initially false, the body is not executed even once.
Reason (R): During execution of while loop, body of the loop executed only when condition gets true.

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


7
(A) Both A and R are true and R is the correct explanation for A.
(B) Both A and R are true and R is not correct explanation for A.
(C) A is true but R is false.
(D) A is false but R is true.

63. Directions: In the following questions, a statement of Assertion (A) is followed by a statement of
Reason (R). Mark the correct choice as.

Assertion (A): A tuple is a collection which is ordered and unchangeable.


Reason (R): Tuples are written with round brackets.

(A) Both A and R are true and R is the correct explanation for A.
(B) Both A and R are true and R is not correct explanation for A.
(C) A is true but R is false.
(D) A is false but R is true.

Which of the following is an invalid identifier? 1


64 a) my_file b) myfile1 c) My.File d) Myfile

State True or False:


65 “In a Python comments are executed by compiler”

What is the output of the following code? a, 1


b=8/4/2, 8/(4/2)
66 print(a, b)
a) Syntax error b) 1.0,4.0 c) 4.0,4.0 d) 4,4

Consider the given expression: 1


7<4 or 6>3 and not 10==10 or 17>4
Which of the following will be the correct output if the given expression is evaluated?
67
a) True b) False c) NONE d) NULL

The ............ statement terminates the execution of the whole loop.


68
a) continue b) exit c) breake d) break

if L= ‘My Score’,95.2, 2022, which data type in Python is used?


69
a) List b) String c) Dictionary d) Tuple

Select the correct output of the code: 1 S =


"text#next"
70 print(S.strip("t"))
a) ext#nex b)ex#nex c) text#nex d)ext#next

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


8
What will be output of this expression: 1
if '12'.isdigit():
print(‘q’+’p’)
71 else:
print( 'r' + 's')
a) qp b) rs c) pqrs d) pq12

What is the output of the following code? 1


str1 = "Hello World"
str2 = str1.replace("Hello", "Goodbye")
print(str1)
72 a) "Hello World"
b) "Goodbye World"
c) "Hello Goodbye"
d) Error: Strings are immutable and cannot be modified.

Which of the following is not a sequential datatype in Python? 1


73
a) Dictionary b) String c) List d) Tuple

Select the correct output of the code: 1


s="Dreams inspire action"
l=s.split()
d="-".join([l[0].upper(),l[1],[2].title()])
74 print(d)

a) DREAMS-INSPIRE-Action b) DREAMS-Inspire-Action
c) dreams-inspire-Action d) DREAMS-inspire-Action

What will be the output of the following code segment?


l=['Aps','App','Apt','Ape']
75 print(max(l))
a) 'Aps b) 'App' c) 'Apt' d) Error

Given the following Tuple


Tup = (10, 20, 30, 50)
76 Which of the following statements will result in an error?
a) print(Tup[0]) b) Tup.insert(2,3) c) print(Tup[1 : 2]) d)print(len(Tup))

STR=”RGBCOLOR”
colors=list(STR)
How do we delete ‘B’ in colors?
77
a) del colors[2] b)colors.remove("B")
c) colors.pop(2) d) All of these

is not a valid built-in function for list manipulations.


78 a) count() b) length() c) append() d) extend()

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


9
Suppose tuple T is T = (10, 12, 43, 39), Find incorrect?
79
a) print(T[1]) b) T[2] = -29 c) print(max(T)) d) print(len(T))

Which of the following functions is a valid built-in function for both list
80 and dictionary datatype?
a) items() b) len() c) update() d) values()

Predict the output.


81 d = {"Hema":98, "Neha":95}
print(list(d.values()))

Which of the following is not a dictionary object function?


82 a) pop() b) clear() c) min() d) index()

What would the following code print ?


d = {'spring':'autumn','autumn':'fall','fall':'spring'}
83 print(d['autumn'])
a) autumn b) fall c) spring d) Error

Q 84 and 85 are ASSERTION AND REASONING based


questions. Mark the correct choice as.
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
Assertion : In Python, int(3.9) converts the float 3.9 to 3 by removing the 1
decimal part.
84 Reasoning: The int() function in Python always rounds the value to the
nearest
integer.
Assertion : Tuple in Python is an ordered and immutable data type. 1
85 Reasoning : Tuples can contain heterogenous data and permit duplicate
values as well

Which of the following is not in Python Character Set.


a. Letters : A-Z or a – z b. Digits : 0 – 9
c. Whitespaces : blank space, tab etc d. Images : Vector
Which of the following is not the mode of interacting with python?
a. Interactive Mode b. Script Mode c. Hybrid Mode
d. None of the above
Which of the following is not correct about python?
a. Python is an open source language. b. Python is based on ABC language.
c. Python is developed by Guido Van Rossum d. None of the above
Smallest element of of python coding is called __________
a. Identifiers b. Token c. Keywords d. Delimiters
Which of the following is not a token?

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


10
a. // b. “X” c. ## d. 23
Q11. Which of the following symbol is used to write comment?
a. ? b. // c. # d. **
Which of the following is invalid variable name?
a. Sum1 b. Num_1 c. Num 1 d. N1
Python is case sensitive.(T/F) a. True b. False
Writing comments is mandatory in python programs(T/F)
a. True b. False
Which keyboard key is used to run python programs?
a. F6 b. F5 c. F + n d. Ctrl + r
_______________ escape sequence is used for horizontal tab.
a. \n b. \t c. \T d. No
An escape sequence is represented by __________ slash followed by one or two characters.
a. back b . forward c. double d. None of the above
Which of the following is wrong in reference to naming of variable?
a. Keywords are not allowed for variable names.
b. Spaces are not allowed for variable names.
c. Variable names can start from number.
d. Special symbols are not allowed
Which of the following is invalid identifier?
a. _ b. _1st c. 1stName d. While
Identifier name can be of maximum ____________ character
a. 63 b. 79 c. 53 d. any number of
All keywords in Python are in lower case(T/F).
a. True b. False
An ordered set of instructions to be executed by a computer to carry out a specific task is
called _______
a. Algorithm b. Pseudocode c. Program d. None of the above
Computers understand the language of 0s and 1s which is called _______
a. Machine Language b. Low level Language
c. Binary Language d. All of the above
Python uses ____ to convert its instructions into machine language.
a. Interpreter b. Compiler c. Both of the above d. None of the above
Which of the following is not the feature of python language?
a. Python is a proprietary software.
b. Python is not case-sensitive.
c. Python uses brackets for blocks and nested blocks.
d. All of the above
In which of the following mode, the interpreter executes the statement and displays the result as
soon as we press ‘Enter’ key?
a. Interactive mode b. Script mode c. Hybrid mode
d. None of the above
By default, the Python scripts are saved with ____________ extension.
a. .pyp b. .pys c. .py d. None of the above
By default, the Python scripts are saved in ____
a. Document b. Desktop c. Python installation folder d. D drive
Comments in python program are ________________ by interpreter
a. executed b. not executed c. given d. shared
In Python single line comment starts with _________
a. % b. /* c. ! d. #
___________ is a set of valid characters that a language can recognize.
a. Identifier b. Token c. Character set d. Character group
Which of the following is token in Python?
a. Punctuators b. Literals c. Keywords d. All of the above

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


11
Which of the following is String literal?
a. “ABC” b. “123” c. Both of the above d. None of the above
Multiline string in python can be created by enclosing text in ____
a. Single quotes(‘ ‘) b. Double quotes(” “)
c. Triple quotes(”’ ”’ d. All of the above
Which of the following is invalid logical operator?
a. and b. o c. not d. xor
In Python, a ___________ is a unit of code that the Python interpreter can execute
a. expression b. statement c. instruction d. None of the above
The process of removing errors from programs is called _______________
a. Programming b. Documentation c. Debugging d. None of the above
IDLE stands for __________
a. Integrated Development LEarning
b. Integrated Development Learning Environment
c. Intelligent Development Learning Environment
d. None of the above
Smallest element of python coding is called __________
a. Identifiers b. Token c. Keywords d. Delimiters
________ are reserved words.
a. Keywords b. Identifiers c. Variables d. Comments
In Python multi line comment starts with ____________
a. % b. /* c. ! d. #
Which of the following is invalid Identifier?
a. break b. FILE34 c. F_L d. Myname
Which of the following statement is wrong?
a. Literals are data items that have fixed value.
b. Keywords can not be used as identifier.
c. Identifier can start with number.
d. None of the above
Variables whose values can be changed after they are created and assigned are
called __________________
a. mutable b. immutable c. changeable d. None of the above
An _______________ is a symbol which is used to perform specific mathematical or logical
operation on values.
a. Operand b. Operator c. Keyword d. Identifier
Write pseudocode that reads 2 numbers and divide one by another and display the quotient.

Draw the symbols used in flow chart.

Write an algorithm to find the greatest among 2 numbers entered by the user.

In how many different ways, can you work in Python?

What is the difference between an expression and a statement in Python?

How are tuples different from lists when both are sequences?
What is the length of the tuple shown below?
T=((((‘a’, 1), (‘b’, ’c’), ‘d’, 2), ‘e’,3)
What will be the output for the following Python code?
tp1= (2, 4, 3)
tp3=tp1*2

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


12
print(tp3)
Predict the output for the following Python code.
t=(10, 20, 30, 40, 50, 50, 70)
print(t[5:-1])
If a is (1, 2, 3), what is the difference between a*3 and (a, a, a)?
What is the difference between (30) and (30,)?
If a is (1, 2, 3), what is the difference between a[1:2] and a[1:1]?
How are in operator and index() similar or different?
Find the error in the following code.
a) Plane=(“Passengers”, “Luggage”)
Plane[1]=”Electronic Items”)
print(Plane)

b) t2=(4, 5, 6)
t3=(6, 7)
print(t3 – t2)
Find the error in the following code.
a) t1=(3)
t2=(4, 5, 6)
t3= t1 + t2)

b) t3=(6, 7)
t4=t3*3
t5=t3*(3)
t6=t3 *(3,)
print(t4)
print(t5)
print(t6)
Consider the following tuples, tuple1 and tuple 2:
tuple1=(23, 1, 45, 67, 45, 9, 55, 45)
tuple2=(100, 200)
Find the output of the following statements:
(i) print(tuple1.count(45))
(ii) print(tuple1.index(45))
(iii) print(sorted(tuple1))
print(tuple1)
A student’s roll number, name and marks in 5 subjects are available in the form of a tuple
as shown here: Student = (11, ‘Ria’,(67, 77, 78, 82, 80)). Write a program to print the
minimum and maximum marks along with total marks obtained by the student.
Write the output for the following:
a) t2 = ('a')
type(t2)

b) tuple = ('a', 'b', 'c', 'd', 'e')


tuple = ('A',) + tuple [1:]
print (tuple)

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


13
c) t3 = (6, 7)
t4 = t3 * 3
t5 = t3 * (3)
print(t4)
print(t5)
Write a program to print the index of the minimum element in a tuple.
What are nested tuples? Give an example.
What would be the output of the following code if ntp1=(“Hello”, “Nita”, “How’s”, “life?”)
(a, b, c, d)=ntp1
print (“ a is : “, a)
print (“ b is : “, b)
print (“ c is : “, c)
print (“ d is : “, d)
ntp1=(a, b, c, d)
print(ntp1[0][0] + ntp1[1][1], ntp1[t1]) - 4 Marks
Given three tuples as shown below:
(1, 2, 3, 4 , 5, 6, 7, 8 , 9, 10, 11)
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
(1, 2, 3, 4, 5, 6, 7, 8, 9)
Which of the above three tuples will produce the two tuples having
identical elements but in reverse order as per the code given below?
- 4 Marks

What does each of the following expressions evaluate to? Suppose that T
is the tuple: ("These", ("are", "a", "few", "words"), "that", "we", "will", "use")
(a) T[1][0: : 2] (b) "a" in T [1] [ 0 ] (c) T [ : 1 ] + T[ 1 ]
(d) T[ 2 : : 2 ] (e) T[2][2] in T[1] (f) T[2][3] - 3 Marks
Write a python program that create a tuple storing first 9 terms of Fibonacci Series.
- 4 Marks
Part – A : Multiple Choice Questions (30 X 1 = 50 marks)
Names given to different parts of a Python Program are ______________.
a) Identifiers b) Functions c) Keywords d) Literals
Which of the following operators has the lowest precedence?
a) not b) % c) and d) +
In Python statement x = a + 5 – b. Here a and b is ______________
a) Operands b) Expression c) Operators d) Equation
What does the following Python Program display?
X=3
if x==0:
print(“Am I here?”, end =’ ‘)
elif x==3:
print(“Or here?”, end=’ ‘)
else:
pass
print(“Or over there?”)
a) Am I here? b) Or here? c) Am I here? Or here? d) Or here? Or Over here?
What is the output produced when this code executes?
a=0
for i in range(4, 8):
if i%2==0:
a=a+i

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


14
print(a)
a) 4 b) 8 c) 10 d) 18
Function range(10, 5, 2) will yield an iterable sequence like
a) [ ] b) [10, 8, 6] c) [2, 5, 8] d) [8, 5, 2]
Consider the loop given below. What will be the final value of i after the loop?
for i in range(10);
break
a) 10 b) 0 c) Error d) 9
Consider the loop given below:
for i in range(10, 5, -3):
print(i)
How many times will this loop run?
a) 3 b) 2 c) 1 d) Infinite
The ________ construct allows to choose statements to be executed, depending upon the result of
a condition.
a) selection b) repetition c) sequence d) flow
Negative index -1 belongs to ____________ of string.
a) first character b) last character c) second last character d) second character
Choose the correct function to get the ASCII code of a character.
a) char(‘char’) b) ord(‘char’) c) ascii(‘char’) d) All of these
What is the output of the following string operation?
Str=”My roll no. is 12”
print(Str.isalnum())
a) True b) False c) Error d) No output
Str1=”Waha”
print(Str1[:3]+’Bhyi’+Str1[-3:)]
a) Wah Bhyi Wah b) Wah Bhyi aha c)WahBhyiWah d) WahBhyiaha
Which of the following functions will return the first three characters of a string s?
a) s[3:] b) s[:3] c) s[-3:] d) s[:-3]
Which of the following functions removes all leading and trailing spaces from a string?
a) lstrip() b) rstrip() c) strip() d) all of these
Which of the following functions will return the total number of characters in a string?
a) count() b) index() c) len() d) all of these
Which of the following is / are not legal string operators?
a) in b) + c) * d) /
Which method should I use to convert String “Python programming is fun” to “Python Programming
Is Fun”?
a) capitalize() b) title() c) istitle() d) upper()
a= "Welcome to \"my\" blog"
print(a)
a) Welcome to “my” blog b) Welcome to \”my\” blog
c) Error d) None of the above
Which of the following will create an empty list?
a) L=[] b) L=list(0) c) L=list() d) L=List(empty)
If L=[1, 2] then L * 2 will yield
a) [1, 2] * 2 b) [1, 2, 2] c) [1, 1, 2, 2] d) [1, 2, 1, 2]
What gets printed?
Names = [‘Hasan’, ‘Balwant’, ‘Sean’, ‘Dia’]
print(Names[-1][-1])
a) H b) n c) Hasan d) Dia e) a
What is the output when we execute list(“hello”)
a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] b) [‘hello’] c) [‘llo’] d) [‘olleh’]
Which of the following function will always return a list?
a) max() b) min() c) sort() d) sorted()

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


15
To find the last element of a list namely ‘smiles’ in Python, ___________ will be used.
a) smiles[0] b) smiles[-1] c) smiles[lpos] d) smiles[:1]
Which of the following can delete an element from a list, if its value is given?
a) pop() b) remove() c) del d) all of the above
Which of the following can add only one value to a list?
a) add() b) append() c) extend() d) none of these
Given a list L = [10, 20, 30, 40, 50, 60, 70], what would L[2: -2] return?
a) [10, 20, 30, 40] b) [20, 30, 40, 50] c) [20, 30, 40] d) [30, 40, 50]
Write the output of the following code :

>>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”]


>>> print(max(L))
a) Zee b) Longest Word c) Error d) None of the above
L=[0.5 * x for x in range(4)]
print(L)
a) [0.0, 0.5, 1.0, 1.5] b) (0,.5, 1, 1.5) c) [0.0, 0.5, 1.0, 1.5, 2.0] d) Error

Part – B: Answer the following short questions (10 X 2 = 20 marks)

Why is following code giving errors?


Name = “Rehman”
print (“Greetings!!!”)
print(“Hello”, Name)
print(“How do you do”)
What will be the output of following code?
x, y = 2, 6
x, y = y, x+2
print(x, y)
Consider below given expressions, what will be the final result and final data type?
a) a, b = 3, 6 b) a, b = 3, 6
c=b/a c=b%a
Write a program to input three numbers and display largest number.

Differentiate between break and continue statements using examples.


Find the error. Consider the following program:
a=int(input(“Enter a value:”))
while a!=0:
count = count + 1
a=int(input(“Enter a value”))
Predict the output:
my_list= [ 'p', 'r', 'o', 'b', 'l' , 'e', 'm']
my_list[2:3] = []
print(my_list)
my_list[2:5] = []
print(my_list)
Write a program to find the largest and smallest number in a list.

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


16
What does each of the following evaluate to? Suppose that L is the list

[“These”, [“are”, “a”], [“few”, “words”], “that”, “we”, “will”, “use”].

a) L[3:4] + L[1:2]

b) “few” in L[2:3]

How are lists different from the strings when both are sequences?

Part – C: Answer the following short questions (10 X 3 = 30 marks)


Write a program to print the table of a given number. The number has to be entered by the user.

Predict the output of the following code fragments:


a)
x=10
y=0
while x>y:
print(x, y)
x=x-1
y=y+1
b)
for i in range (4):
for j in range(5):
if i+1==j or j+i==4:
print(‘+’, end=’ ‘)
else:
print(‘0’, end=’ ‘)
print()
Given a string S = "CARPE DIEM". If n is length/2 (length is the length of the given string), then
what would following return?

(a) S[: n]
(b) S[n :]
(c) S[n : n]
(d) S[1 : n]
(e) S[n : length – 1]

a)

What will be the output produced by following code fragments?

x = "hello world"
print (x[:2], x[:-2], x[-2:])
print (x[6], x[2:4])
print (x[2:-3], x[-4:-2])

b) What will be the output produced by following code fragments

s="python string fun"


while True:

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


17
if s[0]=='p':
s = s[3:]
elif s[-1]=='n':
s=s[:2]
else:
break
print(s)

Write a program in Python to count the no. of vowels present in a given string. The string input will
be entered by the user.

Suggest appropriate functions for the following tasks –


(a) To check whether the string contains digits.
(b) To find the occurrence a string within another string.
(c) To convert the first letter of a string to upper case.
(d) To convert all the letters of a string to upper case.
(e) To check whether all the letters of the string are in capital letters.
(f) to remove all the white spaces from the beginning of a string.
Start with the list[8,9,10]. Do the following using list functions (
(a) Set the second entry (index 1) to 17
(b) Add 4, 5 and 6 to the end of the list.
(c) Remove the first entry from the list.
(d) Sort the list.
(e) Double the list.
(f) Insert 25 at index 3

Predict the output of the following two parts. Are the outputs same? Are the outputs different? Why?
a) b)
L1, L2 = [2, 4], [2, 4] L1, L2 = [2, 4], [2, 4]
L3=L2 L3=list(L2)
L2[1]=5 L2[1]=5
print (L3) print(L3)
What will be output of the following statements?
a) b)
list1=[12, 32, 65, 26, 80, 10] list1=[12, 32, 65, 26, 80, 10]
list1.sort() sorted(list1)
print(list1) print(list1)

c)
list1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list1[: : -2]
list1[:3] + list1[3:]
Write a program in Python accept 10 inputs from the user. Sort these elements in a homogenous
list. Find the sum and count the positive elements and negative elements from the list.

Names given to different parts of a Python Program are ______________.


a) Identifiers b) Functions c) Keywords d) Literals
Which of the following operators has the lowest precedence?
a) not b) % c) and d) +

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


18
In Python statement x = a + 5 – b. Here a and b is ______________
a) Operands b) Expression c) Operators d) Equation
What does the following Python Program display?
X=3
if x==0:
print(“Am I here?”, end =’ ‘)
elif x==3:
print(“Or here?”, end=’ ‘)
else:
pass
print(“Or over there?”)
a) Am I here? b) Or here? c) Am I here? Or here? d) Or here? Or Over here?
What is the output produced when this code executes?
a=0
for i in range(4, 8):
if i%2==0:
a=a+i
print(a)
a) 4 b) 8 c) 10 d) 18
Function range(10, 5, 2) will yield an iterable sequence like
a) [ ] b) [10, 8, 6] c) [2, 5, 8] d) [8, 5, 2]
Consider the loop given below. What will be the final value of i after the loop?
for i in range(10);
break
a) 10 b) 0 c) Error d) 9
Consider the loop given below:
for i in range(10, 5, -3):
print(i)
How many times will this loop run?
a) 3 b) 2 c) 1 d) Infinite
The ________ construct allows to choose statements to be executed, depending upon the
result of a condition.
a) selection b) repetition c) sequence d) flow
Negative index -1 belongs to ____________ of string.
a) first character b) last character c) second last character d) second character
Choose the correct function to get the ASCII code of a character.
a) char(‘char’) b) ord(‘char’) c) ascii(‘char’) d) All of these
What is the output of the following string operation?
Str=”My roll no. is 12”
print(Str.isalnum())
a) True b) False c) Error d) No output
Str1=”Waha”
print(Str1[:3]+’Bhyi’+Str1[-3:)]
a) Wah Bhyi Wah b) Wah Bhyi aha c)WahBhyiWah d) WahBhyiaha
Which of the following functions will return the first three characters of a string s?
a) s[3:] b) s[:3] c) s[-3:] d) s[:-3]
Which of the following functions removes all leading and trailing spaces from a string?
a) lstrip() b) rstrip() c) strip() d) all of these
Which of the following functions will return the total number of characters in a string?
a) count() b) index() c) len() d) all of these
Which of the following is / are not legal string operators?
a) in b) + c) * d) /
Which method should I use to convert String “Python programming is fun” to “Python
Programming Is Fun”?

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


19
a) capitalize() b) title() c) istitle() d) upper()
a= "Welcome to \"my\" blog"
print(a)
a) Welcome to “my” blog b) Welcome to \”my\” blog
c) Error d) None of the above
Which of the following will create an empty list?
a) L=[] b) L=list(0) c) L=list() d) L=List(empty)
If L=[1, 2] then L * 2 will yield
a) [1, 2] * 2 b) [1, 2, 2] c) [1, 1, 2, 2] d) [1, 2, 1, 2]
What gets printed?
Names = [‘Hasan’, ‘Balwant’, ‘Sean’, ‘Dia’]
print(Names[-1][-1])
a) H b) n c) Hasan d) Dia e) a
What is the output when we execute list(“hello”)
a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] b) [‘hello’] c) [‘llo’] d) [‘olleh’]
Which of the following function will always return a list?
a) max() b) min() c) sort() d) sorted()
To find the last element of a list namely ‘smiles’ in Python, ___________ will be used.
a) smiles[0] b) smiles[-1] c) smiles[lpos] d) smiles[:1]
Which of the following can delete an element from a list, if its value is given?
a) pop() b) remove() c) del d) all of the above
Which of the following can add only one value to a list?
a) add() b) append() c) extend() d) none of these
Given a list L = [10, 20, 30, 40, 50, 60, 70], what would L[2: -2] return?
a) [10, 20, 30, 40] b) [20, 30, 40, 50] c) [20, 30, 40] d) [30, 40, 50]
Write the output of the following code :

>>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”]


>>> print(max(L))
a) Zee b) Longest Word c) Error d) None of the above
L=[0.5 * x for x in range(4)]
print(L)
a) [0.0, 0.5, 1.0, 1.5] b) (0,.5, 1, 1.5) c) [0.0, 0.5, 1.0, 1.5, 2.0] d) Error

Why is following code giving errors?


Name = “Rehman”
print (“Greetings!!!”)
print(“Hello”, Name)
print(“How do you do”)
What will be the output of following code?
x, y = 2, 6
x, y = y, x+2
print(x, y)
Consider below given expressions, what will be the final result and final data type?
a) a, b = 3, 6 b) a, b = 3, 6
c=b/a c=b%a
Write a program to input three numbers and display largest number.

Differentiate between break and continue statements using examples.


Find the error. Consider the following program:
a=int(input(“Enter a value:”))

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


20
while a!=0:
count = count + 1
a=int(input(“Enter a value”))
Predict the output:
my_list= [ 'p', 'r', 'o', 'b', 'l' , 'e', 'm']
my_list[2:3] = []
print(my_list)
my_list[2:5] = []
print(my_list)
Write a program to find the largest and smallest number in a list.

What does each of the following evaluate to? Suppose that L is the list

[“These”, [“are”, “a”], [“few”, “words”], “that”, “we”, “will”, “use”].

a) L[3:4] + L[1:2]

b) “few” in L[2:3]

How are lists different from the strings when both are sequences?

Write a program to print the table of a given number. The number has to be entered by the
user.

Predict the output of the following code fragments:


a)
x=10
y=0
while x>y:
print(x, y)
x=x-1
y=y+1
b)
for i in range (4):
for j in range(5):
if i+1==j or j+i==4:
print(‘+’, end=’ ‘)
else:
print(‘0’, end=’ ‘)
print()
Given a string S = "CARPE DIEM". If n is length/2 (length is the length of the given string),
then what would following return?

(a) S[: n]
(b) S[n :]
(c) S[n : n]
(d) S[1 : n]
(e) S[n : length – 1]

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


21
a)

What will be the output produced by following code fragments?

x = "hello world"
print (x[:2], x[:-2], x[-2:])
print (x[6], x[2:4])
print (x[2:-3], x[-4:-2])

b) What will be the output produced by following code fragments

s="python string fun"


while True:
if s[0]=='p':
s = s[3:]
elif s[-1]=='n':
s=s[:2]
else:
break
print(s)

Write a program in Python to count the no. of vowels present in a given string. The string
input will be entered by the user.

Suggest appropriate functions for the following tasks –


(a) To check whether the string contains digits.
(b) To find the occurrence a string within another string.
(c) To convert the first letter of a string to upper case.
(d) To convert all the letters of a string to upper case.
(e) To check whether all the letters of the string are in capital letters.
(f) to remove all the white spaces from the beginning of a string.
Start with the list[8,9,10]. Do the following using list functions (
(a) Set the second entry (index 1) to 17
(b) Add 4, 5 and 6 to the end of the list.
(c) Remove the first entry from the list.
(d) Sort the list.
(e) Double the list.
(f) Insert 25 at index 3

Predict the output of the following two parts. Are the outputs same? Are the outputs
different? Why?
a) b)
L1, L2 = [2, 4], [2, 4] L1, L2 = [2, 4], [2, 4]
L3=L2 L3=list(L2)
L2[1]=5 L2[1]=5
print (L3) print(L3)
What will be output of the following statements?
a) b)
list1=[12, 32, 65, 26, 80, 10] list1=[12, 32, 65, 26, 80, 10]
list1.sort() sorted(list1)
print(list1) print(list1)

c)
list1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


22
list1[: : -2]
list1[:3] + list1[3:]
Write a program in Python accept 10 inputs from the user. Sort these elements in a
homogenous list. Find the sum and count the positive elements and negative elements from
the list.

Differentiate between the following if L is a list.


a) L.append() and L.extend()
b) L.remove() and L.clear()
c) L.sort() and sorted(L)
Write a program to create a list and exchange the first element to last
element.

For example:
Input : [2, 5, 7, 6, 4]
Output : [4, 5, 7, 6, 2]

Predict the output of the following code fragments.


a) p=10
q=20
p*=q//3
print( “p = “, p)
b) x=20
x=x+5
x,y=x-1,50
print(“X = “,x ,”Y=”,float(y))
c) a,b=12,13
c,b=a*2,a/2
print(a,b,c)
Write a program to add all the values in the tuple of marks which ends with 1 and display
their sum.
Consider the following tuples, tuple1 and tuple2.
tuple1=(23,1,45,67,45,9,55,45)
tuple2=(100,200)
Find the output of the following statements.
a) print(len(tuple1+tuple2)
b) print(tuple1.count(45))
c) print(sorted(tuple1))
Write a program to check if a tuple contains duplicate elements.
Consider the following dictionary d and answer the given questions:
d={‘Name’:’Vishnu’,’Class’:’XI’,Section:’B’}
a) Write a statement to insert an element with a key Building and value as
senior.

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


23
b) Change the section of student from B to A.
c) Find the length of dictionary

The record of a student( Name, Roll No, Marks in five subjects and percentage of marks)
is stored in the following list.
stRecord=[“Raman”,”A-36”,[56,34,89,76,100],78.8]
Write python statements to retrieve the following information from the list stRecord.
a) Marks in the fifth subject
b) Maximum marks of the student
c) Change the name of the student from Raman to Raghav

Write a program to accept two numbers and swap them.


Write a python program to read a list of n integers. Create two new list, one having all the
positive numbers and the other having all the negative numbers.

Explain about any 5 types of operators in python

Write a menu driven python program to input your friend’s names and their phone
numbers and store them in the dictionary as the key – value pair. Perform the following
operations on the dictionary.
i) Display the name and phone number of all your friends.
ii) Add a new friend to the dictionary and display the modified dictionary
iii) Delete a particular friend from the dictionary.
iv) Modify the phone number of an existing friend.
v) Check if a friend is present in the dictionary or not.

a) Write a menu driven python program to create an empty list and do the following.
(i) The program should ask for Number of elements (N) to be appended in the list and
write code to input these N elements and to display these elements.
(ii) The program should ask for the element and the number to be inserted, and insert
the element at the required position.
(iii) The program should ask for the position of the element to be deleted from the list
and delete the element at the desired position in the list. 2
(iv) The program should ask for the value of the element to be deleted from the list and
delete this value from the list

Read the code given below and answer the questions based on the code.
teststr="abcdefghi"
inputstr=input("Enter integer:")
inputint=int(inputstr)
count=2
newstr=""
while count <= inputint:
newstr=newstr+teststr[0:count]
teststr=teststr[2:] #Line 1
count=count+1
print(newstr) #Line 2
print(teststr) #Line 3
print(count) #Line 4
print(inputint) #Line 5

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


24
i. Given the input integer 4, what output is produced by Line 2.
a) abcdefg c) aabbccddeeffgg
b) abcdeefgh d) ghi
ii. Given the input integer 4, what output is produced by Line 3.
a) abcdefg c) aabbccddeeffgg
b) abcdeefgh d) ghi

iii. Given the input integer 4, what output is produced by Line 4.


a) 4 c) 5
b)3 d) 2
iv. Given the input integer 4, what output is produced by Line 5.
a)4 c) 5
b) 3 d) 2
v. Which statement is equivalent to the statement found in Line 1?
a) teststr=teststr[2:0] c) teststr=teststr[2:-1]
b) teststr=teststr[2:-] d) teststr=teststr – 2
e) None of these

Write a program to accept n number of names into the list and print the names starting
with ‘A’.

Predict the output of following code:

NUMBER= [15,12,19,26,18]

for i in range (3,0,-1):

A=NUMBER[i]
1
print(A,end='#')

B=NUMBER[i-1]

print(B,end='@')

Rewrite the following code after removing all syntax errors. Underline each
correction you have done in the code:
2 a=10
for v in range(a)
if v%10=0:

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


25
print(v//10)
else if v%8==0:
print(v//8)
else:
print(v//2)

Dhruv has created a list. Now he wants to perform the following tasks:
L=[99,77,66]
3 i) Insert a value 88 at index 1
ii) Remove element 66 using backward indexing

Consider the following string mySubject:


mySubject = "Computer Science"
What will be the output of:
4 i) print(mySubject[:3]) ii) print(mySubject[-5:-1])
iii) print(mySubject[::-1]) iv) print(mySubject*2)

Write python statement to do the following:


5 i) Declare string object and initialize with – ‘Science:CS-Commerce:IP’
ii) Separate them like : [‘Science:CS’,’Commerce-IP’]
What will be the output of the following code:
A=20
A=A+20
A=A-10
6
print(A)
A,B=A-3,33
print(A,B)

a) Helly has written the following code in python but did not get the expected result.
Help her to rectify the errors. Underline the corrected statements having errors

x,y,z=5 6 7

7
print(Values are:x,y,z)

z y x =7,6,5

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


26
print(z and x)

b) Identify error in the following code. Rewrite the corrected code after removing errors
and underline the corrections:

a,b=input(“Enter value:”)

8
result=a/*b

print result

Find the output of the given code:


l = [6 , 3 , 8 , 10 , 4 , 6 , 7]
print( '@', l[3] - l[2])
9
for i in range (len(l)-1,-1,-2) :
print( '@',l[i],end='' )

10 Write a program to read a number n and print n2 , n3 and n4.

Evaluate the expressions:

a) 5+5*10**2//4

b) 3*5-4**2
11
c) not (10<5) and (13>9) or (5==6)

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


27
Rudra is writing a program in python. He wants to add some descriptive text into the
program to provide documentation and basic info about python statements which can
12 make the source code easier for people to understand. Some statements are single line
statement and some statements have multiple lines. Write what he can add do this?
Explain with example.

Write a program to create a list and exchange the first element to last
element.

For example:
13
Input : [2, 5, 7, 6, 4]
Output : [4, 5, 7, 6, 2]
.

Write a program to add all the values in the tuple of marks which ends with 1 and display
14
their sum
Consider the following dictionary d and answer the given questions:
d={‘Name’:’Vishnu’,’Class’:’XI’,Section:’B’}
a) Write a statement to insert an element with a key Building and value as
15 senior.
b) Change the section of student from B to A.
c) Find the length of dictionary

16 Write a program to accept two numbers and swap them.


Write a program to accept n number of names into the list and print the names starting
with ‘A’.
17

18 Write a program to print the Fibonacci series up to n terms.


Write a program to accept n number of elements and add them into a list. Find the
19 maximum and minimum values and print them.

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


28
Pranjal has the partial code as given below. Fill in the blanks with appropriate
statements.
d=_________________ #Statement 1 Input a dollar amount
rs=________________ #Statement 2 Calculation 1 dollar = 79.68
forex_charges=95
net_rs=__________ #Statement 3 Deduction of forex transaction charges
print(_____________) #Statement 4 Displaying the net amount
20
i) Write input statement for statement 1
ii) Write the computation using arithmetic operators to convert dollars into
rupees for statement 2
iii) Write a statement to deduct bank charges 95
iv) Write a statement to display: “Net amount received” and final value

Prutha is class 11 student. She is learning python. She wants to display the
only the last two digits of a number. She has written the partial code as
following:
n=__________ #Statement 1
ld1= __________ #Statement 2
n= ________ #Statement 3 Remove the first last digit of a number
ld2=n%10
21 print(“Last Digit 1:”,__________, “Last Digit 2”,________) #Statement 4

a) Statement 1 – Input n as integer


b) Statement 2 – Get the last digit by modulo division of number by 10
c) Statement 3 – Get new number by removing last digit using floor
division by 10
d) Statement 4 – Print the last digit 1 and last digit 2

Consider the code given below to compute energy through mass m

multiplied by the speed of light (c=3*108). Fill in the gaps as given in

statements.
22
import ___________ #Statement 1

m=_________________ #Statement 2

c= _____________ #Statement 3

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


29
e=_______________ #Statement 4

print(“Energy:”, e ,” Joule”)

i. Write a statement to import the required module to compute power

ii. Write a statement to accept floating point value for mass

iii. Write a statement to compute c as speed of light as given formula. Use

a function to compute the power.

iv. Write a statement to compute the energy as e = mc2

Pranjal has given following symbols and word to identify which types of
tokens are they, help her to identify them:
21 i. if ii. r_no iii. and iv. ‘True’

What will be the output produced by following code statements?


22 a) 87//5 b) (87//5.0)==int(87/5.0) c) (87//int(5.0)==(17%5.0) d) (87//5.0)==(87//5)

Rewrite the following code after removing all syntax errors. Underline each
correction you have done in the code:
a=10
for v in range(a)
if v%10=0:
23
print(v//10)
el if v%8==0:
print(v//8)
else:
print(v//2)

Write the output for the following:


a = str("786")
b = "Python" * 4
24
print(a,b)
a=a+b
print(len(a))

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


30
Write the output for the following:
s="python string fun"

for i in range(0,len(s)):

if s[i]>='c' and s[i]<='l':


25
print(s[i].lower(),end="")

else:

print(s[i].upper(),end="")

Predict the output for the following code:


s="python"
s1=""
s2=""
s3=""
if s[-1]=='n':
s1 = s[0:3]
print(s1)
26
if 'h' in s:
s2=s[0] + 'i'
print(s2)
if 'z' not in s:
s3 = '7' + s[1:] + 'w'
print(s3)
else:
s = s* 3 print(s)
Consider the code given below:
import random
r=random.randint(10,100) -10
print(r, end=” “)
27
r=random.randint(10,100) – 10
print(r, end=” “)
r=random.randint(10,100) – 10
print(r)

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


31
What are the possible outcomes of the above code? Also, what can be the maximum and
minimum number generated by line 2?

Write a program to take an integer a as an integer input and check whether it ends with 4 or 8. If
it ends with 4, print “ends with 4”, if it ends with 8, print “ends with 8”, otherwise print “ends
28 with neither”

Write a program to check whether the entered string is palindrome or not.

29

Consider the following string myAddress:

myAddress = “WZ-1,New Ganga Nagar,New Delhi”


What will be the output of following string operations:

i. print(myAddress.lower())

ii. print(myAddress.upper())
30 iii. print(myAddress.count(‘New’))

iv. print(myAddress.find(‘New’))

v. print(myAddress.split(‘,’))

vi. print(myAddress.replace(‘New’,’Old’))

Find the errors in the following code:


a) c=int(input(“Enter your class”))
print(“Your class is”,c)

Input to be entered as XI
31
b) a,b,c = 2,8,9
print(a,b,c)
c,b,a=a,b,c
print(a;b;c)

a) Write a program to input a value in miles and convert into kilometres. (1 km =


0.621371 miles)
32
b) Write a program to find the sum of natural numbers using for loop.

a) What would the following code do : X = Y = 7 ?


33
b) What is the error in following code : X, Y = 7 ?

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


32
From the following, find out which assignment statement will produce an error. State
reason(s) too.

(a) x = 55
(b) y = 037
(c) z = 0o98
34 (d) 56thnumber = 3300
(e) length = 450.17
(f) !Taylor = 'Instant'
(g) this variable = 87.E02
(h) float = .17E - 03
(i) FLOAT = 0.17E - 03

List and explain the operators in string with an example for each.
35

Consider these statements and answer the given questions.


a) Predict the output: i) math.ceil(75.3) ii) math.floor(75.3)
36 b) Write the statement required to access the necessary module
c) Write a statement to find the square root of 100

Observe the code given below and write answer of the following questions:

a,b=0,1

n=___________ # Statement 1

if _________: #Statement 2

print(“Please enter a positive number”)

elif _______: #Statement 3

print(“You have entered 0”)


37
else:

_______________ #Statement 4

c = a+b

a=b

b=c

print(b)

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


33
i. Write input statement to accept n number of terms – Statement 1

ii. Write if condition to check whether input is positive number or not -

Statement 2

iii. Write if condition to check whether input is 0 or not -

Statement 3

Iv. Write else part of the code - Statement 4

38 What’s the output of the following program.


fruits = { 'Apple': 100, 'Orange': 200, 'Banana': 400, 'pomegranate':600 }
if 'Apple' in fruits:
del fruits['Apple']
print('Dictionary after deleting key =',fruits)

39 Write a program to print the Fibonacci Series till n terms, where n is entered by the user.

40 a) What is the result of this statement:


10>5 and 7>12 or not 18>3
b) What will be the output of the following Python code?
>>> 6 * 3 + 4 ** 2 // 5 - 8
41 (a) What will be the output of the following Python code? >
>>> print(math.ceil(55.1))

(b) Which python module required to run above code successfully?

42 Write the output of following code segment.


str= “ CS and IP"
a=str.split()
print(a)
"Bikaner"
print(dict)
1.
43
Write the output of the code given below:

dict = {"stname": "Ajay", "age": 17}

dict['age'] = 27
dict['address'] =
44 Write a program calculate and print total and average runs scored by a cricketer in 3
matches.
1.
45 What is mutable and immutable data objects in Python? Name any one of each type.
(OR)
How the pop ( ) function is different from remove( ) function working with list in python ?

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


34
46 What is output from the following code :
(i)range(6) (iii)range(5,20,4)
(ii)range(7,10) (iv)range(12,1,-2)

47 What is difference between break and continue statement in Python explain with
example.

48 Write a program to check number of ‘H’ present in a string:


“ ALPS HEALS WITHOUT HURTING”
Output will be displayed as: Total number of ‘H’ is: 4

49 Rewrite the following code in Python after removing all syntax error(s).
30 = To
for K in range(0, To)
If K%4 == 0:
Print(K*4)
Else:
Print(K + 3)
50 What is the difference between ‘=’ and ‘==’? Explain with the help of an example.

51 What do you understand by precedence of operators? What is the precedence of


arithmetic operators?

52 Write a program to print following series: 2,4,8,16, …………….

53 How is random.randint(10) different from random.randrange (10)?

54 Differentiate between list and tuple with example?

55 Predict the output of the Python code given below:

fruits = ["apple",”mango”, "banana", "cherry"]


for x in fruits:
if(len(x)>5):
print(x)

56 Rewrite following code after removing errors (if any):


N=100
A= “Number” +5
B= 2N +20
Print(B)

57 Write the output of this program:


s1='Hello World!'
index=0
while index< (len(s1)-3): print(s1[index],
end=' ')
index =index+ 1

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


35
58 Go through the program of dictionary in python given below and predict the output of
program.
Student={"RollNo":10 , "Name":"Kuku" , "Class":11 , "Age":15}
T=len(Student)
Elm=Student.get("Name")
mylist=Student.items() print("Length=",T)
print("Specific Element=",Elm) print("My
List=",mylist)
59 What will be the output of the following:
L1= [11, 14, 18, 10, 15]
L2= ['P', 'Y', 'T', 'H', 'O', 'N']
(a) L1.insert(0,12)
(b) L1.sort()
(c) L1.remove(14)
(d) L1.append(5)
(e) L2.pop()
(f) L1+L2
(g) L1.extend([12,16,18])
(h) L1*2

60 A code snippet using a dictionary is shown below and What will be the output of the
following :
dt={“Apple”:50, “Orange”:40, “Banana”:30 , “Mango”:80}
print(len(dt)) #Statement 1
print(dt.keys()) #Statement 2
print(dt.items()) #Statement 3
print(dt.popitem()) #Statement 4
print(dt.get("Banana")) #Statement5
Evaluate output of all statements.

61 Write a program to search for an element in a given list of numbers.

62 Write a python program to calculate factorial of a number.

63
What is token? Name various types of tokens.

64 What will be the output of the following Python code?


>>> a=72.55
>>> b=10
>>> c=int(a+b )
>>>print(c)

65. What happens when you try to access the value of an undefined variable?

66. How is a list type different from a tuple data type in python?

67. What is the output of following code fragment?

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


36
68. Write the output of following:

69. Find the error of following code.

70. What is the output of following code fragment?

71. What is an identifier? What are the identifier-forming rules of python?

72. Predict the output of the following code.

What are the different types of errors in python

73. Write a python program to check whether the entered number is Armstrong or not.

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


37
74. What are iteration statement? Name the iteration statements provided by python.
75. What will be the output of following program:

76. What will be the output of following program:

77. Write a Python Program to check First Occurrence of a Character in a String

78. Find the output:

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


38
79. Write a program to check whether a number entered by the user is POSITIVE, NEGATIVE
or ZERO.

80. Write a program check whether a number entered by the user is ODD or EVEN

Rewrite the following code after removing all syntax error(s) and underline each correction
done:
Runs=[10,5,0,2,4,9]
for I in Runs:
81 if m=0: print(Maiden Over) else:

print(Not Maiden)
Write a program to input the radius of a sphere and calculate its volume using math module.

82

83 Write a program to print the following pattern


A
AB
ABC
ABCD
ABCDE
84 What are endless loops? Why do such loops occur?
85 Predict the output of the Python code given below:
L=[1,2,3,4,5]
Lst=[]
for i in range(len(L)): if i%2==1:
t=(L[i],L[i]**2)
Lst.append(t) print(Lst)

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


39
86
Create the following lists using a for loop:
(a) A list containing of the integers 0 through 49.
(b) A list containing squares of the integers 1 through 50
87 Consider the following string mySubject: mySubject =
"Business mathematics"
What will be the output of the following string operations :
print(mySubject[0:len(mySubject)])
print(mySubject[-1:-7])
print(mySubject[::-2]) print(mySubject [len(mySubject)-1])

89 Write a program to search for an element in a given tuple of numbers

90
Find the output for the following code segment. L=[4,8,10,12,14,16,18]
T1=tuple(L[::2])
print("The First Tuple is",T1)
T2=T1+tuple(L[::-3])
print("The Second Tuple is",T2) print("Sum of Tuple
1=",sum(T1))
print("Sorting in Tuple 2 = ",sorted(T2))

91 A code snippet using a dictionary is shown below and What will be the output of the
following:
dt={“Apple”:50, “Orange”:40, “Banana”:30 , “Mango”:80} print(len(dt))
#Statement 1
print(dt.keys()) #Statement 2
print(dt.items()) #Statement 3
print(dt.popitem()) #Statement 4
print(dt.get("Banana")) #Statement5 Evaluate
output of all statements.

92 Predict the output: fruit = {}


L1 = ['Car', 'Bus', 'Auto'] for index in
L1 :
if index in fruit: fruit[index] +=
5 else :
fruit[index] = 7 print(len(fruit)) print(fruit)
93 Find the output of the following code:

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


40
Name="PythoN3.1"
R=""
for x in range(len(Name)): if
Name[x].isupper():
R=R+Name[x].lower() elif
Name[x].islower():
R=R+Name[x].upper() elif
Name[x].isdigit():
R=R+”$$$” else:
R=R+"#"
print(R)

94 Consider the following expression:


x = "and" * (3 + 2) > "or" + "4"

What is the data type of value that is computed by this expression?

95 Suggest appropriate functions for the following tasks:


1. To check whether the string contains digits
2. To find for the occurrence a string within another string
3. To convert the first letter of a string to upper case
4. to capitalize all the letters of the string
5. to check whether all letters of the string are in capital letters
6. to remove all white spaces from the beginning of a string

96
Dharamveer a Python programmer is working on a mathematical project and tried creating a
code for it. Suggest him a module and function from that module which can be used for the
following tasks
(i) To calculate absolute value of a number.
(ii) To calculate mean from a list of marks.
(iii) To generate a random number between 1 to 6 (both values included)..
97 What does each of the following expressions evaluates to? Suppose that L is the list
[“These”, [“are”, “a”], [“few”, “words”], “that”, “we”, “will”, “use”]
a. len( L )
b. L[3 : 4] + L[1 : 2]

98
Write output of the following Python code:
P = [1, 6, 9, 3, 8, 3, 1, 7, 3, 9, 1]
Q = [2, 3, 7, 9, 5, 3, 5, 9] R= []
for i in P:

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


41
if i not in Q and i not in R: R.append(i)
print(R)
99 What possible output(s) are expected to be displayed on screen at the time of execution of
the program from the following code? Also specify the maximum values that can be assigned
to each of the variables FROM and TO.
import random AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4) for K in
range(FROM,to+1):
print(AR[K],end=”#”)

a)10#40#70# b) 30#40#50# c) 50#60#70# d) 40#50#70#

100 Differentiate between append(), extend(), and insert() methods in a list with examples

101 Write the output:


y = str(789)
x = "Global" * 2 print (x, y)
x = " Climate" + " crisis" y = len(x)
print (y, x)
Write the output:
102 S = input("Enter String :") RS = " "
for ch in S :
RS = ch + RS
print(S + RS)

103
Write a short program to check whether a number is prime number or not.

104
Write a program to find the frequency of the element in the list (Input the list from the
user)
105 Mr. Monish is trying to develop a program based on list manipulations. He is supposed to
add/remove elements in the list, Help him to write the most appropriate list method to
perform the following tasks in the list:
Name of list is Marks=[10,20,30,40,50,60]
(a) delete an element value 20 from the list.
(b) get the position of an element 40 in the list
(c) delete the 3rd element from the list
(d) add single element 70 at the end of the list
add another list [80,90,100] at the end of the list.
106 Write a program that repeatedly asks the user to enter product names and prices. Store all
of these in a dictionary whose keys are the product names and whose values are the prices.
When the user is done entering products and prices, allow them to repeatedly enter a

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


42
product name and print the corresponding price or a message if the product is not in the
dictionary.

107 What will be the output of the following code d1={1:10,2:20,3:30,4:40}


d2={5:50,6:60,7:70}
d1.update(d2) print(d1)
print(d2.get(3))
print(d2.popitem())
Perform following operations on a dictionary using dictionary methods only: d = {1:
‘one’, 2: ‘two’, 3 : ‘three’ }
(a) Add a key 5 with value ‘five’
(b) Remove the key value pair for key 2
Print value at key 3
108 A year is a leap year if it is divisible by 4, except that years divisible by 100 are not leap years
unless they are also divisible by 400. Write a program that asks the user for a year and prints
out whether it is a leap year or not.
Write a program in Python to input a sentence from user and display all the words start with
upper case letter and its count.
For example if the inputted text is This is My Python example
The Expected Output is
Words start with Uppercase are This My Python
Count = 3
Consider a list Num=[23,15,21,36,42,55,88] . Create two more list Num1 and Num2
Used to store numbers divisible by 7 and 5 respectively. Print the lists Num1 and Num2.
The Expected Output is
List Num1 is [21,42] List Num2 is [15,55]
109 Find the output:
(i) A=[1,2,3,4,5,6,7,8,9,10]
del A[:5] print(A)
(ii) List1=[12,26,80,10]
List2=List1*3 Print(List2)
(iii) L1=[2,6,7,8]
L2=copy(L1) L2[2]=89
Print(L1)

110 Write the output:


(i) x, y = 4, 8
z = x/y*y print(z)
(ii) a="python Programming" c=4
while True:

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


43
if a[0]=="p": a=a[2:]
elif a[-2]=="n": a=a[:4]
else:
c+=1
break print(a)
print(c)

1) Write the output for the following:


x=3
if x == 0:
print ("Am I here?", end = ' ')
elif x == 3:
print("Or here?", end = ' ')
else :
pass
print ("Or over here?")

2) Write the output for the following:


a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))
if a <= 0:
b = b +1
else:
a=a+1
if a > 0 and b > 0:
print ("W")
elif a > 0:
print("X")
if b > 0:
print("Y")
else:
print("Z")

3) What values are generated when the function range(6, 0, -2) is


executed ?

4) Consider the loop given below :

for i in range(3) :
pass
What will be the final value of i after this loop ?

5) When the following code runs, how many times is the line
"x = x * 2" executed?

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


44
x=1
while ( x < 20 ):
x=x*2

6) What is the output produced when this code executes?

a=0
for i in range(4,8):
if i % 2 == 0:
a=a+i
print (a)

7) What are the four elements of a while loop in Python?

8) What are jump statements? Name them.

9) Rewrite following code fragment using while loops :

min = 0
max = num
if num < 0 :
min = num
max = 0 # compute sum of integers
# from min to max

for i in range(min, max + 1):


sum += i

10) Predict the output of the following code fragments:

x = 10
y=5
for i in range(x-y * 2):
print (" % ", i)

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


45
11) What is the output of the following code?

for i in range(4):
for j in range(5):
if i + 1 == j or j + i == 4:
print ("+", end = ' ')
else:
print ("o", end = ' ')
print()

12) In the nested for loop code below, how many times is the
condition of the if clause evaluated?

for i in range(4):
for j in range(5):
if i + 1 == j or j + i == 4:
print ("+", end = ")
else:
print ("o", end = ")
print()

Find the output of the given code:


l = [6 , 3 , 8 , 10 , 4 , 6 , 7]
print( '@', l[3] - l[2])
for i in range (len(l)-1,-1,-2) :
print( '@',l[i],end='' )

Write a python program to accept only 20 numbers and display the prime numbers from

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


46
that 20 numbers.

Write a program to read a number n and print n2 , n3 and n4.

Differentiate between the following if D is a dictionary.


a) del D and del D[<Key>]
b) D.pop(<key> ) and D.popitem( )
c) D.setdefault(<key>,<value>) and D.fromkeys(<sequence>,value)

Write a program to add all the values in the tuple of marks which ends with 1 and display
their sum.
Consider the following tuples, tuple1 and tuple2.
tuple1=(23,1,45,67,45,9,55,45)
tuple2=(100,200)
Find the output of the following statements.
a) print(len(tuple1+tuple2)
b) print(tuple1.count(45))
c) print(sorted(tuple1))
Write a program to check if a tuple contains duplicate elements.
Consider the following dictionary d and answer the given questions:
d={‘Name’:’Vishnu’,’Class’:’XI’,Section:’B’}
a) Write a statement to insert an element with a key Building and value as
senior.
b) Change the section of student from B to A.
c) Find the length of dictionary

Write a menu driven python program to input your friend’s names and their phone
numbers and store them in the dictionary as the key – value pair. Perform the following
operations on the dictionary.
i) Display the name and phone number of all your friends.
ii) Add a new friend to the dictionary and display the modified dictionary
iii) Delete a particular friend from the dictionary.
iv) Modify the phone number of an existing friend.
v) Check if a friend is present in the dictionary or not.

a) Write a menu driven python program to create an empty list and do the following.
(i) The program should ask for Number of elements (N) to be appended in the list and
write code to input these N elements and to display these elements.
(ii) The program should ask for the element and the number to be inserted, and insert
the element at the required position.
(iii) The program should ask for the position of the element to be deleted from the list
and delete the element at the desired position in the list. 2
(iv) The program should ask for the value of the element to be deleted from the list and
delete this value from the list

Read the code given below and answer the questions based on the code.
teststr="abcdefghi"
inputstr=input("Enter integer:")

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


47
inputint=int(inputstr)
count=2
newstr=""
while count <= inputint:
newstr=newstr+teststr[0:count]
teststr=teststr[2:] #Line 1
count=count+1
print(newstr) #Line 2
print(teststr) #Line 3
print(count) #Line 4
print(inputint) #Line 5
i. Given the input integer 4, what output is produced by Line 2.
a) abcdefg c) aabbccddeeffgg
b) abcdeefgh d) ghi
ii. Given the input integer 4, what output is produced by Line 3.
a) abcdefg c) aabbccddeeffgg
b) abcdeefgh d) ghi

iii. Given the input integer 4, what output is produced by Line 4.


a) 4 c) 5
b)3 d) 2
iv. Given the input integer 4, what output is produced by Line 5.
a)4 c) 5
b) 3 d) 2
v. Which statement is equivalent to the statement found in Line 1?
a) teststr=teststr[2:0] c) teststr=teststr[2:-1]
b) teststr=teststr[2:-] d) teststr=teststr – 2
e) None of these

Write a program to accept n number of elements and add them into a list. Find the maximum
and minimum values and print them.

Find the output of the following code fragments.


a) T=tuple()
T=T+("Python")
print(len(T))
T=T+(1,2,3)
print(len(T))
b) L=[25,8,75,12]
for i in range(4):
if L[i]%5==0:
L[i]//=5
if L[i]%3==0:
L[i]//=3
for i in L:
print(i,end="&")
c) A,B,C,D=5,6,7,8
A,B,C,D=D,C,B,A
A,B,C,D=D*2,C*C,B+1,A+1
print("A,B,C,D=",A,B,C,D)

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


48
d) for x in range(6):
if x==3 or x==6:
continue
print(x,end=" ")

Write a program to calculate the electricity bill based on the number of electricity units
consumed as per the following conditions.
UNITS CHARGES

Rs. 2 per unit


UPTO 100
Rs. 200 + Rs. 3.5 per unit for
101 – 200
units exceeding 100

Rs. 550 + Rs. 7.5 per unit for


201 -300
units exceeding 200
Rs. 1300 + Rs. 9 per unit for units
301 & above
exceeding 300

Prutha is class 11 student. She is learning python. She wants to display the
only the last two digits of a number. She has written the partial code as
following:
n=__________ #Statement 1
ld1= __________ #Statement 2
n= ________ #Statement 3 Remove the first last digit of a number
ld2=n%10
print(“Last Digit 1:”,__________, “Last Digit 2”,________) #Statement 4

a) Statement 1 – Input n as integer


b) Statement 2 – Get the last digit by modulo division of number by 10
c) Statement 3 – Get new number by removing last digit using floor
division by 10
d) Statement 4 – Print the last digit 1 and last digit 2

Website: www.fiitjeeglobalschool.com | Phone Number: 76 658 65 876 Page |


49

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy