Computer Science - Informatics Practices Class XI/XII Python List Solved Test Part 1

 

Computer Science - Informatics Practices Class XI/XII Python List Solved Test  Part 1

Q1. What do you mean by List in Python?

Q2. The elements in the list can be of ______ type

   (any/fixed)

Q3. Elements in the list are enclosed in _____ brackets

Q4. Values in the list are called _______.

Q5. Lists are ________ in nature (heterogeneous/homogeneous)

Q6. List is a _________ data type. (Linear/non-linear)

Q7. Elements in the list are separated by ______.

Q8. Write the code to create an empty list named ‘L’.

Q9. Write a code to create list of any three colors named

   ‘color’.

Q10. What do you mean by nested list


 

 

SOLUTIONS

Q1. What do you mean by List in Python?

Ans. A list is a data structure which is mutable and 

    ordered sequence of elements.

Q2. The elements in the list can be of ______ type

   (any/fixed)

Ans. any

Q3. Elements in the list are enclosed in _____ brackets

Ans. Square([])

Q4. Values in the list are called _______.

Ans. Item

Q5. Lists are ________ in nature (heterogeneous/homogeneous)

Ans. Heterogeneous

Q6. List is a _________ data type. (Linear/non-linear)

Ans. Linear

Q7. Elements in the list are separated by ______.

Ans. Comma (,)

Q8. Write the code to create an empty list named ‘L’.

Ans. L = []

Q9. Write a code to create list of any three colors named 

   ‘color’.

Ans. color = ["blue", "black", "red"]

Note : You can write any other color of your choice

Q10. What do you mean by nested list

Ans. A list inside another list is called nested list.

 

Class XII : Data Structure Test 1

 

Data Structure Test 1

Q1. What do you mean by data structure?

Q2. Name any one linear data structure in python.

Q3. Python list are ______________ in Nature (static/dynamic)

Q4. “Lists are dynamic in nature” What do you mean by this statement?

Q5. What do you mean by Stack?

Q6. Name the end where we add or remove element in stack.

Q7. What is the full form of LIFO?

Q8. Give two example of stack from daily life.

Q9. Name two operations performed in stack.

Q10. What is the order of inserting elements in the following stack?

 

 

 

Ans 1. A data structure is a way of storing, organizing and retrieving data in a computer.

Ans 2. List

Ans 3. Dynamic

Ans 4. This means that list can be grown or shrink in size means elements can be deleted or added in list.

Ans 5. A stack is a linear data structure where elements can be inserted or deleted at one end.

Ans 6. Top

Ans 7. Last in First Out

Ans 8. A pile of book, a stack of carom coins etc.

Ans 9. Push and Pop

Ans 10. Order is: A, B, C, D

 

Python : Nested Loop Test 1

 

Python Nested Loop Test-1

Q1. Write a program to print the following pattern.

S. No

Pattern

Code

1.

1

1 1

1 1 1

1 1 1 1

1 1 1 1 1

 

 

2.

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

 

 

3.

1

2 2

3 3 3

4 4 4 4

5 5 5 5 5

 

 

4.

5

4 4

3 3 3

2 2 2 2

1 1 1 1 1

 

 

5.

5

5 4

5 4 3

5 4 3 2

5 4 3 2 1

 

 

6.

1

2 3

3 4 5

4 5 6 7

5 6 7 8 9

 

 

7.

1

2 1

3 2 1

4 3 2 1

5 4 3 2 1

 

 

8.

*

* *

* * *

* * * *

* * * * *

 

 

 

 

Solutions :

S. No

Pattern

Code

1.

1

1 1

1 1 1

1 1 1 1

1 1 1 1 1

 

2.

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

 

3.

1

2 2

3 3 3

4 4 4 4

5 5 5 5 5

 

4.

5

4 4

3 3 3

2 2 2 2

1 1 1 1 1

 

5.

5

5 4

5 4 3

5 4 3 2

5 4 3 2 1

 

6.

1

2 3

3 4 5

4 5 6 7

5 6 7 8 9

 

7.

1

2 1

3 2 1

4 3 2 1

5 4 3 2 1

 

8.

*

* *

* * *

* * * *

* * * * *

 

Most Recently Published

File Handling Test 6

 File Handling Test 6 Q1 . Do we need to use the close() function when we use 'with' statement to open a file? Q2. Which mode you wi...

CS - IP Assignment/Worksheet