Quiz!

Explanation

Go through the questions below. The purpose is not to test you, it's to allow you to test yourself. Your goal isn't to get the answers right, it's to assimilate the knowledge in the questions. That's why we made them, to give you another opportunity to address and think about things that we've seen can be unclear for some students.

This is self-scored, it is for you to help push yourself along and address gaps in your knowledge. It doesn't matter how many you get correct, it matters that you come to learn this information.

How to take the quiz

classes are containers for what?

methods

classes have a pointer to what?

their superclass

instances are containers for what?

instance variables

instances have a pointer to what?

their class

We say classes are also instances.... what does this mean?

it means they have instance variables and a class pointer

method parameters are what kind of variable?

a local variable

all code executes in what?

a binding

where are the bindings?

on the stack

bindings are containers for what?

local variables

bindings have a pointer to what?

self

what does this give them access to?

instance variables and private methods

Where are methods stored?

in classes

If I call a method on an instance, where does it look for the method?

in its class

What if it doesn't find the method there?

then it looks in the superclass

What if it doesn't find the method there?

then it looks in the superclass's superclass

What does it do once it finds the method?

it puts a binding on the stack, with self set to the object the method was called on, and then executes the method inside of it

I call `"hello world".upcase`, what is `self` inside of the `upcase` method?

the string `"hello world"`

What is the colloquial term for an instance?

a

a class

b

an object

c

an instance variable

d

a binding

These are the thing we think about most in this type of programming language

b

In the code below, which describes what is actually happening? ```ruby a = "some string" b = a ```

a

a and b are local variables pointing to the same string

b

a is a local variable, b is an alias, pointing to a different string

c

a and b are local variables, each pointing to their own instance of "some string"

d

a is pointing to "some string", and b is pointing to a

What can variables point at? When you reference a variable, what does it evaluate to?

a

What is `abc`?

a

a string

b

a symbol

c

an instance variable

d

a local variable

Does it have any adorning marks?

d

It could also be a method (hence "Undefined local variable or method" errors)

What is `Abc`?

a

a local variable

b

a constant

c

an instance variable

d

a global variable

b

What is `@abc`?

a

a local variable

b

a constant

c

an instance variable

d

a global variable

c

What is `$abc`?

a

a local variable

b

a constant

c

an instance variable

d

a global variable

d