Unit 4: Trivia
Rules
- Organize according to your houses
- There are 4 Categories, each with 4 Questions
- Write your answers on a whiteboard
- After each category teams can wager up to 4 points on a challenge question
The Prize
Knowledge!
And a Udemy course of $10 or less
SQL & Promises
Write a SQL statement that will select the id & name from a table called pets.
Answer: SELECT id, name FROM pets;
Imagine we have a table called students with a column called age. Write a SQL statement that will return the oldest student.
Answer: SELECT * FROM students ORDER BY age DESC LIMIT 1;
What will the following log?
Answer: Success: false
Promise.resolve(false)
.then(result => {
console.log('Success:', result)
})
.catch(error => {
console.log('Error:', error)
})
Answer: glass
Will the id logged be related to a cocktail or a glass?
knex('cocktails')
.join('glasses',
'glasses.id',
'cocktails.glass_id')
.then(results => {
console.log(results[0].id)
})
Answer: The server will likely respond with undefined.
CHALLENGE:
What will happen when this route is hit?
router.get('/languages/:id', (req, res) => {
let language
knex('languages').where({ id: req.params.id })
.then(languages => {
language = languages[0]
})
res.send(language)
})
AngularJS
Name at least two other front-end frameworks/libraries besides AngularJS.
Answer: Angular, Ember, React, Vue, Knockout, Backbone...
ng-repeat, ng-class, and
ng-if are called what in AngularJS
Answer: builtin directives
Forms in AngularJS come with some special properties like $dirty. Name two others.
Answer: $valid, $invalid, $pristine, $touched, $error, $submitted, $pending
When using ui-router, what does the base element do when added to your index?
Answer: Modifies the prefix for your SPA routes
Describe two of the binding symbols and what they do.
Answer:
< is for one-way binding
= is for two-way binding
@ is for one-way binding with strings
& is for passing functions
CHALLENGE:
Computer Science
Reduce the following Big O expression:
O(n^3 + n) + O(2n)
Answer: O(n^3)
What is the Big O notation of Insertion Sort?
Answer: O(n^2)
What kind of objects get deallocated by the garbage collector?
Answer: Anything that does not have a reference to it
You are running a program where inserting often. Should you use an Array or a Linked List?
Answer: Insertions in Linked Lists are O(1) in the worst case scenario
Consider all the operations you can perform on a Tree. What is the worst time complexity out of all of them?
Answer: O(log n) for all of them
CHALLENGE:
Unfamiliar Code
What will be returned?
Answer: [:magic]
["ruby", :magic, 42].reject do |w|
w.class != Symbol
end
What will be returned?
Answer: {"big": "foot", "loch": "ness"}
def keyword_args(**kwargs):
return kwargs
keyword_args(big="foot", loch="ness")
What will be returned?
Answer: [ 0, 1, 2, 3, 4, 5 ]
0 :: List.range 1 5
What will be returned?
Answer: Hello world!
CHALLENGE:
Answer: 30
(defn someFn [x y]
(+ (+ x x) (+ y y)))
(someFn 5 10)
Tie Breaker!
Name as many programming languages you can think of.
Go!
Name as many native node modules as possible.
Go!
Unit 4 Trivia
By Wes Reid
Unit 4 Trivia
- 659