Guest User

Untitled

a guest
Oct 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.27 KB | None | 0 0
  1. 1. At this moment I am interested in Dev .I am self-taught JavaScript developer , there are my first steps in programming , I think I would like to learn QA after 2-3 years working as web developer.
  2. Attention to details and dev experience will help me in QA department.
  3.  
  4. 2. My favorite programming language is JavaScript.
  5. JavaScript is easy to Learn, JavaScript is fast and the most-used language.
  6. JavaScript is used everywhere in the web. There are numerous books, forums, blogs, documentations, tutors, videos to learn JavaScript.
  7.  
  8. 3. A linked list is an ordered, linear structure, similar to an array.Each link in the chain is called a node.
  9. We all work with linear and non-linear data structures everyday.Trees and graphs are also non-linear data structures.
  10.  
  11. A linked lists are objects nested deeply inside of each other.
  12.  
  13. const list = {
  14. head: {
  15. value: 12
  16. next: {
  17. value: 99
  18. next: {
  19. value: 37
  20. next: null
  21. }
  22. }
  23. }
  24. };
  25.  
  26. A linked list has items accessible only through the parent object.
  27.  
  28. for example we can access item 37 by list.head.next.next.value;
  29. The only way to get to a value in the list is to start at the beginning, the head, and traverse our way down until we get to what we’re looking for.
  30.  
  31. 4. I can call my friends help me or pay people to work with me.
  32.  
  33. 5. Check if pen is writing smoothly with continuous and not breaking while writing on paper or on my hand.
  34.  
  35. 6. At first I will test is syntax clear. For quick understanding code I would like to see comments.
  36.  
  37. 7.
  38. let list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12];
  39. let firstNum = 1;
  40.  
  41. function findMissNum (list) {
  42. for(var i = firstNum; i < list.length; i++) {
  43. if(list[i] - list[i-1] != 1) {
  44. console.log(i+1);
  45. break;
  46. }
  47. }
  48. }
  49. findMissNum (list);
  50.  
  51. 8.
  52. Threre are 12 hours , complete turn is 360° => 1 hour = 360 / 12 = 30°
  53. angle between the hour-hand and minute-hand of a clock at 3:20 => 30° - (30° / 3) => 20°
  54.  
  55. 9.
  56. var powOfTwo = 126;
  57.  
  58. function isPowOfTwo (powOfTwo) {
  59. let outPut = false;
  60. if (powOfTwo <= 1) {
  61. return outPut;
  62. } else {
  63. while(powOfTwo >= 1) {
  64. powOfTwo = powOfTwo / 2;
  65. if (powOfTwo === 1) {
  66. outPut = true;
  67. break;
  68. }
  69. }
  70. }
  71. return outPut;
  72. }
  73. console.log(isPowOfTwo (powOfTwo));
  74.  
  75. 10.
  76. Example 1
  77. let arr = [1, 2, 3, 3, 2, 5, 1];
  78.  
  79. function removeDublicates (arr) {
  80. return arr.filter((elem, index) => arr.indexOf(elem) === index);
  81. }
  82. console.log(removeDublicates (arr));
  83.  
  84. Example 2
  85. let arr = [1, 2, 3, 3, 2, 5, 1];
  86. let length = arr.length;
  87. let uniques = [];
  88. let indices = [];
  89. for (let i = 0; i < length; i++) {
  90. indices[arr[i]] = arr[i]; //indices[1] = 1 => indices = [undefined, 1];
  91. console.log(indices);
  92. }
  93. let iLength = indices.length;
  94. for (let j = 0; j < iLength; j++) {
  95. if(indices[j] !== undefined) {
  96. uniques.push(indices[j]);
  97. }
  98. }
  99. console.log(uniques);
  100.  
  101. 11.
  102. let str = "abcdefghhhh";
  103.  
  104. function isUnique(str) {
  105. for (let i = 0; i < str.length; i++) {
  106. for (let j = 1 + i; j < str.length; j++) {
  107. if (str[i] === str[j]) {
  108. return false;
  109. }
  110. }
  111. }
  112. return true;
  113. }
  114.  
  115. console.log(isUnique(str));
  116.  
  117. 12.
  118. Example 1 (using recursion)
  119. let str = "JavaScript";
  120. function reverse(str) {
  121. if(str.length === 1) {
  122. return str;
  123. }
  124. return reverse(str.substr(1)) + str[0];
  125. }
  126. console.log(reverse(str));
  127.  
  128. Example 2
  129. let str = "JavaScript";
  130. let emptyStr = "";
  131. let length = str.length;
  132.  
  133. function reverseStr (str) {
  134. for (let i = length-1; i >= 0; i--) {
  135. emptyStr = emptyStr + str[i];
  136. }
  137. return emptyStr;
  138. }
  139.  
  140. console.log(reverseStr (str));
  141.  
  142. 13.
  143. let str = "AAABCCDDDD";
  144.  
  145. function stringCompression (str) {
  146. if (str.length == 0) {
  147. console.log("Try again");
  148. return;
  149. }
  150. var output = "";
  151. var count = 0;
  152. for (var i = 0; i < str.length; i++) {
  153. count++;
  154. if (str[i] != str[i+1]) {
  155. output = output + str[i] + count;
  156. count = 0;
  157. }
  158. }
  159. let string = "";
  160. for (let i = 0; i < output.length; i++) {
  161. if (output[i] !== "1") {
  162. string = string + output[i]
  163. }
  164. }
  165. console.log(string);
  166. }
  167.  
  168. stringCompression (str);
  169.  
  170. 14.
  171. Example 1
  172. let array = [0, 1, 1, 1, 0, 0, 1];
  173. array.sort((a, b) => a - b);
  174. console.log(array);
  175. Example 2
  176. let array = [0, 1, 1, 1, 0, 0, 1];
  177.  
  178. Example 2
  179. function sortNumers (array) {
  180. let zeros = [];
  181. let ones = [];
  182. for (let i = 0; i < array.length; i++) {
  183. if (array[i] === 0) {
  184. zeros.push(array[i]);
  185. } else {
  186. ones.push(array[i]);
  187. }
  188. }
  189. return zeros.concat(ones);
  190. }
  191.  
  192. console.log(sortNumers (array));
  193.  
  194. 15.
  195. I have 8 years experience of designing roadways and highways with AutoCAD and AutoCAD Civil 3d, and it will pleasant work for me design(with AutoCAD 3d) vending machine or a toaster.
  196.  
  197. 16.
  198. I can start dropping first lightbulb from 10 floor, If it doesn't break, then move up and continue dropping lightbulb from 20 floor, then from 30 floor etc..... untill it breaks. If the lightbulb breaks I can move down 9 floors and start moving up and start dropping second lightbulb in increments of one until the second lightbulb breaks.
  199. The worst case will when i reach at 100 floor , with first lightbulb, and 99 floor with second lightbulb(19 drops).
  200. The answer is 6 In worst case and 2 in best case.
  201.  
  202. 17.
  203. We can install pillars on the intersection of the 2 walls, on corners of the room.
  204. 18.
  205.  
  206. We can divide all the balls into 3 groups and give them names A, B, C.
  207. In worst case we can find heavier or lighter group after 3 time weighing.
  208. In best case we can find heavier or lighter group after 1 time weighing.
  209. (for example A = B => C is heavier or lighter).
  210. Then we weigth 2 balls from group C.
  211. In worst case we find heavier or lighter ball after 3 time weighing.
  212. In best case we find heavier or lighter ball after 3 time weighing.
  213.  
  214. 19.
  215.  
  216. 20.
  217. let str1 = "abracadabra";
  218. function is_Palindrome(str1) {
  219. var rev = str1.split("").reverse().join("");
  220. return str1 == rev;
  221. }
  222.  
  223. function longest_palindrome(str1){
  224.  
  225. var max_length = 0,
  226. maxp = '';
  227.  
  228. for(var i = 0; i < str1.length; i++) {
  229. var subs = str1.substr(i, str1.length);
  230.  
  231. for(var j=subs.length; j >= 0; j--) {
  232. var piece = subs.substr(0, j);
  233.  
  234. if (piece.length <= 1)
  235. continue;
  236. console.log(piece);
  237. if (is_Palindrome(piece)) {
  238.  
  239. if (piece.length > max_length) {
  240.  
  241. max_length = piece.length;
  242. maxp = piece;
  243. }
  244. }
  245. }
  246. }
  247.  
  248. return maxp;
  249. }
  250. console.log(longest_palindrome("abracadabra"));
Add Comment
Please, Sign In to add comment