# SD212 HW 28

## [name] Type your name on the next line


## [Q1]

> How much did you read carefully?
>
> a)  The entire chapter
> b)  All of the sections specifically listed above
> c)  Some of the sections listed
> d)  None of it too carefully
>
> (Answer with just the letter of your choice.)


## [Q2]

> If `x` is a variable defined somewhere in our code, what does
>
> `dir(x)` show?
>
> a)  The directory where `x` is located
> b)  The type (class name) of `x`
> c)  The attributes and methods of `x`
> d)  The internal functions used to represent `x`


## [Q3]

> Consider the following code:
>
>     class Veg:
>         color = 'green'
>
>         def speak(self):
>             print('I am a', self.color, 'vegetable')
>
>     class Pepper(Veg):
>         def ripen(self):
>             self.color = 'red'
>
>     lettuce = Veg()
>     chile = Pepper()
>     chile.ripen()
>
> What happens if we run this code and then call `chile.speak()`?
>
> a)  Error
> b)  It runs but doesn't print anything
> c)  It prints `I am a green vegetable`
> d)  It prints `I am a red vegetable`


## [Q4]

> Following the same example, what happens if we call
>
> `lettuce.speak()`?
>
> a)  Error
> b)  It runs but doesn't print anything
> c)  It prints `I am a green vegetable`
> d)  It prints `I am a red vegetable`


## [Q5]

> And again in the same example, what happens if we call
>
> `lettuce.ripen()`?
>
> a)  Error
> b)  It runs but doesn't print anything
> c)  It prints `I am a green vegetable`
> d)  It prints `I am a red vegetable`


