Last active
August 29, 2015 14:01
-
-
Save gaganawhad/c2c55d9bf52593d4fade to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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