0% found this document useful (0 votes)
13 views57 pages

CS Bridge Course

computer science 11th class revision course
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)
13 views57 pages

CS Bridge Course

computer science 11th class revision course
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/ 57

1.

3.

4.
11.

12.
a)
b)
c)
d)

13.

14.

15.
1.

2.

3.

4.

5.

11.
12.
e)
f)
g)
h)

13.

14.

15.

6.
7.
8.
6-
1- What will be printed by the following code when it executes?
1. Which of the following is a Python tuple?
i. [1, 2, 3] ii. (1, 2, 3) iii. {1, 2, 3} iv. { }

2. Jyoti wants to add a new tuple t2 to the tuple t1, which statement she should use-
i. sum(t1,t2) ii. T1.add(t2) iii. t1+t2 iv. None of these

3. Which of the following is correct to insert a single element in a tuple-


i. T=4 ii. T=(4) iii. T(4,) iv. T=[4,]

i. List() ii tuple() iii TUPLE iv. tup()

5 function returns the number of elements in the tuple-


i. len( ) ii. max( ) iii. min( ) iv. count( )

6. To display the last element of the tuple, which statement should be used-
i>>> t.display() ii>>>t.pop() iii>>>t[-1] iv>>>t.last()

Output Based Questions-


Consider the following tuples, tuple1 and tuple2:

tuple1 = (25, 10, 45, 67, 55, 9, 55, 45)


tuple2 = (10, 20)

Find the output of the following statements:

i. print(tuple1.index(9)) ii. print(tuple1.count(55))


iii. print(tuple1 + tuple2) iv. print(len(tuple2))
v. print(max(tuple1)) vi. print(min(tuple1))

Programs based on Tuples-


Q1. Write a python program to create tuple of 10 integer type elements and find the smallest and
largest elements in this tuple.

1. Which of the following is a Python tuple?


i. [1, 2, 3] ii. (1, 2, 3) iii. {1, 2, 3} iv. { }

2. Jyoti wants to add a new tuple t2 to the tuple t1, which statement she should use-
i. sum(t1,t2) ii. T1.add(t2) iii. t1+t2 iv. None of these
3. Which of the following is correct to insert a single element in a tuple-
i. T=4 ii. T=(4) iii. T(4,) iv. T=[4,]

i. List() ii tuple() iii TUPLE iv. tup()

5.
i. Homogenous ii. Heterogenous iii. both i & ii iv. None of these

function returns the number of elements in the tuple-


i. len( ) ii. max( ) iii. min( ) iv. count( )

7. Rajat wants to delete all the elements from the tuple, which statement he should use to perform this
operation-
i t.clear() ii. del t iii. t.remove() iv. None of these

8. To display the last element of the tuple, which statement should be used-
i>>> t.display() ii>>>t.pop() iii>>>t[-1] iv>>>t.last()

9. Shreya wants to add a new tuple t2 to the tuple t1, which statement she should use
i. sum (t1,t2) ii. t2.add(t1) iii. t1+t2 iv. None of these

10. Which of the following operations is not valid for tuples in Python?
i. Concatenation ii. Indexing iii. Appending iv. Slicing

Answer: 1- ii, 2-iii, 3-iii, 4-ii, 5-iii, 6-i, 7- iv, 8-iii, 9-iii, 10-iii

Output Based Questions-


Consider the following tuples, tuple1 and tuple2:

tuple1 = (25, 10, 45, 67, 55, 9, 55, 45)


tuple2 = (10, 20)

Find the output of the following statements:

i. print(tuple1.index(9)) ii. print(tuple1.count(55))


iii. print(tuple1 + tuple2) iv. print(len(tuple2))
v. print(max(tuple1)) vi. print(min(tuple1))
vii. print(sum(tuple2)) viii. print( sorted ( tuple1 ) )

Programs based on Tuples-


Q1. Write a python program to create tuple of 10 integer type elements and find the smallest and
largest elements in this tuple.
Q2. Write a program to input names of n students and store them in a tuple. Also, input a name from
the user and find if this student is present in the tuple or not.

You might also like