Plus Two Computer Science Chapter Wise Previous Questions Chapter 3 Data Structures and Operations

Kerala State Board New Syllabus Plus Two Computer Science Chapter Wise Previous Questions and Answers Chapter 3 Data Structures and Operations.

Kerala Plus Two Computer Science Chapter Wise Previous Questions and Answers Chapter 3 Data Structures and Operations

Question 1.
Attempting to insert in an already full stack leads to _________ [March – 2016] (1)
Answer:
Overflow

Question 2.
Explain how to push operation is done in a stack. [March – 2016] (2)
Answer:
It is the process of inserting(adding) a new data item I into the stack. If the stack is full and we try to add a new item into the stack makes the stack over flow. The algorithm is given below
Step 1 : If top = N. Then print “OVERFLOW” and return
Step 2 : Set top =top+1
Step 3 : Set Stack[top]= item
Step 4 : stop

Question 3.
Linked lists usually do not have the problem of overflow, Discuss. [March – 2016] (2)
Answer:
1) Linked list is a dynamic data structure
2) Size is not fixed in advance
3) Itcangroworshrinkduringruntime
4) Dynamic memory allocation hence any number of nodes can be added during run time.

Question 4.
Write two advantages of linked list data structure over arrays. [MAY – 2016] (2)
Answer:
The linked list follows the dynamic data structure method. It grows and shrinks as and when the new items are added and removed respectively. Not only that an array requires contiguous memory but a linked list not require contiguous memory rather it uses scattered memory and they linked by pointers. So an element in a linked list consists of data and an address it is called a node. Here address is the link.

Question 5.
Consider the following cases:
1) Paper cups are arranged on a dining table one above the other.
2) Many people are waiting in a row to take tickets fora the cinema.
Identify and compare the data structure that you know in connection with the above-mentioned contexts. [MAY – 2016] (3)
Answer:
1) Stack
2) Queue
A stack is a linear data structure in which items – can be added or removed only at one end called top. But the working principle of the queue is first in first out manner. A new item is added at the rear and removed from the front of a queue.

Question 6.
Queue follows the principle. [MARCH – 2017] (1)
Answer:
FIFO(First In First Out).

Question 7.
How does Stack overflow and underflow occur? [MARCH – 2017] (2)
Answer:
Stack Overflow -: If the stack is full and we try to add (push operation) a new item into the stack makes the stack overflow.
Stack Underflow -: If the stack is empty and we try to delete (pop operation) an item from the stack makes the stack underflow.

Question 8.
Write a procedure to implement traversal operation in a linked list. [MARCH – 2017] (2)
Answer:
Traversing a Linked List
It is the processing of reading all elements in a data structure.
Step 1: Get the address of the first node arid store it in the variable Temp.
Step 2 : Using the address in Temp, get and store the data in Val.
Step 3 : The address of the next node store it in Temp.
Step 4 : If the address of Temp is not null go to step 2, otherwise stop.

Plus Two Computer Science Chapter Wise Assess Questions and Answers

Question 1
Read the following statements:
i) A collection of data processed as a single unit.
ii) All data structures are implemented using arrays.
iii) Stacks and queues are logical concepts and implemented using arrays and linked lists.
iv) Overflow occurs in the case of static data structures.

Which of the above statements are true/ Choose the correct options from the following:
a) Statements (i) and (iii) only
b) Statements (i), (ii) and (iii) only
c) Statements (i), (iii) and (iv) only
d) Statements (i), (ii) and (iv) only
Answer:
c) Statements (i),(iii) and (iv) only

Question 2.
Data structures may be static or dynamic.
a) Give two examples for static data structures.
b) Static data structures may face overflow situation. Why?
c) Linked list is a dynamic data structure. Justify this statement.
Answer:
a) Stack and Queue
b) Static data structures such as stack and queue are implemented by array and has the fixed storage capacity. That is these implementations are static. If the stack is full and we try to add a new item into the stack makes the stack over flow.

c) But linked list follows the dynamic data structure method. It grows and shrinks as and when the new items are added and removed respectively. Not only that an array requires contiguous memory but linked list not require contiguous memory rather it uses scattered memory and they linked by pointers. So an element in a linked list consists of data and an address it is called node. Here address is the link.

Question 3.
Write an algorithm to insert an element into a stack.
Answer:
It is the process of inserting(adding) a new data item I into the stack. If the stack is full and we try to add a new item into the stack makes the stack over flow. Algorithm is given below
Step 1 : If top = N. Then print “OVERFLOW” and return
Step 2 : Set top =top+1
Step 3 : Set Stack[top]= item
Step 4 : stop

Question 4
What is meant by push and pop operations?
Answer:
It is the process of inserting(adding) a newdata item into the stack. If the stack is full and we try to add a new item into the stack makes the stack over flow, a. Pop operation

It is the process of deleting(removing) a data item from the stack. If the stack is empty and we try to delete an item from the stack makes the stack underflow.

Question 5.
Write an algorithm to delete an element form a stack.
Answer:
Step 1 : If top = Null. Then print “UNDERFLOW” and return
Step 2 : Set item=Stack[top]
Step 3 : Set top = top -1
Step 4: stop

Question 6.
Write algorithms to perform insertion and deletion operations in linear queues,
Answer:
a) Insertion operation
It is the process of adding a new item into a queue at the rear end.
If the queue is full and we try to add a new item into the queue makes the queue over flow.
Algorithm is given below
Step 1 : If front = 1 and rear=N orfront =rear+1.
Then print “OVERFLOW’ and return

Step 2 : If front = Null then
Set front = 1 and rear =1
Else if rear = N then set rear = 1
Else
Set rear = rear + 1
End if
Step 3: SetQueue[rear]=item
Step 4 : stop

b) Deletion operation
It is the process of deleting (removing) a data item from the queue from the front. If the queu is empty and we try to delete an item from the queue makes the queue underflow.

Algorithm is given below
Step 1 : If front = Null then print “UNDERFLOW and return
Step 2 : Set item = Queue[front]
Step 3: If front = rear then
Set front = Null and rear =Null
Else if front = N then set front =1
Else
Set front = front +1
End if
Step 4 : stop

Question 7.
How does circular queue overcome the limitation of linear queue?
Answer:
As the name implies logically the shape of the circular queue is a shape of a circle. The linear queue has some limitations such as some occasions the capacity of the linear queue cannot be used fully. The limitation of linearqueue can overcome by circular queue. Circular queue is a queue in which the two end points are connected.

Question 8.
Some of the operations performed on data structures are given below:
i) Insertion
ii) Deletion
iii) Searching
iv) Sorting
a) Which of these operations may face underflow situation?
b) Explain this situation in the context of an appropriate data structure.
Answer:
a) ii. deletion
b) a) Searching: Searching is the process of finding elements in a data structure
b) Inserting: It is the process of adding newdata at particular location is called insertion.
c) Deleting-:lt is the process of removing a particular element from the data structure
d) Sorting-: Arranging elements in a particular order(ascending or descending) is called sorting.

Examples are bubble sort and selection sort.

Question 9
Match the following:

A B C
a. Array i. Start 1. Insertion and deletion at different ends
b. Stack ii. Subscript 2. Insertion and deletion at the same end
c. Queue iii. Rear 3. Self-referential structure is utilized
d. Linked list iv. Top 4. Elements are accessed by specifying its position

Answer:
a) – ii – 4
b) – iv – 2
c) – iii – 1
d) – i – 3

Question 10.
Explain why linked lists do not face an overflow situation as in the case of array-based data structures.
Answer:
The linked list follows the dynamic data structure method. It grows and shrinks as and when the new items are added and removed respectively. Not only that an array requires contiguous memory but a linked list not require contiguous memory rather it uses scattered memory and they linked by pointers. So an element in a linked list consists of data and an address it is called a node. Here address is the link.