- If you were to count in base 8, what would the next three numbers be?
1, 2, 3, 4, 5, 6, _, _, _- If you were to count in base 14, what would the next three numbers be?
1, 2, 3, 4, 5, 6, 7, 8, 9, _, _, _- If you were to count in base 5, what would the next three numbers be?
3, 4, _, _, _- If you were to count in base 15, what would the next three numbers be?
A, B, C, D, E, _, _, _-
What are the next 9 numbers after 3 in base 4?
-
What are the next 9 numbers after 8 in base 13?
-
Convert 10011001 to hexadecimal.
-
Convert 10011101 to hexadecimal.
-
Convert 11011011 to hexadecimal.
-
Convert 010111110001 to hexadecimal.
-
Convert 10011001 to decimal.
-
Convert 10001101 to decimal.
-
Convert 110010011001 to decimal.
-
Convert 1001100110101111 to decimal.
-
Convert 138 to hexadecimal.
-
Convert 3610 to base 7.
-
Convert 2411 to base 5.
-
Convert 123 to base 9.
-
Convert 2267 to base 13.
-
Convert 2A16 to decimal.
-
Convert 55516 to decimal.
-
Given the hex color #5f1f6c, write what the values of each R, G, and B would be in base 10.
-
Given the hex color #221BFF, write what the values of each R, G, and B would be in base 10.
- Given any decimal number write some pseudocode inside of a ruby method that describes the way in which you'd convert the decimal to binary using only ruby. You cannot use built in ruby methods like
to_s.
-
Write a method that will convert any base 10 integer passed as an argument to binary without using any built in ruby functions like
to_s -
Write a method that will convert any base 10 integer passed as an argument to Base 8 without using any built in ruby functions like
to_s -
Write a method that will convert any base 10 integer passed as the first argument to a base specified as the second argument without using any built in ruby functions like
to_s
- Fill in the β§ (AND) truth table.
| A | B | A β§ B |
|---|---|---|
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
- Fill in the β¨ (OR) truth table.
| A | B | A β¨ B |
|---|---|---|
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
The β symbol represents an XOR in truth tables and bitwise operations (and it is the symmetric difference in set theory, which is different).
- Fill in the β (XOR) truth table.
| A | B | A β B |
|---|---|---|
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
-
1100 β§ 0111 = ?
-
1100 β¨ 0111 = ?
-
1100 β 0111 = ?
-
0101 β§ 1001 = ?
-
Β¬0110 = ?
Answer the following questions as decimal.
-
910 β§ 1010 = ?
-
910 β¨ 1010 = ?
-
910 β 810 = ?
-
1210 β§ 1010 = ?
-
7510 β 3210 = ?
-
32110 β 9710 = ?
Answer the following questions as hexadecimal.
-
F316 β 316 = ?
-
A216 β§ 3116 = ?
-
0110 << 2 OR 1100 >> 2 = ?
-
1111 << 1 OR 1100 >> 2 = ?
-
17 << 2 AND 90 >> 1 = ?
-
65 << 4 OR 36 >> 2 = ?
A = "you are older than 13"
B = "you are with your parents"
C = "you can attend a PG-13 movie" - Given the variables above write a logic statement to represent "if you are older than 13 or you are with your parents then you can attend a PG-13 movie".
B = "I like football"
W = "I am going to watch a game"
S = "today is Saturday"
F = "football is on today"
- Given the variables above write a logic statement which would evaluate to true if all of the above conditions are true.
For the next few questions write out the resultant set.
A = {2,4,6}
B = {3,6,9}- B - A = ?
C = {4,6,8}
D = {7,8,9}- C βͺ D = ?
E = {7,8,1}
F = {1,3,5}- E β© F = ?
G = {2, 3, 7, 8, 9}
H = {2, 8}
I = {4, 6, 7, 10}- G βͺ I - H = ?
A = {2,3,7,4,1,8,9}-
Given A what is {π₯ | x β A; π₯ > 0; π₯ β€ 4}?
-
Given A what is {π₯ | x β A; π₯ > 2; π₯ β€ 3}?
-
Given A what is {π₯ | x β A; π₯ β₯ 7; π₯ < 10}?
-
Given A what is {π₯ | x β A; π₯ β₯ 6; π₯ β€ 8}?
-
{π₯ | π₯ β β, π₯ > 2 β§ π₯ < 8}
-
{π₯ | π₯ β β, π₯ > 3 β§ π₯ < 7}
A = {1,2,3}
B = {3,4,5} - A β B = ?
C = {2, 3, 7, 8, 9}
D = {2, 8}
E = {4, 6, 7, 10}- C β E - D = ?
F = {b,g,w,h,k,a}
G = {w,a,k,e,y}-
F βͺ G β F β© G = ?
-
F β G = ?
-
{π₯ | π₯ββ; π₯ mod 5 = 0 β§ x < 25}
-
{π₯ | π₯ββ; π₯ mod 10 = 0 β§ x β€ 70}
-
Given a set of Coder Academy students that study in Melbourne, and a domain of all the students across all Coder Academy campuses (Melbourne, Sydney, Brisbane), what is the complement of the Coder Academy students in Melbourne?
-
Given a set of players in the AFL who've played over 100 games, and a domain of all players in the AFL, what is the complement the set of players who've played over 100 games?
A = {1,2,3,4}
B = {1,2,3,4,5}- Given a set A, and the domain of B, what is the complement of A?
- Order the following time complexities from fastest to slowest
- O(1)
- O(n log n)
- O(n^2)
- O(n)
- O(log n)
- O(2^n)
You're asked to guess a number between 1 and 50 that your teacher is thinking of.
-
What's the maximum possible guesses it would take to find this number using linear search? Whats the time complexity?
-
What's the maximum possible guesses it would take to find this number using binary search? Whats the time complexity?
- There is a set A of n numbers that are unsorted. There is a set B of n numbers that are unsorted. You want to write a function to merge these two sets together to ensure that you return one sorted set. Is there a faster way than O(n2)? If so, describe how it would work and what the Big O would achieve?
For the following questions you're in this real life situation: you are given a phone book (like the yellow pages), the phone book has businesses which have unique names. The names are sorted by alphabetical order.
-
Your boss tells you to find the phone number of "Coder Academy". They say the phone number is on page 102. Is there a faster way to find the phone number than O(n)? If so, describe how it would work?
-
Your boss tells you to find "Coder Academy" again but this time you're just given the business name. Is there a faster way to find the phone number than O(log n)? If so, describe how it would work?
- What is the time complexity of the following code in Big O?
def get_last(items)
items[items.length - 1]
end - What is the time complexity of the following code in Big O?
def find_index(items, match)
index = 0
while index < items.length - 1
if items[index] == match
return index
end
index += 1
end
return -1
end - What is the time complexity of the following code in Big O?
def build_square_matrix(items)
matrix = []
index_one = 0
index_two = 0
while indexOne < items.length - 1
matrix[indexOne] = []
indexOne += 1
while indexTwo < items.length - 1
matrix[indexOne].push(items[indexTwo])
indexTwo += 1
end
end
return matrix
end- If you were to make a change to improve the code, what change would you make? What would be the time complexity after the change?
def find_num_in_array(num, arr)
found_num = nil
arr.each do |item|
if item == num
found_num = item
end
end
if !found_num
return 'num not in array'
else
return found_num
end
end
result = find_num_in_array(1, [3, 1, 5])- If you were to make a change to improve the code, what change would you make? What would be the time complexity after the change?
def is_num_in_array(num, arr)
middle_index = arr.length / 2
if arr[middle_index] == num
return true
end
if middle_index == 0
if num == arr[middle_index]
return true
else
return false
end
end
if num < arr[middle_index]
arr.slice!(middle_index..(arr.length - 1))
else
arr.slice!(0..middle_index)
end
is_num_in_array(num, arr)
end
result = is_num_in_array(4, [1,2,3,4,5,6])- If you were to make a change to improve the code, what change would you make? What would be the time complexity after the change?
arr_of_arrays = [
[1,2,3,4],
[5,6,7,8]
]
def is_num_in_arrays(passed_int, arr_of_arrays)
arr_of_arrays.each do |array|
array.each do |int|
if int == passed_int
return true
end
end
end
return false
end
result = is_num_in_arrays(7, arr_of_arrays)A = [[2,4],[3,6]]- What is 5A?
B = [[3,4],[2,1]]- What is 2B?
- Follow the instructions below.
Given:
A = [[2,4],[3,6]]
B = [[1,2],[3,4]]- a. What is A + B?
- b. What is A - B?
- c. What is A Γ B?
- What is C Γ D, given the following?
C = [[1,2,3], [4,5,6]]
D = [[7,8],[9,10],[11,12]]- What is E Γ F, given the following?
E = [[3,4,2]]
F = [[13,9,7,15], [8,7,4,6], [6,4,0,3]]- Given the following:
A = [[2,4],[3,6]]
B = [[1,2],[3,4]]What is AT x B?
- Given:
X = [[3,4],[2,1]]a. What is X β XT?
b. What is X Γ XT?
- What type of graph this?
- What type of graph is this?
- Find the shortest path across all nodes.
- Find the shortest path across all nodes.
- Find the shortest path across all nodes.
- Convert the following graph to an edge list.
- Convert the following graph to an edge list.
- Convert the following matrix to a graph.
-
What type of graph this?
-
Find the shortest path starting at A and ending at E.
-
Convert the following matrix to a graph. You'll have nodes from G0 to G8.
- Find the shortest path between G0 and G8
- Convert the following matrix to an edge list.
-
Using either the edge list or the matrix draw a graph.
-
Find the shortest path starting at E and ending at S.
- Draw out the graph for:
(S,5,A),(S,2,B),(A,4,C),(B,8,A),(C,6,D),(A,2,D),(C,3,F),(D,1,F)-
Find the shortest path from S to F in the graph?
-
Find the shortest path from A to Z.
- Find the shortest path from A to Z.
- Given the following equation and domain, what is the sum? Note that to view the sum symbol correctly you need to be using Safari or Chrome.
4
f(X) = β² xi2
β³
i=0
X = [4, 7, 9, 2, 1]
- Given the following information, which relations (pairs) are in A?
{ (x, y) Ο΅ A | x β₯ y }
X = [(1,2), (2,2), (20, 21), (21, 20)]-
What type is the relation above (reflexive, symmetric, transitive)?
-
Given the following information, which relations (pairs) are in T?
{ (x,y) Ο΅ T | x Ο΅ β; y Ο΅ β; y β₯ 6x + 1 }
X = {(2,7), (3,1), (3,0), (10,101), (4,6)}- Given the following information, which relations (pairs) are in D?
{ (x,y) Ο΅ D | x Ο΅ β; y Ο΅ β; y β₯ 20; x < 10 }
X = {(1,1), (29,10), (10,10), (9,20)}-
State a real world example for reflexivity, symmetry, and transitivity.
-
Is "sibling" a reflexive relation? Explain.
-
What type of relation is it (for sibling)?
nums = [-2, 0, 1, 2]-
Given this equation f(x) x2 + 5, if we're mapping
numsover f(x), what are the elements in the domain? -
Given this equation f(x) x2 + 5, if we're mapping
numsover f(x), what are the elements in the range?







