CSE 3901 - Midterm 1 QUESTIONS
|\ |\ |\ |\ |\ |\
WITH ANSWERS |\
github: what is a repository? - CORRECT ANSWERS ✔✔a working
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
tree + store + index
|\ |\ |\ |\
github: what is a working tree? - CORRECT ANSWERS ✔✔the
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
project itself |\
github: what is a store? - CORRECT ANSWERS ✔✔hidden
|\ |\ |\ |\ |\ |\ |\ |\ |\
directory (.git) in root directory of working tree
|\ |\ |\ |\ |\ |\ |\
|\ User never accesses .git directly
|\ |\ |\ |\
|\ Store records project development history
|\ |\ |\ |\
github: what is history? - CORRECT ANSWERS ✔✔DAG of commits
|\ |\ |\ |\ |\ |\ |\ |\ |\
Each commit represents a complete snapshot of the entire
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
project
github: what is an index? - CORRECT ANSWERS ✔✔virtual
|\ |\ |\ |\ |\ |\ |\ |\ |\
snapshot stored in .git/index|\ |\ |\
github: what is a branch? - CORRECT ANSWERS ✔✔a pointer to a
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
commit
,github: command to create a new branch - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔git branch nameOfBranch
|\ |\
github: change to branch titled 'fix' - CORRECT ANSWERS ✔✔git
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
checkout fix |\
github: add and commit changes to local store - CORRECT
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
ANSWERS ✔✔git add --all . |\ |\ |\ |\
git commit
|\
github: problem on slide 42
|\ |\ |\ |\
http://web.cse.ohio-state.edu/~giles/3901/lectures/lecture02.pdf -
|\ |\
CORRECT ANSWERS
|\ |\ |\
✔✔http://web.cse.ohio-state.edu/~giles/3901/lectures/lecture02.p
df
ruby: what is the following range 0..4 - CORRECT ANSWERS ✔✔0,
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
1, 2, 3, 4
|\ |\ |\ |\
ruby: what is the following range 0...4 - CORRECT ANSWERS ✔✔0,
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
1, 2, 3
|\ |\ |\
ruby: what does the <=> operator do? - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔Returns -1/0/1 if LHS is smaller/equal/larger than RHS
|\ |\ |\ |\ |\ |\ |\
,ruby: what does "cab" <=> "da" return? - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔-1
ruby: what does "cab" <=> "ba" return? - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔1
i = 34
|\ |\
j = i # i and j are aliases
|\ |\ |\ |\ |\ |\ |\ |\
j = j + 1 # does this increment i too?
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
what is the value of i and j? - CORRECT ANSWERS ✔✔i = 34, j =
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
35
what does the following statement do?
|\ |\ |\ |\ |\
i = 10
|\ |\
25.times { | i | puts i } - CORRECT ANSWERS ✔✔prints 0 to 24
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
ruby: write a statement that returns the length of your name -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔"tania".length |\ |\
ruby: write a statement that reverses the word "exam" -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔"exam".reverse |\ |\
ruby: write a statement that prints "Tania" in uppercase -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔puts "Tania".upcase |\ |\ |\
, ruby: write a statement that prints "Tania" in lowercase -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔puts "Tania".downcase |\ |\ |\
ruby: write a statement that asks for the users first name and
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
prints the result in the following format: Your first name is
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
(name). The name should be capitalized - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔puts "What is your first name?"
|\ |\ |\ |\ |\
name = gets.chomp |\ |\
puts "Your first name is #{name.capitalize!}"
|\ |\ |\ |\ |\
ruby: write a for loop that prints all even numbers between 1 and
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
20 - CORRECT ANSWERS ✔✔for i in 1..20
|\ |\ |\ |\ |\ |\ |\ |\
|\ next if i % 2 != 0
|\ |\ |\ |\ |\ |\
|\ puts i |\
end
ruby: write a looping using until that prints numbers 1 to 20 -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔num = 1 |\ |\ |\ |\
until num > 10
|\ |\ |\
|\ puts num |\
|\ num += 1 |\ |\
end
What does the following code output?
|\ |\ |\ |\ |\
def call_block
|\ |\
|\ puts 'Start of method'
|\ |\ |\ |\
|\ |\ |\ |\ |\ |\
WITH ANSWERS |\
github: what is a repository? - CORRECT ANSWERS ✔✔a working
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
tree + store + index
|\ |\ |\ |\
github: what is a working tree? - CORRECT ANSWERS ✔✔the
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
project itself |\
github: what is a store? - CORRECT ANSWERS ✔✔hidden
|\ |\ |\ |\ |\ |\ |\ |\ |\
directory (.git) in root directory of working tree
|\ |\ |\ |\ |\ |\ |\
|\ User never accesses .git directly
|\ |\ |\ |\
|\ Store records project development history
|\ |\ |\ |\
github: what is history? - CORRECT ANSWERS ✔✔DAG of commits
|\ |\ |\ |\ |\ |\ |\ |\ |\
Each commit represents a complete snapshot of the entire
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
project
github: what is an index? - CORRECT ANSWERS ✔✔virtual
|\ |\ |\ |\ |\ |\ |\ |\ |\
snapshot stored in .git/index|\ |\ |\
github: what is a branch? - CORRECT ANSWERS ✔✔a pointer to a
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
commit
,github: command to create a new branch - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔git branch nameOfBranch
|\ |\
github: change to branch titled 'fix' - CORRECT ANSWERS ✔✔git
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
checkout fix |\
github: add and commit changes to local store - CORRECT
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
ANSWERS ✔✔git add --all . |\ |\ |\ |\
git commit
|\
github: problem on slide 42
|\ |\ |\ |\
http://web.cse.ohio-state.edu/~giles/3901/lectures/lecture02.pdf -
|\ |\
CORRECT ANSWERS
|\ |\ |\
✔✔http://web.cse.ohio-state.edu/~giles/3901/lectures/lecture02.p
df
ruby: what is the following range 0..4 - CORRECT ANSWERS ✔✔0,
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
1, 2, 3, 4
|\ |\ |\ |\
ruby: what is the following range 0...4 - CORRECT ANSWERS ✔✔0,
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
1, 2, 3
|\ |\ |\
ruby: what does the <=> operator do? - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔Returns -1/0/1 if LHS is smaller/equal/larger than RHS
|\ |\ |\ |\ |\ |\ |\
,ruby: what does "cab" <=> "da" return? - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔-1
ruby: what does "cab" <=> "ba" return? - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔1
i = 34
|\ |\
j = i # i and j are aliases
|\ |\ |\ |\ |\ |\ |\ |\
j = j + 1 # does this increment i too?
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
what is the value of i and j? - CORRECT ANSWERS ✔✔i = 34, j =
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
35
what does the following statement do?
|\ |\ |\ |\ |\
i = 10
|\ |\
25.times { | i | puts i } - CORRECT ANSWERS ✔✔prints 0 to 24
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
ruby: write a statement that returns the length of your name -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔"tania".length |\ |\
ruby: write a statement that reverses the word "exam" -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔"exam".reverse |\ |\
ruby: write a statement that prints "Tania" in uppercase -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔puts "Tania".upcase |\ |\ |\
, ruby: write a statement that prints "Tania" in lowercase -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔puts "Tania".downcase |\ |\ |\
ruby: write a statement that asks for the users first name and
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
prints the result in the following format: Your first name is
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
(name). The name should be capitalized - CORRECT ANSWERS
|\ |\ |\ |\ |\ |\ |\ |\ |\
✔✔puts "What is your first name?"
|\ |\ |\ |\ |\
name = gets.chomp |\ |\
puts "Your first name is #{name.capitalize!}"
|\ |\ |\ |\ |\
ruby: write a for loop that prints all even numbers between 1 and
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
20 - CORRECT ANSWERS ✔✔for i in 1..20
|\ |\ |\ |\ |\ |\ |\ |\
|\ next if i % 2 != 0
|\ |\ |\ |\ |\ |\
|\ puts i |\
end
ruby: write a looping using until that prints numbers 1 to 20 -
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
CORRECT ANSWERS ✔✔num = 1 |\ |\ |\ |\
until num > 10
|\ |\ |\
|\ puts num |\
|\ num += 1 |\ |\
end
What does the following code output?
|\ |\ |\ |\ |\
def call_block
|\ |\
|\ puts 'Start of method'
|\ |\ |\ |\