Class and object Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is the highest level in the object model?

A

BasicObject

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Is everything in Ruby an object?

A

Methods are not objects. Blocks are not objects. Keywords are not objects. However, there exist Method objects and Proc objects, and some keywords refer to objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which core object includes the Kernel module?

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Is Ruby a statically typed or a dynamically typed language?

A

Dynamically typed since type checking is done at runtime.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Is Ruby a strongly typed or a weakly typed language?

A

Strongly typed since an object’s type is checked before an operation is performed on it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what are the types of variables?

A

Local Variables
Instance Variables
Class Variables
Global Variables −

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Differentiate - Class Variable and Instance Variable

A
A class variable is evaluated in reference to the class object created by the enclosing class definition while
an instance variable is evaluated in reference to self. Instance variables cannot be referenced outside of instance methods.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Are class variables are inherited?

A

No. The behavior is different than inheritance. Any alteration of a class variable by a subclass affects that class variable in the superclass and all other subclasses of the superclass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If a variable wihich has all upper case letter,that is called?

A

Constant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why must a class name begin with a capital letter?

A

Because the class keyword creates a new constant that refers to the class and constants begin with a capital letter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly