[Type A] Chapter – 9 Class 12 CS – Sumita Arora Assignment | Q/A

Here is class 12 computer science Unit 9 [Type A] solutions for Sumita Arora back exercise assignment. Below includes both textual and video solutions wherever required. View all the answers in assignment for chapter 9 and for all chapters here.

Watch all video tutorials for chapter 9: Data Structures – 1 Linear Lists.

Q1: What are the data structures?  Name some common structures.

Data is the most fundamental element in the processing segment of the computer.
Data Structure deals with the arrangement and organization of the data in the memory so that better storage with minimum memory size can be achieved.

Some common structure are :-
1. Simple Data Structure (Array, Linear List)
2. Compound Data Structure (Link list, Queue, Stack)

Q2: Is data structure related to a data type? Explain.

Data type defines as the set of value along with well-defined operations on these to values. Such as float, integer and multiplication as operation on that.

Data Structure is the physical implementation that clearly defines the manipulation, storage, accessing and many more. Such as stack, queue and insertion, deletion are the operation on these.

Q3: What do you understand by linear and non-linear data structure?

Linear data structure are the single level implementation of non-linear data structure. In this all the element from a sequence.
Example Stack, queue, Link list.

Non-linear data structure are the multi level implementation of non-linear data structure. In this no type of sequence in formed.
Example Tree, Graph.

Q4: Name some linear data structures.  Is linked list a linear data structure?

Some Linear Data structure are :-
1. Stack
2. Queue etc.

Yes, link list is a linear data structure as in this all the elements are arranged in linear locations of memory and same level of arrangement.

Q5: What is the working principle of data structures stack and queues?

Stack works on the principle of LIFO i.e. last in first out. In this insertion and deletion happens to be on same side refers as top.

Queue works on the principle of FIFO i.e. first in first out. In this insertion rear end and deletion on front end that is opposite side to each other.

Q6: What is a linear list data structure?  Name some operations that you can perform on linear lists.

Linear data structure are the single level implementation of non-linear data structure. In this all the element from a sequence. In this linear memory location is applied on data storage.
Example Stack, queue, Link list.

Some operations on linear lists are:
1. Insertion
2. Traversing
3. Deletion
4. Updating
5. Sorting etc.

Q7: Suggested situations where you can use these data structures. (i) Linear lists. (ii) queues.

(i) Linear lists :- Storage of unique id of employee of a company.
(ii) queue :- CPU scheduling, Disk Scheduling, appointment list i.e. FIFO implementation.

Q8: What is a list comprehension?  How is it useful?

List comprehensions are used for creating new lists. As list comprehensions returns lists, they consist of brackets containing the expression, which is executed for each element along with the for loop to iterate over each element.

It is useful to extract information from an existing list through iteration.
Example [i*2 for in range(10)]

Q9: Enlist some advantages of list comprehensions.

Some advantages of list comprehensions :-
Code Reduction : In this code of more than 3 line can be reduced into single line.
Faster code processing : In this code execution is faster than loop and map function.

Q10: In which situations should you use list comprehensions and in which situations you should not use list comprehensions?

List comprehensions should always be used when there is need to reduce the code size, increase readability and to enhance performance.
List comprehensions should always be avoided when there are multiple cases and structure of code is complex.

Q11: What is a nested list?  Give some examples.

Nested list is the case when a main list having several lists as constituents of main list.

L1 = [1, 2, 3, [11, 12, 13], 7, [20], [15,14], 10]
In above case [11, 12, 13], [15,14] is forming nesting of list to L1.
Q12: What is a two-dimensional list?  How is it related to nested lists?

A two dimension list is in which each element is another list and it forms a table like configuration which having rows and columns.
example L1 = [[12, 34, 43], [1, 2, 3], [4, 5, 6]]

All the two dimension list is a nested list as it satisfy condition of nesting.

Q13: Suggest a situation where you can use a regular two-dimensional list.
A two dimension list can be used to implement marks of student in various terms 
Abhinav = [[95, 90, 87, 76, 90],
           [60, 96, 92, 93, 90],
           [78, 67, 87, 88, 80],
           [45, 95, 90, 89, 88]]
Q14: What are the ragged lists? How are these different from two-dimensional lists?

A ragged list is irregular 2D list where each nested list of different shape while a two-dimensional list having same shape of nested loop.

ragged_list = [[95, 90, 87], [60, 96, 92], [78, 67, 87]]
2D_list = [[95, 90, 87], [60, 92], [78]]

Q15: Suggest a situation where you can use ragged list?

Ragged list can be used to store list of students in different classes.

Q16: How are lists internally stored?  How are 2D lists internally stored?

List are stored in the sample manner as the string stores. Not like string each character but each element of list is given a specific location to access.

But in case of the 2D list as each element of list may be variable in size hence a reference is given to each element unlikely that of list.

Q17: Consider the following code and show how internally the memory is assigned to these

List 1 = (2, 3)
List 2 = (3, 4, 5)
List 3 = (List 1, List 2)

Assume that the numbers 1.10 are stored in the memory addresses 16000 onwards, each consuming 16 bytes of memory.
addressbase address or 012
List 123
List 2345
This is the arrangement of both list internally

List 3 will have two elements in which first will be reference to location of List 1 and second will be at List 2.

Clear Doubts with Computer Tutor
In case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in

You cannot copy content of this page