Page 1 of 1

a) Explain the difference between a function and a method. [5 marks] b) Explain inheritance, polymorphism and data encap

Posted: Fri May 20, 2022 11:25 am
by answerhappygod
A Explain The Difference Between A Function And A Method 5 Marks B Explain Inheritance Polymorphism And Data Encap 1
A Explain The Difference Between A Function And A Method 5 Marks B Explain Inheritance Polymorphism And Data Encap 1 (115.3 KiB) Viewed 40 times
a) Explain the difference between a function and a method. [5 marks] b) Explain inheritance, polymorphism and data encapsulation. Does Python syntax enforce data encapsulation? [4 marks] c) How is the lifetime of an object determined? What happens to an object when it dies? [4 marks] d) Explain what happens when a program receives a non-numeric string when a number is expected as input, and explain how the try-except statement can be of use in this situation. Why would you use a try-except statement in a program? [4 marks] e) Explain what happens when the following recursive function is called with the values "hello" and 0 as arguments: [3 marks] def example(aString, index): if Index < len(aString): example(String, index + 1) print(String[index], and = "") 24 222-05-17