Python
Python
2. print([2]*10)
LESSON 2
VI. Spot the error in the program and rewrite the program.
1. a1="Test Program"
print(len(a1))
2. A1="PYTHON"
print(A1[2:5])
LESSON 3
VI. Crossword.
Across:
1. This list can have another list as an item. nested
4. It removes an item from the list. remove
7. It adds an element to the end of the list. append
Down:
LESSON 4
LESSON 5
LESSON 6
I. Fill in the blanks.
1. A group of data which can be processed in a single unit is termed as data structure.
2. Data are stored sequentially in a linear data structure.
3. Lists are enclosed in square brackets.
4. Arranging a list in either ascending or descending order is called as sorting a list.
5. A stack data structure follows the Last-in First-Out principle.
6. Operations of stack data structure are pop( ) and append( ).
II. Answer in one line.
1. Give some example for linear data structure.
Arrays, Lists, Stacks, Queues, Linked Lists
2. What are the two types of Data structure?
Linear and Non-Linear
3. Mention the techniques used for sorting.
Selection sort, Bubble sort, Insertion sort
4. What is push and pop?
Push and Pop are the operations used for adding and removing elements.
5. Explain the term ‘top of the stack’.
In stack, insertion and deletion of elements can be done only at one end, which is
called as the top of the stack.
LESSON 7
LESSON 8
a. Python
b. Python is awesome.
c. text is awesome.
d. is awesome.
3. What is the output of the following code?
def greetPerson(*name):
print('Hello', name)
greetPerson('Avril', 'Roger')
a. Hello Avril
Hello Roger
b. Hello ('Avril', 'Roger')
c. Hello Roger
d. Syntax Error! greetPerson() can take only one argument.
4. Which keyword is used for function?
a. func
b. define
c. def
d. function
5. What is the output of the following code?
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4)
a. 3
b. 4
c. 4 is maximum
d. None of the mentioned
LESSON 10
LESSON 11