Question
Which of the following scenarios illustrates runtime
polymorphism?Solution
Runtime polymorphism (or dynamic method dispatch) occurs when a method's implementation is determined at runtime. This is achieved using method overriding in OOP. A derived class overrides a method of the base class, and the method to execute is determined by the type of the object being referenced at runtime. Example: class Animal { void sound() { System.out.println("Animal makes a sound"); }} class Dog extends Animal { void sound() { System.out.println("Dog barks"); }} public class Main { public static void main(String[] args) { Animal animal = new Dog(); // Base class reference pointing to a derived class object animal.sound(); // Outputs: Dog barks }} Why Other Options Are Incorrect: 1. Method with the same name but different parameters within the same class: This is compile-time polymorphism (method overloading), not runtime polymorphism. 2. Default arguments in methods: Default arguments provide flexibility but are unrelated to polymorphism. They simplify method calls without changing the behavior based on the object’s runtime type. 3. Static methods for shared functionality: Static methods are class-level and cannot participate in runtime polymorphism, as they are resolved at compile time. 4. Constructor with a parameter list in the derived class: Constructors are not polymorphic as they do not inherit or override behavior in OOP.
From the following, calculate the Operating Profit Ratio: Net Sales ₹5,00,000, Cost of Goods Sold ₹3,00,000, Operating Expenses ₹1,00,000, Non-ope...
A company has the following details:
• Net Profit: ₹12 lakh
• Equity: ₹60 lakh
• Debt: ₹40 lakh
• Interest: �...
A company's Net Profit is ₹2,00,000; its Net Sales are ₹10,00,000. What is its Net Profit Margin?
Which ratio measures a company's ability to meet its short-term obligations?
Which of the following is typically excluded from EPS (earnings per share) basic calculation?
Company A has inventory turnover 6 times and average inventory ₹4,00,000. Annual cost of goods sold is:
If Current Ratio is 2.5:1 and Working Capital is ₹1,50,000, what are Current Assets?
Refer the following summarized Balance Sheet of Roy Ltd. as on 31‐3‐2023:
A company has sales ₹50,00,000 and gross profit margin 40% (on sales). Cost of goods sold (COGS) is:
A firm evaluates two projects with identical expected cash flows, but Project A has higher variability. If the firm is risk-averse, what would be its de...