- What's the JS Global Object?
- Give a high level overview of how to implement a Linked List.
- Build a Linked List class.
- Linked List
- Reach out to 2 people
- Apply to 5 jobs
Welcome to the end of Week 4! The next step is to double down on what you've learned, and prepare for the HackerRank test that will be sent to your email address. The first step is to work through this practice test to have an idea of what to expect on the HackerRank exam.
Before you dive into the HackerRank test, it's important to review. We use the HackerRank test results to gauge your progress in the job search guide, so you'll want to make sure you are as prepared as possible. If you struggle on this practice exam, be sure to review flash cards!
Make an honest effort with these problems. An answer key is at the bottom of the page, but try and review your notes and readings before referring to these.
- Choose the correct statement(s) about BSTs
- A) Pre-order traversal visits all parent nodes before their children
- B) BSTs must be complete in order to be traversed with in-order traversal
- C) Post-order traversal alone can be used to reconstruct a BST
- D) In-order traversal alone can be used to reconstruct a BST
- E) A BST is balanced if the heights of its left tree and its right tree differ by no more than 1
- D) If you have nodes of value 3 and value 10, and the root is of value 5, then the root is guaranteed to be the Least Common Ancestor of the two nodes
- E) Finding the Least Common Ancestor of two nodes has a time complexity of nlog(n) because you must look at each child as you move up or down the tree
- F) Deleting a node in a BST requires having a
.parent
method on the node
- Given this code, which statement(s) evaluate(s) to
true
?
const a = 'string';
const b = 'string';
const c = '1';
const d = 1;
const e = a;
const f = [1,2,3];
const g = [1,2,3];
const h = f;
const i = {
'name': ['object']
};
const j = {
'name': i.name
};
const k = new String('string');
const l = k;
- A)
a === b
- B)
c === d
- C)
c == d
- D)
e === a
- E)
f === g
- F)
h === f
- G)
h === g
- Choose the correct statement(s) about Networking and Scalability
- A) Manchester coding is a strategy to deal with clock slip
- B) Round Robin DNS binding is handled by the load balancer at the request destination
- C) Session stickiness refers to the need for users to be able to log back into their account and have access to the data that was transmitted in past requests
- D) Clock slip is not an issue when you have a checksum attached to the transmitted packet
- E) RAID0 allows you to use multiple hard drives as one, but does not give you the ability to recover data if one of them fails
- F) Sending the actual server id back to the requester in a cookie is not feasible because you don't want to expose private IP addresses
- G) Caching compiled assets in memory can't increase server response times because it is expensive to determine which assets need to be cached
- Choose the correct statement(s) about prototypal inheritance
- A) An object created with
Object.create(a)
will share a prototype witha
- B) Object.assign() is used to compose objects with only the features they need
- C) Object.assign takes in an object and an arbitrary number of subsequent objects, merges them all with the first object and returns a brand new object
- D) Calling super() in the constructor lets you choose which properties you want to inherit
- Given this code, what will be logged?
let a = {name: "A"};
let b = Object.create(a);
b = Object.assign(b, {count: 1});
console.log(b);
let c = Object.assign(a, {height: 2});
console.log(b.height);
console.log(b.__proto__ === a);
console.log(c === a);
a.name = "new name";
console.log(b.name);
- A)
{ count: 1 }
2
true
true
'new name'
- B)
{ count: 1 }
undefined
true
true
undefined
- C)
{name: "A", count: 1 }
2
false
true
'new name'
- D)
{name: "A", count: 1 }
2
true
false
'new name'
- E)
{ count: 1 }
undefined
true
false
undefined
- Given this code, what will be logged?
const dFact = function(name) {
const message = `Hello, ${name}`;
return {greet: message};
};
const d = dFact('Bob');
console.log(d.greet);
d.name = 'Alice';
console.log(d.greet);
const dee = Object.assign(new dFact("Cody"), {age: 10});
console.log(dee);
console.log(d.__proto__ === dee.__proto__);
- A)
Hello, Bob
Hello, Bob
{ greet: 'Hello, Cody', age: 10 }
false
- B)
Hello, Bob
Hello, Alice
{ greet: undefined, age: 10 }
true
- C)
Hello, Bob
Hello, Alice
{ greet: 'Hello, Cody', age: 10 }
true
- D)
Hello, Bob
Hello, Bob
{ greet: 'Hello, Cody', age: 10 }
true
- E)
Hello, Bob
Hello, Bob
{ greet: undefined, age: 10 }
false
- Choose the correct statement(s) about AVL trees
- A) AVL trees require completeness at all times
- B) AVL trees cannot delete in log(n) time because they may have to perform tree rotations
- C) In a right tree rotation the right tree of the rotating node becomes the left tree of its parent
- D) In a rightleft double rotation the left tree of the rotating node becomes the left tree of its grandparent
- E) As long as the root node is balanced, not every subtree needs to be an AVL tree for the entire tree to be considered an AVL tree
- F) AVL trees are incompatible with heapsort
- Choose the correct statement(s) about the JS global object
- A) Both node.js and browser JS engines share a reference to the same global object
- B) The global object can be used to check whether a function or object is available in the browser API
- C)
let
andconst
can be defined on the global object as long as you do so in the highest scope - D) The global object can be used to access information about the visual layout of the window
Answer Key
- A, C, D
- A, C, D, F
- A, E, F
- B
- A
- D
- C, F
- B, D