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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 30 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply