Skip to content

Instantly share code, notes, and snippets.

@gaganawhad gaganawhad/hope-test-4
Last active Aug 29, 2015

Embed
What would you like to do?
Name:
Date:
No using computers or google:
For the following 5 questions, chose the option that answers the question.
1. If a variable is named ‘$var’ what type is it ?
(a) Instance variable (b) Global variable (c) Local variable (d) Constant
2. If a variable is named ‘Var’ what type is it ?
(a) Instance variable (b) Global variable (c) Local variable (d) Constant
3. If a variable is named ‘var’ what type is it ?
(a) Instance variable (b) Global variable (c) Local variable (d) Constant
4. If a variable is named ‘@var’ what type is it ?
(a) Instance variable (b) Global variable (c) Local variable (d) Constant
5. If a variable is named ‘_var’ what type is it ? .
(a) Instance variable (b) Global variable (c) Local variable (d) Constant
For the following questions answer what will be printed on the screen as a result of the puts statement:
6.
var = 6
def my_method
puts var
end
my_method
7.
var = 6
def my_method var
var = var + 5
puts var
end
my_method var
8.
@var = 6
def my_method
@var = @var - 2
puts @var
end
my_method
9.
var1 = 6
def my_method var2
var2 = var2 + 3
puts var2
end
my_method var1
10.
var1 = 6
def my_method var1
var1 = var1 + 4
end
my_method var1
puts var1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.