ICSE · Class 9 · Computer Applications

Class 9 Elementary Concept of Objects and Classes Mock Test (ICSE)

6 practice questions from Elementary Concept of Objects and Classes, in the style of your board paper, each with a worked answer and the marks for every step. Then take a full chapter test on paper, snap the pages and get every step marked.

Topics in Elementary Concept of Objects and Classes

  • Objects as instances of a class
  • Attributes and behaviour
  • Class as an object factory
  • Class as a user-defined data type
  • Real-world modelling with classes

Elementary Concept of Objects and Classes practice questions with answers

  1. Q1Multiple choice1 mark
    Which of the following best describes a class in Java?
    1. (a)A named block of statements that performs a specific task
    2. (b)A user-defined blueprint from which objects are created
    3. (c)An instance that occupies memory and holds its own data values
    4. (d)A built-in data type that stores a single simple value
    Show answer and step marks
    1. Correct option: (b) A user-defined blueprint from which objects are created+1
    Answer: (b)
  2. Q2Multiple choice1 mark
    What is created in memory when the new operator is invoked with a class constructor?
    1. (a)An instance or object of the class
    2. (b)A static member function
    3. (c)A primitive data value
    4. (d)A new class definition file
    Show answer and step marks
    1. Correct option: (a)+1
    Answer: (a)
  3. Q3Short answer2 marks
    Study the Java class and the code that uses it. class Mobile { String brand; int price; } Mobile m1 = new Mobile(); Mobile m2 = new Mobile(); m1.price = 15000; m2.price = m1.price - 3000; m1.price = m1.price + 500; (a) How many objects of the class Mobile are created by the code above? [1] (b) State the value of m2.price after all the statements have run. [1]
    Show answer and step marks
    1. Two objects, m1 and m2, are created with new Mobile(), so the count is 2.+1
    2. m2.price = 15000 - 3000 = 12000; the later change to m1.price does not alter m2.price, so the value is 12000.+1
    Answer: (a) 2 objects; (b) m2.price = 12000
  4. Q4Short answer2 marks
    A class Bicycle has the data members gears and speed, and the method applyBrake(). Explain how the attributes of a Bicycle object differ from its behaviour, using these members in your answer.
    Show answer and step marks
    1. Attributes are the data members that describe the state or properties of an object, such as gears and speed.+1
    2. Behaviour is what the object can do, carried out by its methods; applyBrake() changes the speed stored in the object.+1
    Answer: Attributes store the state of a Bicycle object (gears, speed), while behaviour is the set of actions it performs through methods such as applyBrake().
  5. Q5Long answer4 marks
    A school wants a Java program to keep its student register. The register must hold the records of three students: Anita (roll number 14), Ravi (roll number 22) and Meena (roll number 9). (a) Name the class that should be written to describe every student in the register. [1] (b) Name the object that stores the record of Ravi (roll number 22). [1] (c) State whether the class you named in (a) is a primitive or a non-primitive data type. Give a reason. [1] (d) State how many objects of this class are needed to model the three students Anita, Ravi and Meena. [1]
    Show answer and step marks
    1. (a) Student class, the blueprint that describes each student in the register.+1
    2. (b) A Student object for Ravi with roll number 22, an instance of the Student class.+1
    3. (c) Non-primitive (user-defined) data type, because it is not one of Java's built-in primitive types such as int or char and it groups several details together.+1
    4. (d) 3 objects, one each for Anita, Ravi and Meena.+1
    Answer: (a) Student class; (b) Ravi's Student object (roll number 22); (c) Non-primitive (user-defined) data type; (d) 3 objects
  6. Q6Long answer4 marks
    Define a class named `MovieTicket` to act as a user-defined data type with the following specifications: Instance variables / data members: - `title` - of type String to store the movie title - `rating` - of type double to store the movie rating - `price` - of type double to store the ticket price Member methods: - `void accept()` - to accept the movie title, rating, and price using the Scanner class. - `void display()` - to display the ticket details. Write the complete Java program including the `main` method to create an object of this class and invoke the member methods.
    Show answer and step marks
    1. Imports `java.util.Scanner` and declares class `MovieTicket` with instance variables `String title`, `double rating` and `double price`.+1
    2. `accept()`: creates a `Scanner` object and reads `title` with `nextLine()` (also credit `next()`).+0.5
    3. `accept()`: reads `rating` and `price` with `nextDouble()`.+0.5
    4. `display()`: prints the title, rating and price using `System.out.println`.+1
    5. `main`: creates an object with `MovieTicket ticket = new MovieTicket();`.+0.5
    6. `main`: calls `ticket.accept()` and then `ticket.display()`.+0.5
    Answer: import java.util.Scanner; class MovieTicket { String title; double rating; double price; void accept() { Scanner sc = new Scanner(System.in); System.out.print("Enter the movie title: "); title = sc.nextLine(); System.out.print("Enter the rating: "); rating = sc.nextDouble(); System.out.print("Enter the ticket price: "); price = sc.nextDouble(); } void display() { System.out.println("Movie title: " + title); System.out.println("Rating: " + rating); System.out.println("Ticket price: " + price); } public static void main(String[] args) { MovieTicket ticket = new MovieTicket(); ticket.accept(); ticket.display(); } }

Take a full Elementary Concept of Objects and Classes test

PrepitUp writes a fresh paper on this chapter at the length you pick. Write it on paper with a timer, photograph the pages, and see the marks for every step and what to practise next.

  • 15 min10 marks
  • 30 min20 marks
  • 1.5 hr40 marks
  • 3 hr80 marks
See a sample marked answer sheet

Get your Elementary Concept of Objects and Classes answers marked

Sign in, pick this chapter and a length, write the test on paper and get every step marked.

Sign in to take this test

More Class 9 Computer Applications mock tests