0% found this document useful (0 votes)
15 views3 pages

ACFrOgCd6AwGF4cFniVjusfGiGn_XCyQwNoDXCnucMOhkvo_BN11wovR8LHUcemYotWSxaZ38DxPDk8KNS_xBxPuesaE_f4SoWECFQ7G-qC_DcOZxQivukZbfmGH8S-MpIEkY6GLDY_aDVEJR_m8bfG_MvP4jEu-5gYD1RydMoFFcrvPM3MwXVhR5vwAznrLNVmfculV0Hdz-9N-_pNN

The document is an assignment for Computer Science XI focusing on lists, divided into four sections: true or false statements, assertion and reasoning, multiple choice questions, and programming tasks. It includes questions on list properties, functions, and coding exercises to manipulate lists. The assignment aims to assess students' understanding of lists in Python.

Uploaded by

rupesh y
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)
15 views3 pages

ACFrOgCd6AwGF4cFniVjusfGiGn_XCyQwNoDXCnucMOhkvo_BN11wovR8LHUcemYotWSxaZ38DxPDk8KNS_xBxPuesaE_f4SoWECFQ7G-qC_DcOZxQivukZbfmGH8S-MpIEkY6GLDY_aDVEJR_m8bfG_MvP4jEu-5gYD1RydMoFFcrvPM3MwXVhR5vwAznrLNVmfculV0Hdz-9N-_pNN

The document is an assignment for Computer Science XI focusing on lists, divided into four sections: true or false statements, assertion and reasoning, multiple choice questions, and programming tasks. It includes questions on list properties, functions, and coding exercises to manipulate lists. The assignment aims to assess students' understanding of lists in Python.

Uploaded by

rupesh y
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/ 3

ASSIGNMENT-1

MONTH: NOVEMBER
COMPUTER SCIENCE-XI
LISTS

SECTION A : 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

SECTION B : ASSERTION & REASONING


a) Both Assertion and Reasoning are correct.
b) Assertion is correct, but Reasoning is incorrect.
c) Assertion is incorrect, but Reasoning is correct.
d) Both Assertion and Reasoning are incorrect.

1. A: list is mutable data Type


R: We can insert and delete as many elements from list

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: list() is used to convert string in to list element


R: string will be passed into list() it will be converted into list elements

5. A: pop() can delete elements from the last index of list


R: this function can remove elements from the last index only.

SECTION C : MCQ QUESTIONS


1. What will be the output of the following code?

list1 = [1, 2, 3]
list2 = list1 * 2
print(list2)

a) [1, 2, 3, 1, 2, 3]
b) [2, 4, 6]
c) [1, 2, 3, 2, 4, 6]
d) Error

2. What is the output of the following code?


my_list = [1, 2, 3, 4]
my_list.append([5, 6])
print(len(my_list))
a) 4
b) 5
c) 6
d) 7
3. Given the code below, what will print(a) output?

a = [1, 2, [3, 4]]


a[2].append(5)
a) [1, 2, [3, 4]]
b) [1, 2, [3, 4, 5]]
c) [1, 2, 5]
d) [1, 2, 3, 4, 5]

4. What will the output of the following code be?


my_list = [0, 1, 2, 3, 4, 5]
print(my_list[::2])
a) [0, 1, 2, 3, 4, 5]
b) [1, 3, 5]
c) [0, 2, 4]
d) [0, 2, 4, 6]

5. What does the following code snippet do?


list1 = [1, 2, 3]
list2 = list1.copy()
list2.append(4)
print(list1, list2)
a) [1, 2, 3] [1, 2, 3, 4]
b) [1, 2, 3, 4] [1, 2, 3, 4]
c) [1, 2, 3] [1, 2, 3]
d) Error

6. What will be the output of the following code?


nums = [1, 2, 3]
nums.insert(1, [4, 5])
print(nums)
a) [1, 4, 5, 2, 3]
b) [1, 2, 4, 5, 3]
c) [1, [4, 5], 2, 3]
d) [4, 5, 1, 2, 3]

7. What will the following code return?


a = [1, 2, 3, 4, 5]
b = a[::-1]
b[0] = 10
print(a, b)
a) [1, 2, 3, 4, 5] [10, 4, 3, 2, 1]
b) [10, 2, 3, 4, 5] [10, 4, 3, 2, 1]
c) [1, 2, 3, 4, 5] [1, 2, 3, 4, 5]
d) [1, 2, 3, 4, 5] [5, 4, 3, 2, 10]

8. What will be the output of the following code?


my_list = [1, 2, 3]
my_list += [4, 5]
print(my_list)
a) [1, 2, 3, 4, 5]
b) [1, 2, 3, [4, 5]]
c) Error
d) [4, 5, 1, 2, 3]

9. What does the following code do?


a = [1, 2, 3]
a[1:2] = [4, 5]
print(a)

a) [1, 2, 3]
b) [1, 4, 5, 3]
c) [1, 4, 5]
d) [1, 2, 3, 4, 5]

10. What will the output be for this code?

list1 = [1, 2, 3]
list2 = [4, 5, 6]
combined = list1 + list2
print(combined)

a) [1, 2, 3, 4, 5, 6]
b) [4, 5, 6, 1, 2, 3]
c) [1, 4, 2, 5, 3, 6]
d) Error

SECTION D: PROGRAMMING QUESTIONS


a) Write a program to find out the greatest number in the list.
b) Write a program to accept the list elements from the users (all must be numbers).Increase
the number by 5 if that number is even and decrease by 2 if the number is odd.
c) Write a program to search an element in the list and print its position

You might also like