Page 1 of 1

ning Questions (40 points) What is encapsulation? Why is it useful? 32. (5 points) What is a constructor? What is a muta

Posted: Sat May 14, 2022 4:42 pm
by answerhappygod
Ning Questions 40 Points What Is Encapsulation Why Is It Useful 32 5 Points What Is A Constructor What Is A Muta 1
Ning Questions 40 Points What Is Encapsulation Why Is It Useful 32 5 Points What Is A Constructor What Is A Muta 1 (130.16 KiB) Viewed 31 times
ning Questions (40 points) What is encapsulation? Why is it useful? 32. (5 points) What is a constructor? What is a mutator method? What is an accessor method? (15 points) Please show what output results for the indicated lines using the following program. class MyClass: def method1(self, param_tuple): self.local_list = [] for element in param_tuple: if element > 10: self.local_list.append(element) def method2(self): self.sum_int = 0 for element in self.local_list: self.sum_int += element return self.sum_int inst1 = MyClass() inst2 = MyClass() inst1.method1([1,2,3]) print(inst1.local_list) # Line 1 inst1.method1([10,11,12]) print(inst1.local_list) # line 2 print(inst1.method2()) # line 3 #inst2.method2() # Line 4 (a) What output is produced by Line 1 of the above program? (b) What output is produced by Line 2 of the above program? (c) What output is produced by Line 3 of the above program? (d) Line 4 is commented out. What result would occur if Line 4 were executed by the program. Wh Page 7 of 9