+1 and +2 Computer Science

Previous Question paper answered , and Questions from Textbook

+1 and +2 Computer Application

Previous Question paper answered , and Questions from Textbook

Diploma in Computer Application (DCA)

Previous Question paper answered , and Questions from Textbook.

Master of Computer Applications (MCA)

Previous Question paper answered , and Questions from Textbook

True IQ Computer Online Academy

Contact : +91 9036433020 , mail2trueiq@gmail.com

Pageviews

Showing posts with label Data Structures and Operators. Show all posts
Showing posts with label Data Structures and Operators. Show all posts

Tuesday, 28 July 2020

+2].3 - Data Structures and Operations Solved Questions from textbook



                                 PLUS TWO  COMPUTER SCIENCE

                                            Chapter 3. Data Structures and Operations

                           (+2. Computer Science Questions and answers from text book)





 1. Define  data structure?

     Data structure is a particular way of organising logically related data items which can be processed as a single unit.Depending upon memory allocation, data structures may be classified as static data structures and dynamic data structures. Memory allocation is fixed for static data structures (eg: arrays) and the size cannot be changed during execution. Memory is allocated during execution for dynamic data structures (eg: linked list) and the size changes according to the addition or deletion of data items.

 2. Stack  follows    ------------- principal for organising data.

     Ans. LIFO

3.  Name the data structure that follows FIFO principal.

     Ans. Queue.

4.  What  is meant by underflow?

      If we try to delete an item from an empty stack, an unfavourable situation arises, known as stack underflow. If we attempt a deletion from an empty queue, underflow occurs.

                            Implementing the Stack Data Structure in Javascript - DEV Difference between Stack and Queue Data Structures - GeeksforGeeks

5.  Which element of  stack  can be deleted first or last.

    Ans. First

 6. Name an example for dynamic data structure.

     Ans. Linked list

  7. What is linked list?

         Linked list is a collection of nodes, where each node consists of two parts – a data and a link. Link is a pointer to the next node in the list. The address of the first node is stored in a special pointer called START. Linked list is a dynamic data structure. Memory is allocated during run time. So there is no problem of overflow. It grows as and when new data items are added, and shrinks whenever any data is removed. Linked list is created with the help of self referential structures.

   8. A node of linked list consists of ------------- and -------------.

      Ans. Data and Link

    9. Which is the  facility of programming language used to define the node of a linked list?

      Ans. Pointer

    10. What is the content of Start and Header of a linked list.

         Ans. Start or Header is the address of the content of the first node.

11.    What are the application of queue?

          Serving requests on a single shared resource, like a printer, CPU task scheduling etc. In real life scenario, Call Center phone systems uses Queues to hold people calling them in an order, until a service representative is free. Handling of interrupts in real-time systems.

12. What is traversing?
   
           Traversing is an operation in which each element of a data structure is visited.

13. What is merging?

     Merging is the process of combining elements of two sorted data structures to form a new one.

14. What is meant by Stack overflow?

           It is the process of inserting a new data item into the stack at Top position. Once the stack is full and if we attempt to insert an item, an impossible situation arises, known as stack overflow.

15. Explain the classification of compound data structures?

       compound data structure divided into two types

 a) Linear Data Structure and b) Non Linear Data Structure.

                               Difference between Linear and Non-linear Data Structure (with ...

   A Linear data structure have data elements arranged in sequential manner and each member element is connected to its previous and next element. ... Such data structures are easy to implement as computer memory is also sequential. Examples of linear data structures are List, Queue, Stack, Array etc.

Non-linear Data Structure: Data structures where data elements are not arranged sequentially or linearly are called non-linear data structures. In a non-linear data structure, single level is not involved.

16. Different type of linked list?

           Singly Linked List

It is the most common. Each node has data and a pointer to the next node.
 
 singly linked list

Doubly Linked List

We add a pointer to the previous node in a doubly-linked list. Thus, we can go in either direction: forward or backward.
doubly linked list

Circular Linked List

A circular linked list is a variation of a linked list in which the last element is linked to the first element. This forms a circular loop.




+2].3-Data Structures and Operators Previous Questions Chapter wise


                             PLUS TWO  COMPUTER SCIENCE


                    Second Year Computer Science Previous Questions Chapter wise ..

                                                  Chapter 2.Data Structures and Operators

                                       






1. Attempting to insert in an already full stack leads to _________


   Ans. Overflow

2. Explain how push operation is done in a stack. 

      Push Operation is the process of inserting a new data item into the stack at Top position. Once the stack is full and if we attempt to insert an item, an impossible situation arises, known as stack overflow

3. Linked list usually do not have the problem of overflow. Discuss. 

           Linked list is a dynamic data structure.It grows as when new data are added in the list and shrinks whenever new data is removed from the list.The memory allocation takesplace during the execution time just when new item inserted in the list.So linked list do not face over.

4. Write two advantages of linked list over arrays. 

         The principal benefit of a linked list over a conventional array is that the list elements can be easily inserted or removed without reallocation or reorganization of the entire structure because the data items need not be stored contiguously in memory or on disk, while restructuring an array at run-time is a much more .

5. Consider the following cases:

 (i) Paper cups are arranged on a dining table one above the other.

 (ii) Many people are waiting in a row to tickets for a cinema. Identify and compare the data structures that you know in connection with the above mentioned contexts. 

6. Queue follows the _______ principle. 

    Ans. FIFO

7. How does stack overflow and underflow occur? 

        Once the stack is full and if we attempt to insert an item, an impossible situation arises, known as stack overflow. Pop Operation is the process of deleting an element from the top of a stack. If we try to delete an item from an empty stack, an unfavorable situation arises, known as stack underflow.

 8. Write a procedure to implement traversal operation in a linked list. 

          Step 1: Get the address of the first node from START and store it in Temp.

        Step 2: Using the address in Temp, get the data of the first node and store in Val. 

        Step 3: Also get the content of the link part of this node (i.e., the address of the next node) and store it in Temp.

  Step 4: If the content of Temp is not NULL, go to step 2; 

    otherwise stop

 9. Name the data structure that follows LIFO principle.

 (a) stack (b) queue (c) array (d) linked list 

      Ans. a

 10. Write an algorithm to perform insertion operation in a Queue. 


          Algorithm for Insertion: 

Assume that Q[N] is an array of queue with size N and FRONT and REAR denote the front and rear positions of the queue.
 Let VAL contains the data to be added into the queue.

      Start

  1: If (REAR == -1) Then //Empty status checking

          2: FRONT = REAR = 0 

          3: Q[REAR] = VAL 

          4: Else If (REAR < N-1) Then //Space availability checking

          5: REAR = REAR + 1

         6: Q[REAR] = VAL 

         7: Else 

         8: Print "Queue Overflow "

         9: End of If

            Stop 


11. Name the data structure where memory  allocation is done only at the time of  execution.

      Ans. Dynamic data structure.

12. Write an algorithm to add a new item in to the stack?

            Assume that STACK[N] is an array of stack with size N and TOS denotes the top position of the stack. Let VAL contains the data to be added into the stack. 

       Start

1: If (TOS < N-1) Then //Space availability checking (Overflow)

        2: TOS = TOS + 1 

      3: STACK[TOS] = VAL 

        4: Else 

       5: Print "Stack Overflow "

       6: End of If

         Stop