Computer Applications — Sample Question Bank

A free sample: two questions from each of the five most recent solved papers.

2026 Paper

11 Mark · 2026 · Section A · 2026 PaperFull page

The full form of JVM is:

  • (a)Java Visible Machine
  • (b)Java Virtual Mode
  • (c)Java Virtual Machine
  • (d)Java Visible Mode
Show SolutionHide Solution↓

Java Virtual Machine

Reason — JVM stands for Java Virtual Machine, which is responsible for executing Java bytecode and enables Java programs to run on any platform (platform independence).

2Written · 2026 · Section B · 2026 PaperFull page

Define a class named StepTracker with the following specifications:

Member Variables:

  • String name – stores the user's name
  • int sw – stores the total number of steps walked by the user.
  • double cb – stores the estimated calories burned by the user.
  • double km – stores the estimated distance walked in kilometers.

Member Methods:

  • void accept() – to input the name and the steps walked using Scanner class methods only.
  • void calculate() – calculates calories burned and distance in km based on steps walked using the following estimation table:
MetricCalculation Formula
Calories Burnedsteps walked x 0.04 (e.g., 1 step burns 0.04 calories)
Distance (Km)steps walked / 1300 (e.g., 1300 steps is approx. 1 km)
  • void display() – Display the calories burned, distance in km and the user's name.

Write a main method to create an object of the class and invoke the methods.

Show SolutionHide Solution↓
import java.util.Scanner;

class StepTracker
{
    String name;
    int sw;
    double cb, km;

    public void accept()
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter name: ");
        name = sc.nextLine();
        System.out.print("Enter steps walked: ");
        sw = sc.nextInt();
    }

    public void calculate()
    {
        cb = sw * 0.04;
        km = sw / 1300.0;
    }

    public void display()
    {
        System.out.println("Name: " + name);
        System.out.println("Calories Burned: " + cb);
        System.out.println("Distance (km): " + km);
    }

    public static void main(String args[])
    {
        StepTracker obj = new StepTracker();
        obj.accept();
        obj.calculate();
        obj.display();
    }
}
BlueJ output of StepTracker.java

2025 Paper

31 Mark · 2025 · Section A · 2025 PaperFull page

Character class methods are found in the package called:

  • (a)java.util
  • (b)java.lang
  • (c)java.awt
  • (d)java.io
Show SolutionHide Solution↓

java.lang

Reason — The Character class methods are found in the java.lang package because this package contains fundamental classes that are automatically available in every Java program. The Character class provides methods to work with characters, such as checking whether a character is a letter, digit, uppercase, or lowercase.

42 Marks · 2025 · Section A · 2025 PaperFull page

Consider the two-dimensional array P[2][3], of peripherals (input/output devices) given below, state the index of the device Barcode Scanner.

Consider the two-dimensional array P[2][3], of peripherals (input/output devices) given below, state the index of the device Barcode Scanner. ICSE 2025 Computer Applications Solved Question Paper.
  • (a)P[1]
  • (b)P[0]
  • (c)P[1]
  • (d)P[0][0]
Show SolutionHide Solution↓

P[1][1]

Reason — In a two-dimensional array P[2][3], the first index represents the row and the second index represents the column. The device "barcode scanner" is located in the second row (index 1) and the second column (index 1), so its index is P[1][1].

2024 Paper

51 Mark · 2024 · Section A · 2024 PaperFull page

Consider the below picture and choose the correct statement from the following:

Consider the below picture and choose the correct statement. Polygon is the object and the pictures are classes. Both polygon and the pictures are classes. ICSE 2024 Computer Applications Solved Question Paper.
  • (a)Polygon is the object and the pictures are classes
  • (b)Both polygon and the pictures are classes
  • (c)Polygon is the class and the pictures are objects
  • (d)Both polygon and the pictures are objects
Show SolutionHide Solution↓

Polygon is the class and the pictures are objects

Reason — In object-oriented programming (OOP), a class is a blueprint or template that defines the properties and behaviours (methods) of objects. An object is an instance of a class that holds specific data defined by the class.

In this case:

  • Polygon represents the class because it defines the general structure, properties, and methods common to all polygons (e.g., sides, vertices, perimeter calculation).
  • The pictures are specific examples or instances of polygons, such as triangles, parallelogram, or pentagons, making them objects created from the Polygon class.
6Written · 2024 · Section B · 2024 PaperFull page

DTDC a courier company charges for the courier based on the weight of the parcel. Define a class with the following specifications:

Class name: courier

Member variables:

name – name of the customer

weight – weight of the parcel in kilograms

address – address of the recipient

bill – amount to be paid

type – 'D'- domestic, 'I'- international

Member methods:

void accept ( ) — to accept the details using the methods of the Scanner class only.

void calculate ( ) — to calculate the bill as per the following criteria:

Weight in KgsRate per Kg
First 5 KgsRs.800
Next 5 KgsRs.700
Above 10 KgsRs.500

An additional amount of Rs.1500 is charged if the type of the courier is I (International)

void print ( ) — To print the details

void main ( ) — to create an object of the class and invoke the methods

Show SolutionHide Solution↓
import java.util.Scanner;

public class courier
{
    private String name;
    private double weight;
    private String address;
    private double bill;
    private char type;
    
    public void accept() {
        Scanner in = new Scanner(System.in);

        System.out.print("Enter customer's name: ");
        name = in.nextLine();
        
        System.out.print("Enter recipient's address: ");
        address = in.nextLine();

        System.out.print("Enter parcel weight (in Kgs): ");
        weight = in.nextDouble();

        System.out.println("Enter courier type");
        System.out.print("D (Domestic), I (International): ");
        type = in.next().charAt(0);
    }
    
    public void calculate() {
        if (weight <= 5) {
            bill = weight * 800;
        } else if (weight <= 10) {
            bill = (5 * 800) + ((weight - 5) * 700);
        } else {
            bill = (5 * 800) + (5 * 700) + ((weight - 10) * 500);
        }

        if (type == 'I') {
            bill += 1500;
        }
    }
    
    public void print() {
        System.out.println("Customer's Name: " + name);
        System.out.println("Parcel Weight: " + weight + " Kgs");
        System.out.println("Recipient's Address: " + address);
        System.out.println("Type of Courier: " + type);
        System.out.println("Bill Amount: Rs." + bill);
    }

    public static void main(String[] args) {
        courier obj = new courier();
        obj.accept();
        obj.calculate();
        obj.print();
    }
}
BlueJ output of courier.java

2023 Paper

71 Mark · 2023 · Section A · 2023 PaperFull page

A mechanism where one class acquires the properties of another class:

  • (a)Polymorphism
  • (b)Inheritance
  • (c)Encapsulation
  • (d)Abstraction
Show SolutionHide Solution↓

Inheritance

Reason — Inheritance enables new classes to receive or inherit the properties and methods of existing classes.

8Written · 2023 · Section B · 2023 PaperFull page

Design a class with the following specifications:

Class name: Student

Member variables:
name — name of student
age — age of student
mks — marks obtained
stream — stream allocated

(Declare the variables using appropriate data types)

Member methods:
void accept() — Accept name, age and marks using methods of Scanner class.
void allocation() — Allocate the stream as per following criteria:

mksstream
>= 300Science and Computer
>= 200 and < 300Commerce and Computer
>= 75 and < 200Arts and Animation
< 75Try Again

void print() – Display student name, age, mks and stream allocated.

Call all the above methods in main method using an object.

Show SolutionHide Solution↓
import java.util.Scanner;

public class Student
{
    private String name;
    private int age;
    private double mks;
    private String stream;
    
    public void accept() 
    {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter student name: ");
        name = in.nextLine();
        System.out.print("Enter age: ");
        age = in.nextInt();
        System.out.print("Enter marks: ");
        mks = in.nextDouble();
    }
    
    public void allocation() 
    {
        if (mks < 75)
            stream = "Try again";
        else if (mks < 200)
            stream = "Arts and Animation";
        else if (mks < 300)
            stream = "Commerce and Computer";
        else
            stream = "Science and Computer";
    }
    
    public void print() 
    {
        System.out.println("Name: " + name);
        System.out.println("Age: " + age);
        System.out.println("Marks: " + mks);
        System.out.println("Stream allocated: " + stream);
    }
    
    public static void main(String args[]) {
        Student obj = new Student();
        obj.accept();
        obj.allocation();
        obj.print();
    }
}
BlueJ output of Student.java

2019 Paper

91 Mark · 2019 · Section A · 2019 PaperFull page

(a) Name any two basic principles of Object-oriented Programming.

Show SolutionHide Solution↓
  1. Encapsulation
  2. Inheritance

(b) Write a difference between unary and binary operator.

unary operators operate on a single operand whereas binary operators operate on two operands.

(c) Name the keyword which:

  1. indicates that a method has no return type.
  2. makes the variable as a class variable
  1. void
  2. static

(d) Write the memory capacity (storage size) of short and float data type in bytes.

  1. short — 2 bytes
  2. float — 4 bytes

(e) Identify and name the following tokens:

  1. public
  2. 'a'
  3. ==
  4. { }
  1. Keyword
  2. Literal
  3. Operator
  4. Separator
10Written · 2019 · Section B · 2019 PaperFull page

Design a class name ShowRoom with the following description:

Instance variables / Data members:
String name — To store the name of the customer
long mobno — To store the mobile number of the customer
double cost — To store the cost of the items purchased
double dis — To store the discount amount
double amount — To store the amount to be paid after discount

Member methods:
ShowRoom() — default constructor to initialize data members
void input() — To input customer name, mobile number, cost
void calculate() — To calculate discount on the cost of purchased items, based on following criteria

CostDiscount (in percentage)
Less than or equal to ₹100005%
More than ₹10000 and less than or equal to ₹2000010%
More than ₹20000 and less than or equal to ₹3500015%
More than ₹3500020%

void display() — To display customer name, mobile number, amount to be paid after discount.

Write a main method to create an object of the class and call the above member methods.

Show SolutionHide Solution↓
import java.util.Scanner;

public class ShowRoom
{
    private String name;
    private long mobno;
    private double cost;
    private double dis;
    private double amount;

    public ShowRoom()
    {
        name = "";
        mobno = 0;
        cost = 0.0;
        dis = 0.0;
        amount = 0.0;
    }

    public void input() {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter customer name: ");
        name = in.nextLine();
        System.out.print("Enter customer mobile no: ");
        mobno = in.nextLong();
        System.out.print("Enter cost: ");
        cost = in.nextDouble();
    }
    
    public void calculate() {
        int disPercent = 0;
        if (cost <= 10000)
            disPercent = 5;
        else if (cost <= 20000)
            disPercent = 10;
        else if (cost <= 35000)
            disPercent = 15;
        else
            disPercent = 20;
        
        dis = cost * disPercent / 100.0;
        amount = cost - dis;
    }
    
    public void display() {
        System.out.println("Customer Name: " + name);
        System.out.println("Mobile Number: " + mobno);
        System.out.println("Amout after discount: " + amount);
    }
    
    public static void main(String args[]) {
        ShowRoom obj = new ShowRoom();
        obj.input();
        obj.calculate();
        obj.display();
    }
}
BlueJ output of ShowRoom.java