Start learning 50% faster. Sign in now
The code demonstrates Python's ability to dynamically add attributes to an instance of a class. 1. Instance Attributes: While name and age are initialized in the __init__ method, the salary attribute is added dynamically to the e1 instance after the object is created. Python allows this flexibility without any compile-time errors. 2. Output Explanation: When e1.display() is called, the display method prints name and age. Then, e1.salary is accessed and printed directly. 3. Execution Result: The code will output: Name: John, Age: 30 50000 This behavior demonstrates Python's dynamic nature and object-oriented principles. Why Other Options Are Incorrect: • A) It will print the name, age, and salary of the employee: The display method does not include salary, so salary is not printed there. • B) It will raise an AttributeError when accessing e1.salary: Python allows adding attributes dynamically; no error occurs. • D) It will execute but not print the salary attribute: e1.salary is explicitly printed in the last line. • E) It will fail to execute due to missing method to initialize salary: There is no requirement for salary to be initialized in the __init__ method.
A man, after making the first investment, earned a total interest of Rs. 1,09,200 at the end of 3 years. He invested a certain amount at an annual compo...
Compound interest on a certain sum of money for 2 years is Rs.2600 while the simple interest on the same sum for the same time period is Rs.2500. Find t...
The ratio of the compound interest earned on an amount of Rs. 'p' at an interest rate of 15% per annum for 2 years to the simple ...
An amount of Rs. (y-2800) was invested on simple interest at the rate of (R+1)% per annum for 6 years. An another amount of Rs. (y+3200) was invested on...
A man deposited Rs. ‘x + 1400’ at 12% per annum simple interest and earned Rs. 828 as interest after 2 years. Find the interest earned by him if he ...
Rahul deposits a sum of money at an annual compound interest rate of 15%. After 1 year, the interest accumulated amounts to Rs. 180. If he increases his...
The difference between compound interest and simple interest on a sum for 2 years at 10% per annum, when the interest is compounded annually is Rs. 25. ...
A sum is lent on compound interest for 2 years at 11% p.a. If the compound interest on the sum is Rs.3713.6, find the sum.
If the ratio of the sum invested and simple interest received after 1 year is 20:13 respectively, then find the rate of interest.
After how many years, Rs. 4400 will become 5324 at the rate of 10% p.a., compounded annually?