Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Instructions
- 1. Fork this Gist
- 2. Edit to add your answers
- 3. Send to your mentor
- No cheating! Be open and honest about what you know.
- # Practice Questions
- 1. Which HTML 5 tag would you use to semantically wrap your page navigation?
- **Answer:**
- `<nav>` tag
- 2. What is the difference between a block level and an inline element in HTML?
- **Answer:**
- Block level takes up entire line whereas inline elements can be on one line.
- 3. What is wrong in the following HTML?
- ```html
- <div class="someClass" id="someID">
- Check this out!
- </div>
- <div class="someClass" id="someID">
- No, look at this instead.
- </div>
- ```
- **Answer:**
- id attributes are required to be unique.
- 4. How would you create a new folder named `testFolder` with the command line?
- **Answer:**
- `mkdir testFolder`
- 5. How would you enter this folder?
- **Answer:**
- `cd testFolder`
- 6. Given you are now in this folder, how would you check if git has already been initialized in that folder?
- **Answer:**
- `git status`
- 7. If git has not yet been added to that folder, how would you add it?
- **Answer:**
- `git init`
- 8. Which industry vertical are you interested in and why?
- **Answer:**
- Pretty open, but ecommerce and fintech are industries I've had previous experience in.
- 9. Using Javascript, please write a function foo, that takes two arguments, an array and a number, and returns true if the length of the array is equal to the second argument? E.g. `foo([1, 2, 3], 3)` would return true.
- **Answer:**
- ```javascript
- function foo(x, y) {
- if (x.length == y) {
- return true;
- }
- else {
- return "Array length is not equal to " + y
- }
- };
- foo([1, 2, 3], 3);
- ```
- 10. Write a loop in Javascript, iterating over the array [1, 2, 3, 4] printing out if the element is either the first element (print `first - `), the last element (print `last`) or neither first or last element (print `not first or last -`). E.g. the expected output would be (`first - not first or last - not first or last - last`).
- **Answer:**
- ```javascript
- function loop(n) {
- for (i = 0; i < n.length; i++) {
- //first element
- if (i === 0) {
- console.log('first - ');
- }
- //last element
- else if (i === (n.length - 1)) {
- console.log('last');
- }
- //neither first or last element
- else {
- console.log('not first or last -');
- }
- }
- };
- var test = [1, 2, 3, 4, 5]
- loop(test);
- ```
- 11. Print all numbers from 15 - 0 to the console using a for loop in JS.
- **Answer:**
- ```javascript
- function printNum() {
- for (n = 15; n >= 0; n--) {
- console.log(n);
- }
- };
- printNum();
- ```
- 12. What would the console print in following example
- ```javascript
- function outer(input) {
- var a = input;
- function inner(multiplier) {
- console.log(a * multiplier);
- }
- return inner;
- }
- var firstResult = outer(9);
- firstResult(10);
- ```
- **Answer:**
- It would print 90.
- 13. Add the missing code to print "this is A" to the console by accessing the property from the JS object literal.
- ```javascript
- var someObject = {b : "some test", a : "this is A"};
- console.log("*Your code here*");
- ```
- **Answer:**
- ```javascript
- var someObject = {b : "some test", a : "this is A"};
- console.log(someObject.a);
- ```
Add Comment
Please, Sign In to add comment