Prashnikaप्रश्निका
Code
About
Computer ScienceClass 12

Data structures - ISC Class 12 Computer Science Questions with Answers, Page 5

87 past-paper questions on Data structures from ISC Class 12 Computer Science papers (2026-2017), newest first, in full. Questions 81-87 are on this page, 20 to a page. Tap "Show answer" under a question to see its answer. The syllabus covers Stack, Queue, Circular queue, Dequeue, Conversion of Infix to Prefix and Postfix, Single linked list, Binary trees and Tree traversals.

87questions
9years
2026newest
20181 question
1 mark · Short answerOpen: List the leaf nodes of the tree.

Answer the following questions from the binary tree.

List the leaf nodes of the tree.
Figure for this question
Show answer

Answer

Checked answer.
The leaf nodes (nodes with no children) are $G, H$ and $F$.
20176 questions
1 mark · Binary treeOpen: Write the postorder traversal of the above tree structure.

Answer the following questions from the binary tree.

Write the postorder traversal of the above tree structure.
Show answer

Answer

W F Y N R Z D G M Postorder (left, right, root): left subtree of M is N with W, then Y (with its left child F): W F Y N; right subtree G with Z (right child R), then D: R Z D G; then the root M.
1 mark · Binary treeOpen: State the level numbers of the nodes N and R if the root is at 0 (zero) level.

Answer the following questions from the binary tree.

State the level numbers of the nodes N and R if the root is at 0 (zero) level.
Show answer

Answer

Level of N = 1 and level of R = 3. Root M is at level 0; N is a child of M (level 1); R is a child of Z, which is a child of G, a child of M (M 0, G 1, Z 2, R 3).
5 marks · ProgramOpen: Queue is an entity which can hold a maximum of 100 integers. The queue enables…

Write the program described below.

Queue is an entity which can hold a maximum of 100 integers. The queue enables the user to add integers from the rear and remove integers from the front. Define a class Queue with the following details: Class name : Queue Data Members / instance variables: Que[ ] : array to hold the integer elements size : stores the size of the array front : to point the index of the front rear : to point the index of the rear Member functions: Queue (int mm) : constructor to initialize the data size = mm, front = 0, rear = 0 void addele(int v ) : to add integer from the rear if possible else display the message “Overflow” int delele( ) : returns elements from front if present, otherwise displays the message “Underflow” and return -9999 void display ( ) : displays the array elements Specify the class Queue giving details of ONLY the functions void addele(int) and int delele( ). Assume that the other functions have been defined. The main function and algorithm need NOT be written.
Show answer

Answer

void addele(int v)
{
    if (rear == size)
        System.out.println("Overflow");
    else
    {
        Que[rear] = v;
        rear++;
    }
}

int delele()
{
    if (front == rear)
    {
        System.out.println("Underflow");
        return -9999;
    }
    else
    {
        int v = Que[front];
        front++;
        return v;
    }
}
Explanation: elements are added at the rear and removed from the front. The queue is full when rear == size (Overflow) and empty when front == rear (Underflow, returning -9999). Tested by running with a queue of size 3: adding a 4th element printed Overflow, deleting 10, 20, 30 worked and a 4th delete printed Underflow and returned -9999.
1 mark · Binary treeOpen: List the internal nodes of the right sub-tree.

Answer the following questions from the binary tree.

List the internal nodes of the right sub-tree.
Show answer

Answer

G, Z The right sub-tree has root G with nodes Z, D and R. Internal (non-leaf) nodes are those with at least one child: G and Z. D and R are leaf nodes.
2 marks · ProgramOpen: A linked list is formed from the objects of the class Node. The class structure…

Write the program described below.

A linked list is formed from the objects of the class Node. The class structure of the Node is given below:
class Node
{
    int num;
    Node next;
}
Write an Algorithm OR a Method to count the nodes that contain only odd integers from an existing linked list and returns the count. The method declaration is as follows:
int CountOdd( Node startPtr )
Show answer

Answer

int CountOdd(Node startPtr)
{
    int count = 0;
    Node ptr = startPtr;
    while (ptr != null)
    {
        if (ptr.num % 2 != 0)
            count++;
        ptr = ptr.next;
    }
    return count;
}
Explanation: start at the first node, visit every node until ptr becomes null, add 1 to count whenever the value of num is odd (num % 2 != 0, which also works for negative numbers) and finally return count. Tested by running: the list 5, 8, -3, 12, 7 gives 3 and an empty list gives 0.

About Data structures

Data structures is a unit of the ISC Class 12 Computer Science syllabus.

The syllabus lists these topics: Stack, Queue, Circular queue, Dequeue, Conversion of Infix to Prefix and Postfix, Single linked list, Binary trees and Tree traversals.

Prashnika has 87 past-paper questions on Data structures, from papers of 2017-2026, asked in 9 different years. By kind: Binary tree (19), Program (19), Case based (15) and Short answer (13). They carry between 1 and 5 marks, and most are worth 2 marks.

To practise, use the Infix to postfix converter, the Binary tree and BST tool and the paper generator, which can build a practice paper from this chapter.

Common questions

What topics are in Data structures in ISC Class 12 Computer Science?

The syllabus lists Stack, Queue, Circular queue, Dequeue, Conversion of Infix to Prefix and Postfix, Single linked list, Binary trees and Tree traversals.

How many questions on Data structures are in ISC Class 12 Computer Science past papers?

Prashnika has 87 questions on Data structures, from papers of 2017-2026 (board, specimen, improvement and practice papers together).

What kinds of questions are asked on Data structures?

By kind: Binary tree (19), Program (19), Case based (15) and Short answer (13).

Questions on other pages on Data structures