Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. # Exercises
  2.  
  3. ## Javascript
  4.  
  5. 1. What value is now stored in the variable name?
  6. ```
  7. var isKing = true;
  8. var name = isKing ? ‘Arthur’ : ‘Hank’;
  9. ```
  10.  
  11. 2. What is the difference between == and === in Javascript?
  12.  
  13. 3. Write a function that takes two numbers as arguments and returns the sum of the two numbers in Javascript
  14.  
  15. 4. Write a function that takes an array as an argument and prints out the numbers in the array that are greater than 5 (for example foo([3,6,1,7]) would print out 6 and 7) in Javascript
  16.  
  17. 5. Write a for loop that will iterate from 0 to 20. For each iteration, it will check if the current number is even or odd, and report that to the screen in Javascript
  18.  
  19. 6. What does 'this' refer to when used in a Java method?
  20.  
  21. 7. Create an object that has properties with name = "fred" and major="music" and a property that is a function that takes 2 numbers and returns the smallest of the two, or the square of the two if they are equal.
  22.  
  23. 8. What’s the result of executing this code and why?
  24. ```
  25. function test() {
  26. console.log(a);
  27. console.log(foo());
  28.  
  29. var a = 1;
  30. function foo() {
  31. return 2;
  32. }
  33. }
  34.  
  35. test();
  36. ```
  37.  
  38.  
  39. ## Ruby
  40.  
  41. 1. Describe what a class is in Ruby in a few sentences.
  42.  
  43. 2. Write a function that takes two numbers as arguments and returns the sum of the two numbers in Ruby
  44.  
  45. 3. What is similar and what is different between the this implementation and the one in Javascript (exercise 3)?
  46.  
  47. 4. Write a function that takes an array as an argument and prints out the numbers in the array that are greater than 5 (for example foo([3,6,1,7]) would print out 6 and 7) in Ruby
  48.  
  49. 5. What is similar and what is different between the this implementation and the one in Javascript (exercise 4)?
  50.  
  51. 6. Write a for loop that will iterate from 0 to 10. For each iteration of the for loop, it will multiply the number by 9 and log the result (e.g. "2 * 9 = 18") in Ruby
  52.  
  53. 7. Classes
  54.  
  55. a. Create a Celsius class, that takes the temperature as a parameter.
  56.  
  57. b. In that same class, define a method that returns the temperature in Fahrenheit. For the conversion we can use the formula temperature*1.8 + 32. Round up the result so it doesn’t contain any decimal values.
  58.  
  59. c. In that same class, create a to_s method, that returns the Celsius temperature formatted e.g. 16 degrees C
  60.  
  61.  
  62. ## Git
  63.  
  64. 1. Assume that you created a new file in a project. What would you do to start tracking it under git (let's assume that the direktory you are currently in already exists)?
  65.  
  66. 2. In the morning, what would you do to make sure you have the most current git branch on your local machine?
  67.  
  68.  
  69. ## Command line
  70.  
  71. 1. How would you create a new folder named 'new_folder' in the command line?
  72.  
  73. 2. Assuming you created that folder, how would you access that folder using the command line?
  74.  
  75.  
  76. ## HTML
  77.  
  78. 1. What is an 'ul' and an 'ol' in HTML? What are the similarities and differences?
  79.  
  80. 2. What is the HEAD and BODY in HTML? What would both contain?
  81.  
  82. 3. How would you require a javascript file (for instance test.js, which is on the same level as the HTML) in HTML?
  83.  
  84. 4. How qould you require a css file (for instance test.css, which is two level deeper as the HTML) in HTML?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement