C Programs Tutorials | IT Developer
IT Developer

Java Programs - Solved 2019 Theory Paper ISC Computer Science



Share with a Friend

Solved 2019 Theory Paper ISC Computer Science

Class 12 - ISC Computer Science Solved Theory Papers

Linked List and Binary Tree Program - ISC 2019 Theory

  1. 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 find and display the sum of even integers from an existing linked list.

    The method declaration is as follows:
    void sumEvenNode(Node str)

    void sumEvenNode(Node str){ int sum = 0; if(str == null) System.out.println("Sum = 0"); else{ while(str != null){ if(str.num % 2 == 0) sum += str.num; str = str.next; } System.out.println("Sum = " + sum); }

  2. Answer the following questions from the diagram of a binary tree given below:
  1. Write the pre-order traversal of the above tree structure.
    A –> E –> G –> I –> C –> H –> B –> D –> F

  2. State the size of the tree.
    The size of the tree is 4.

  3. Name the siblings of the nodes E and G.
    Sibling of E is B.
    Sibling of G is C.