CBSE Class 12 Informatics Practices Concept Of Inheritance In Java

Official CBSE Assignments for Class 12 Informatics Practices

Explore structured practice materials through the CBSE Class 12 Informatics Practices Concept Of Inheritance In Java. Tailored for Class 12 learners, utilizing these Informatics Practices assignments ensures thorough preparation and strengthens foundational knowledge before final CBSE evaluations.

Solved Practice Assignments for Informatics Practices

Navigate directly to the solved Informatics Practices assignments using the digital viewer below. Each practice set includes detailed step-by-step solutions, allowing students to instantly cross-check their work and identify areas requiring further revision.

Question 1. What are the different types of access specifier supported by java?
Answer: Java supports four different types of access specifiers or modifiers:
1. Public: Visible to all classes everywhere.
2. Protected: Visible to packages and all subclasses.
3. Default (no modifier): Visible only within the same package.
4. Private: Visible only within the defined class itself.
In simple words: Access specifiers control the visibility and security of classes, methods, and variables.

Exam Tip: Remember that 'default' is not a keyword; it is applied automatically when no other access modifier is written.

 

Question 2. Which is the default package of java?
Answer: The default package in Java is java.lang.
In simple words: It is automatically imported into all Java programs, containing essential classes like String and Math.

Exam Tip: You do not need an explicit import statement for java.lang.

 

Question 3. What is friendly access of class member?
Answer: Friendly access refers to the default access level in Java (when no explicit access modifier like public, private, or protected is specified). Members with friendly access can be accessed by any other class residing within the same package, but not by classes outside that package.
In simple words: Friendly access means package-private visibility.

Exam Tip: It is often called package-private access in modern Java terminology.

 

Question 4. How does a class enforce information hiding?
Answer: A class enforces information hiding primarily by declaring its instance variables as private. This prevents direct external access from other classes. Controlled access to these private variables is then provided through public getter and setter methods.
In simple words: Private variables hide internal data from the outside world.

Exam Tip: Information hiding is a core pillar of encapsulation in object-oriented programming.

 

Question 5. Define an abstract class and abstract methods.
Answer:
- Abstract Class: A class declared with the abstract keyword that cannot be instantiated directly and serves as a base class for other classes.
- Abstract Method: A method declared without a body (using the abstract keyword) that must be overridden and implemented by any non-abstract subclass.
In simple words: Abstract classes and methods act as blueprints that subclasses must complete.

Exam Tip: If a class contains even one abstract method, the class itself must be declared abstract.

 

Question 6. What is an interface? What is the use of Interface.
Answer: An interface is a reference type in Java that is similar to a class and is a collection of abstract methods and constant variables. Interfaces are used to achieve fully defined abstraction and to implement multiple inheritance in Java, since classes do not support multiple inheritance directly.
In simple words: An interface is a contract that specifies what a class must do, but not how to do it.

 

Question 1. What is inheritance?
Answer: Inheritance is a form of software reusability in which new classes are created from existing classes by absorbing their attributes and behaviours.
In simple words: Inheritance lets a new class adopt the properties and methods of an existing class.

Exam Tip: Use the extends keyword to implement inheritance in Java.

 

Question 2. What is the primary purpose of inheritance?
Answer: The primary purpose of inheritance is code reusability.
In simple words: It prevents rewriting the same code multiple times.

Exam Tip: Code reusability reduces development time and minimizes software bugs.

 

Question 3. Name three basic concepts in Java which are used in Object oriented programming.
Answer: The three basic concepts are Classes, Objects, and Inheritance.
In simple words: Object-oriented programming relies on classes, objects, and inheritance.

 

Question 4. Which constructor is called first: subclass or superclass?
Answer: A subclass constructor always calls the constructor for its superclass first explicitly or implicitly to create and initialize the subclass members.
In simple words: The parent constructor runs before the child constructor.

Exam Tip: Use super() explicitly in the child constructor if the parent class constructor takes parameters.

 

Question 5. What is abstract class?
Answer: An Abstract class is the one that simply represents a concept and whose objects can't be created. It is created through the use of keyword abstract. The superclass set up as an abstract class does not allow objects of its prototype to be created. In this case only objects of the subclass are used.
In simple words: Abstract classes cannot be instantiated directly and serve as templates.

Exam Tip: An abstract class can have both abstract and concrete (implemented) methods.

 

Question 6. What is method overriding in Java?
Answer: A method in a subclass hides or overshadows a method inherited from the superclass if both methods have same signature (i.e. the same name, number and type of arguments and the same return type). This property is known as Overriding the Inherited method.
In simple words: Overriding lets a subclass provide a specific implementation of a method already defined in its parent class.

Exam Tip: Use the @Override annotation for clarity and compiler checks.

 

Question 7. What is an Interface in Java?
Answer: An Interface defines a protocol of behaviour or it is a collection of constants and abstract methods. These are not classes, but they can be used in the definition of a class.
In simple words: An interface defines a set of methods that implementing classes must build.

Exam Tip: Classes implement interfaces using the implements keyword.

 

Question 8. What is the significance of abstract class in Java program?
Answer: When a class defines a method using the same name, return type, and arguments as a method in its superclass, the method in the class overrides the method in the superclass. When the method is invoked for an object of the class, it is the new definition of the method that is called, and not the method definition from superclass. Methods may be overridden to be more public, not more private.
In simple words: Abstract classes allow common behavior to be shared while forcing subclasses to provide specific functionality.

Exam Tip: Overridden methods cannot have stricter access privileges than the overridden parent method.

 

Question 9. What types of inheritance does Java have?
Answer: Java supports only these inheritance types:
i. Single inheritance
ii. Multilevel inheritance
iii. Hierarchical
In simple words: Java supports single, multilevel, and hierarchical inheritance, but does not support multiple inheritance with classes.

Exam Tip: Multiple inheritance of classes is prohibited in Java to avoid the diamond problem.

 

Question 10. State True and False
a. A subclass inherits both member variables and member methods of superclass.
b. A class created with keyword abstract can have at the most one object.
c. Overloading and Overriding are similar concepts in Java.
d. Java supports single inheritance only at multiple levels of inheritance.
e. Interfaces are used for multiple inheritance.

Answer:
a. True
b. False
c. False
d. True
e. False
In simple words: Abstract classes cannot have any objects, and interfaces enable multiple inheritance behavior.

Exam Tip: Read True/False statements carefully, especially regarding object instantiation for abstract types.

 

Question 11. Declare and explain the basic syntax of inheritance.
Answer: The basic syntax for specifying an inherited class is as:
class child_class extends parent_class {
  // class contents
}
The syntax represents the definition of the class child_class. The child_class automatically inherits an initial set of methods and variables from the parent class. The inherited variables and method can be used by the child class as if they had been declared locally in the child_class.
In simple words: Use the keyword extends to inherit a parent class.

Exam Tip: The subclass is written on the left of extends and the superclass is written on the right.

 

Question 12. How does inheritance support software reuse?
Answer: Because a new class can be derived from an existing one, the characteristics of the parent class can be reused without the erroneous process of copying and modifying code.
In simple words: Inheritance lets developers reuse tested code safely in new classes.

Exam Tip: Reusing code decreases maintenance effort and improves program reliability.

 

Question 13. Differentiate between method overloading and method overriding.
Answer:
- Overloading: The methods with the same name but it differ by types of arguments and number of arguments.
- Overriding: The methods with the same name and same number of arguments and types but one is in base class and second as in derived class. Derived class overrides over base class.
In simple words: Overloading happens within the same class with different parameters, while overriding happens across parent and child classes with identical signatures.

Exam Tip: Overloading is compile-time polymorphism, while overriding is run-time polymorphism.

 

Question 14. Write a program to find the area of triangle and rectangle through abstract class and abstract class method.
Answer:
a)
abstract class Figure {
  double L;
  double BH;
  Figure(double a, double b) {
    L = a;
    BH = b;
  }
  abstract double area();
}

b)
class Rectangle extends Figure {
  Rectangle(double a, double b) {
    super(a, b);
  }
  double area() {
    jLabel5.setText("Inside Area of Rectangle.");
    return L * BH;
  }
}

class Triangle extends Figure {
  Triangle(double a, double b) {
    super(a, b);
  }
  double area() {
    jLabel6.setText("Inside Area for Triangle.");
    return L * BH / 2;
  }
}

c)
int len, heigh;
len = Integer.parseInt(txtL.getText());
heigh = Integer.parseInt(txtH.getText());
Rectangle r = new Rectangle(len, heigh);
Triangle t = new Triangle(len, heigh);
Figure F;
F = r;
txtAreaR.setText(String.valueOf(F.area()));
F = t;
txtAreaT.setText(String.valueOf(F.area()));

d)
System.exit(0);
In simple words: This code uses an abstract parent class to calculate shapes dynamically using polymorphism.

Exam Tip: Notice how parent reference variables can hold child object instances (dynamic method dispatch).

 

Question 15. Write a program to demonstrate constant in an interface to find the area of circle. Notice that the interface should declare the value of pie as a constant. That is:
interface valuePie {
  double PIE = 3.14;
}
Using class, implement the interface constant and find the area of circle.

Answer:
a)
interface valuePie {
  double PIE = 3.14;
}

class cArea implements valuePie {
  public double area(float r) {
    return (PIE * r * r);
  }
}

b)
float r = Float.parseFloat(txtR.getText());
cArea C = new cArea();
txtArea.setText(String.valueOf(C.area()));

c)
System.exit(0);
In simple words: Interfaces can hold constants that implementing classes can directly use.

Exam Tip: Interface variables are automatically compiled as public static final.

 

Unsolved Questions:

Question 1. What members of a class out of private, protected and public are inheritable?
Answer: Public and protected members of a class are inheritable by subclasses. Private members are not directly accessible or inheritable by subclasses.
In simple words: Private members stay hidden inside the parent class, while public and protected members pass down to children.

Exam Tip: Private fields can only be accessed indirectly through public or protected getter/setter methods.

 

Question 2. When do we declare a method or class 'final'?
Answer: We declare a class final when we want to prevent it from being inherited by any subclass. We declare a method final when we want to prevent subclasses from overriding that specific method.
In simple words: The final keyword stops further inheritance or method overriding.

 

Question 3. What is an abstract class?
Answer: An abstract class is a class declared with the abstract keyword that cannot be instantiated on its own and is designed to be subclassed by other classes that provide implementations for its abstract methods.
In simple words: An abstract class acts as an incomplete template for other classes.

Exam Tip: Use abstract classes to share common code among several closely related classes.

 

Question 4. When do we declare a method or class abstract?
Answer: We declare a method abstract when the exact implementation cannot be determined at the superclass level and must be defined by each subclass. We declare a class abstract when it contains at least one abstract method or when we want to prevent direct instantiation of the base class.
In simple words: Use abstract when subclasses must supply their own specific method bodies.

Exam Tip: Abstract methods never have a method body (they end with a semicolon instead of braces).

 

Question 5. What is the difference between an abstract class and an interface?
Answer:
1. An abstract class can have instance variables, constructors, and concrete methods, whereas an interface can only have static final constants and abstract methods (prior to Java 8 default methods).
2. A class can extend only one abstract class, but it can implement multiple interfaces.
In simple words: Abstract classes share code and state, whereas interfaces define shared behaviors and multi-inheritance contracts.

Exam Tip: Choose an abstract class for closely related objects sharing code; choose an interface for unrelated classes sharing common capabilities.

 

CHAPTER 8

GUI DIALOGS AND TABLES

Solved Questions:

Question 1. What is dialog in Java?
Answer: A dialog is a small separate window that appears to either provide or request to/from the user.
In simple words: Dialog windows interact with users for pop-up messages or inputs.

Exam Tip: Dialogs are typically modal or modeless depending on whether they block parent window interaction.

 

Question 2. Write the import statement required for using JOptionPane class.
Answer: import javax.swing.JOptionPane;
In simple words: This import gives access to standard Swing pop-up dialog boxes.

Exam Tip: Always place import statements at the very top of your Java source file.

 

Question 3. What is showConfirmDialog() method of JOptionPane class do?
Answer: This method displays a dialog with several buttons and returns as int option type corresponding to the button pressed (mostly one from Yes, No or Cancel).
In simple words: It prompts the user with a question and returns an integer representing their button choice.

Exam Tip: Common return values include JOptionPane.YES_OPTION and JOptionPane.NO_OPTION.

 

Question 4. What is showInputDialog() method of JOptionPane class do?
Answer: This method displays a dialog which is intended to receive user input, and returns a String if the input component is a text field. It displays two buttons: OK and Cancel.
In simple words: It pops up an input box to accept text from the user.

Exam Tip: The returned value is always a String, which must be parsed if numeric data is required.

 

Question 5. What is the difference between a dialog created with JDialog and a dialog created with JOptionPane?
Answer: JDialog is a general-purpose custom dialog container used to build complex, fully customized dialog windows with custom components and layouts. In contrast, JOptionPane is a high-level utility class used to quickly generate standard pre-defined dialog styles such as message alerts, confirmation boxes, and simple input prompts with minimal code.
In simple words: JDialog creates fully custom dialog windows, while JOptionPane creates standard pre-built popup boxes.

Exam Tip: Use JOptionPane for quick alerts and JDialog for custom forms and specialized dialog interfaces.

 

Chapter Assignment & Practice Material for Class 12 Informatics Practices Concept Of Inheritance In Java

Chapter Practice Questions for Class 12 Informatics Practices

Review targeted chapter assignments for Class 12 Informatics Practices Concept Of Inheritance In Java. Built according to official CBSE guidelines, these downloadable problem sets help students build accuracy and prepare effectively for school tests.

Key Advantages of Solving Concept Of Inheritance In Java Assignments

  • Curriculum Standards: Assignments match modern CBSE sample formats to ensure relevant preparation.
  • Thorough Revision: Detailed problem sets reinforce core concepts and eliminate conceptual weak spots.
  • Execution Speed: Timed practice with assignment sets sharpens overall response timing.

Effective Strategy for Class 12 Informatics Practices Assignments

  1. Initial Reading: Begin by reading the NCERT book for Class 12 Informatics Practices to build a baseline understanding.
  2. Independent Testing: Attempt assignment questions unassisted, then verify work using provided answer keys.
  3. Supplementary Aids: Leverage revision notes and worksheets whenever you encounter difficult topics.

FAQs

Where can I download the latest CBSE Class 12 Informatics Practices Concept Of Inheritance In Java assignments?

You can download free PDF assignments for Class 12 Informatics Practices Concept Of Inheritance In Java from StudiesToday.com. These practice sheets have been updated for the 2026-27 session covering all concepts from latest NCERT textbook.

Do these Informatics Practices Concept Of Inheritance In Java assignments include solved questions?

Yes, our teachers have given solutions for all questions in the Class 12 Informatics Practices Concept Of Inheritance In Java assignments. This will help you to understand step-by-step methodology to get full marks in school tests and exams.

Are the assignments for Class 12 Informatics Practices Concept Of Inheritance In Java based on the 2026 exam pattern?

Yes. These assignments are designed as per the latest CBSE syllabus for 2026. We have included huge variety of question formats such as MCQs, Case-study based questions and important diagram-based problems found in Concept Of Inheritance In Java.

How can practicing Concept Of Inheritance In Java assignments help in Informatics Practices preparation?

Practicing topicw wise assignments will help Class 12 students understand every sub-topic of Concept Of Inheritance In Java. Daily practice will improve speed, accuracy and answering competency-based questions.

Can I download Informatics Practices Concept Of Inheritance In Java assignments for free on mobile?

Yes, all printable assignments for Class 12 Informatics Practices Concept Of Inheritance In Java are available for free download in mobile-friendly PDF format.