0% found this document useful (0 votes)
3 views

Collections and Arrays Worksheets

This worksheet for Class 8 focuses on understanding arrays in Python, covering fill-in-the-blank questions, multiple-choice questions, and programming tasks. Key concepts include methods for adding, removing, and sorting elements in arrays, as well as checking for element existence. The programming section requires students to implement sorting, value checking, and element removal using Python code.

Uploaded by

vaibhavsinghh24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Collections and Arrays Worksheets

This worksheet for Class 8 focuses on understanding arrays in Python, covering fill-in-the-blank questions, multiple-choice questions, and programming tasks. Key concepts include methods for adding, removing, and sorting elements in arrays, as well as checking for element existence. The programming section requires students to implement sorting, value checking, and element removal using Python code.

Uploaded by

vaibhavsinghh24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CLASS 8

CHAPTER – 6
UNDERSTANDING ARRAYS
WORKSHEET

Part A: Fill in the Blanks

1. The __________ method is used to remove the last element from an array in Python.
2. To find the position of an element in an array, you can use the __________ method.
3. The __________ function returns a new array that is a sorted version of the original
array, without modifying it.
4. To check if an element exists in an array, you can use the __________ operator.
5. The __________ sort is a simple comparison-based sorting algorithm that repeatedly
steps through the list, compares adjacent elements, and swaps them if they are in the
wrong order.

Part B: Multiple-Choice Questions (MCQs)


1. Which of the following is used to add an element to the end of an array in Python?
a) append() c) insert()
b) add() d) extend()
2. What is the output of the following code?
arr = [5, 2, 9, 1]
arr.sort()
print(arr)
a) [5, 2, 9, 1] c) [9, 5, 2, 1]
b) [1, 2, 5, 9] d) [1, 9, 5, 2]
3. Which of the following methods would you use to remove an element at a specific
index in an array?
a) remove() c) pop()
b) delete() d) discard()

4. Given the array arr = [3, 6, 8, 12], what will arr.index(8) return?
a) 1 c) 3
b) 2 d) Error
5. In Python, the ‘in’ operator is used to __________.
a) Insert an element in the array
b) Check if an element exists in the array
c) Sort the array
d) Remove an element from the array
Part C: Programming Questions
1. Sorting an Array:
Write a Python program to sort the array [45, 12, 89, 33, 7] in ascending order.
arr = [45, 12, 89, 33, 7]
___________________
print(arr)

2. Check if Value is Present:


Write a Python program to check if the value 15 is present in the array [10, 15, 20, 25,
30]. If present, print its index.
arr = [10, 15, 20, 25, 30]
_________________

3. Remove an Element Using pop():


Write a Python program to remove the last element from the array [7, 14, 21, 28, 35]
using the pop() method.
arr = [7, 14, 21, 28, 35]
___________________
print(arr)

4. Find the Index of an Element:


Write a Python program to find the index of the value 25 in the array [5, 10, 15, 20,
25, 30, 35].
arr = [5, 10, 15, 20, 25, 30, 35]
_______________

You might also like