Question: Consider the following class: class Counter : def getValue(self) : return self._value def click(self) : self._value = self._value + 1 def unClick(self) : self._value =

Consider the following class: class Counter : def getValue(self) : return self._value def click(self) : self._value = self._value + 1 def unClick(self) : self._value = self._value - 1 def reset(self) : self._value = 0

Which method(s) are mutators?

Question 6 options:

a) Only reset

b) Only click and unClick

c) Only click, unClick and reset

d) All four methods are mutators

Save

Question 7 (2 points)

Consider the following class: class Counter : def getValue(self) : return self._value

7) Which of the following method headers represent a constructor?

Question 7 options:

a) def init(self) :

b) def __init__(self) :

c) def _init(self) :

d) def init() :

Save

Question 8 (2 points)

def click(self) : self._value = self._value + 1 def unClick(self) : self._value

8) How do you access instance variables in a method?

Question 8 options:

a) Using the constructor

b) Using the public interface

c) Using a default value

d) Using the self reference

Save

Question 9 (2 points)

= self._value - 1 def reset(self) : self._value = 0 Which method(s)

9) Consider the following code segment: def mutate(self, newType) : self._type = newType self._mutations = self._mutations + 1

What is the name of the local variable in it:

Question 9 options:

a) mutate

b) _mutations

c) newType

d) _type

Save

Question 10 (2 points)

are mutators? Question 6 options: a) Only reset b) Only click and

10) Which method below would be considered an accessor method?

Question 10 options:

a) getCount()

b) addItem()

c) clearCount()

d) updateItem()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!