"question":"What will the following code print out?\n<pre><code class='language-javascript'>const results = [1.32, 2.43, 3.9]\n .map(Math.floor);\nconsole.log(results);</code></pre>",
"explanation":"The map function takes a callback function as it's first parameter and applies that function against every value inside the array. In this example, our callback function is the <code>Math.floor</code> function which will truncate the decimal points of all the numbers and convert them to integers."
},
{
"subtitle":"Custom Map Functions",
"question":"What will the following code print out?\n<pre><code class='language-javascript'>const results = ['a', 'b', 'c']\n .map(a => [a.toUpperCase()]);\nconsole.log(results);</code></pre>",
"explanation":"The map function will return a new array with each element equal to the old element ran through a callback function. Our callback function takes our original element, changes it to a upper case, and then wraps it in an array; thus, leaving us with <code>[['A'], ['B'], ['C']]</code>"
"explanation":"This answer can be explained by first looking at the example of what happens with the first element in our array, <code>[4, 1]</code>. Our first map callback will run a mod 2 map function over <code>[4, 1]</code> leaving us with a new array of <code>[0, 1]</code>. The second map call which is inside our callback will subtract 1 from every element, leaving us with <code>[3, 0]</code>. Last, we take element at index 0, <code>0</code>, and add it to element of index 1 from our second map function, <code>0</code>, leaving us with 0; thus, after the first iteration of the top level map function, we are left with an array that looks like so: <code>[1, [2, 0], [3, 3]]</code>. We simply keep doing that logic for the other elements until we finish: <code>[1, -1, [3, 3]]</code>, and <code>[1, -1, 3]</code>"
},
{
"subtitle":"Words Containing 'a'",
"question":"What will the following code print out?\n<pre><code class='language-javascript'>const results = ['apple', 'dog', 'cat']\n .map((a, i) => \n a.indexOf('a') !== -1 ? i : null)\nconsole.log(results);</code></pre>",
"explanation":"This map example will return an array where each elements of the new array is either the original array index when the element contains the character 'a'; otherwise, an element of null for any words that do not have the character 'a'."
},
{
"subtitle":"Accessing the Original Array Elements",
"question":"What will the following code print out?\n<pre><code class='language-javascript'>const results = [1, 2, 3]\n .map((a, _, o) => a + o[0])\nconsole.log(results);</code></pre>",
"question":"What will the following code print out?\n<pre><code class='language-javascript'>const results = [8, 5, 3]\n .map((a, i, o) => o[o.length - i - 1])\nconsole.log(results);</code></pre>",
"explanation":"This map example will reverse the array. The third argument to the map callback function is the original array; therefore, we can use the current index in the map function, and work our way backwards from the end of the array using the o.length."
},
{
"subtitle":"Custom Scoping",
"question":"What will the following code print out?\n<pre><code class='language-javascript'>const results = ['a', 'b', 'c']\n .map(function(a) { return this[a]; }, {a: 9, b: 3, c: 1})\nconsole.log(results);</code></pre>",
"explanation":"This map example will reverse the array. The third argument to the map callback function is the original array; therefore, we can use the current index in the map function, and work our way backwards from the end of the array using the o.length."
},
{
"subtitle":"Reversing in Map, Just Because",
"question":"What will the following code print out?\n<pre><code class='language-javascript'>const results = [1, 2, 3, 4, 5]\n .map((a, _, o) => o.reverse() && a)\nconsole.log(results);</code></pre>",
"explanation":"This map example will reverse the array. The third argument to the map callback function is the original array; therefore, we can use the current index in the map function, and work our way backwards from the end of the array using the o.length."
"explanation":"The MVC pattern is used to keep separate three main components of an application, the idea being for example the data or 'Model' does not need to know what the 'View' or presentation of that data is doing and vice versa, with the 'Controller' handling any logic or input from the user to manipulate the 'Model'."
"explanation":"is used to navigate nodes and attributes within an XML document and stands for XML Path Language."
},
{
"subtitle":"Functions and side effects",
"question":"If a function is said to have side-effects it is expected to ?",
"choices":[
"<pre><code class='language-javascript'>Only return after an enclosed inner function has returned</code></pre>",
"<pre><code class='language-javascript'>Contain 'Blocking' code which can affect the stability of the program</code></pre>",
"<pre><code class='language-javascript'>Modify some kind of state outside of its own scope such as a global variable or change the value of its own arguments.</code></pre>",
"<pre><code class='language-javascript'>Have high algorithm complexity.</code></pre>"
],
"answer":2,
"explanation":"Other charateristics of side-effects would be writing data to the log, interacting with users or systems on the same network and calling other functions with side-effects."
},
{
"subtitle":"Time-Complexity",
"question":"The term 'Time-Complexity' relates to ?",
"explanation":"Algorithm Time-Complexity is the total amount of time needed for an algorithm to run till full completion and is more often expressed with 'big-O-notation'."
},
{
"subtitle":"Find the odd",
"question":"Which of the following programming languages is the odd one out ?",
"explanation":"PHP is generally referred to as an interpreted language where as the other three are considered languages generally processed by compilers."
},
{
"subtitle":"Find the odd, again",
"question":"Which in the following list is the odd one out ?",
"explanation":"An inline element will only take up the width of the inner content."
},
{
"subtitle":"CSS rules",
"question":"What will the following css rule select?\n<pre><code class='language-javascript'>.test > div</code> {\n...\n}</code></pre>",
"choices":[
"<pre><code class='language-javascript'>Selects all divs within elements with the class of test.</code></pre>",
"<pre><code class='language-javascript'>Selects all divs outside of elements with the class of test.</code></pre>",
"<pre><code class='language-javascript'>Selects only divs that are immediate children of elements with the class of test.</code></pre>",
"<pre><code class='language-javascript'>This would not be considered a valid selector.</code></pre>"
],
"answer":2,
"explanation":"eg: \n<pre><code class='language-html'><div class='test'>\n<div class='box'>\n<div class='content'>...</div>\n</div>\n<div class='box'>\n<div class='content'>...</div>\n</div>\n</div></code></pre>\n\nWould target only the elements with a class of 'box' as these are the direct children of 'test'."
},
{
"subtitle":"Overriding properties",
"question":"Which keyword would you add to the end of a style rule to override another Css style for a specific element ?",
"explanation":"For example if you wanted all the paragraph tags in a specific class to have the colour blue instead of black\n<pre><code class='language-javascript'></code>.myClass p {\ncolor: blue !important\n}</code></pre>"
"explanation":"Giving an element absolute positioning removes it from the normal document flow completely allowing positioning attributes top, left, bottom."
"explanation":"The Universal selector will select every element on a page and is denoted by <code>*{}</code>. note: The rule of specificity still applies, so a more specific selector can override the universal selector in a Css document."
"explanation":"First answer : Would be correct of a sudo-class.<br />Second answer : Would be an error of syntax.<br />Third answer: The double colon would be an example of a sudo element used with the likes of <code>::before</code> and <code>::after</code> which are examples of content.<br />Fourth answer : This would relate to html tag elements of which there is no first-child tag."
"question":"An entire CSS selector and declaration block whithin a CSS document eg:<code><br /> .container div p {<br />position: relative;<br />width: 300px;<br />margin: auto;<br />color: #ffffff;<br />}</code><br /> is referred to as?",
"explanation":"<code>-win-</code> is incorrect, <code>-webkit-</code> (Chrome, Safari, ioS and modern versions of Opera), <code>-moz-</code> (Firefox), <code>-o-</code> (Older versions of Opera), the other would be <code>-ms-</code> used for (IE and Microsoft Edge)."
"explanation":"The keyword 'bold' is the same as the numerical value 700."
},
{
"subtitle":"CSS ruleset",
"question":"Given this ruleset <code><br />.testDiv {<br />width: 20%;<br />height: 20%;<br />content: 'add this text'<br />}</code><br />What would happen with the content properties text?",
"<pre><code class='language-javascript'>Appended to any text contained in element with class of testDiv.</code></pre>",
"<pre><code class='language-javascript'>Prepended to any text contained in element with class of testDiv.</code></pre>",
"<pre><code class='language-javascript'>Overwrite any text contained in element with class of testDiv.</code></pre>"
],
"answer":0,
"explanation":"Nothing would appear on the page, the content property needs to be used with sudo elements like <code>::after</code> or <code>::before</code> eg:<br /><code>.testDiv {<br />width: 20%;<br />height: 20%;\n}\n.testDiv::after {\ncontent: 'add this text'\n}</code>"
"<pre><code class='language-javascript'>All <section> and <p> tags.</code></pre>",
"<pre><code class='language-javascript'>All <p> tags within a <section> tag.</code></pre>",
"<pre><code class='language-javascript'>All <p> tags placed immediately after a <section> tag.</code></pre>",
"<pre><code class='language-javascript'>Not a valid selector.</code></pre>"
],
"answer":2,
"explanation":"<pre><code class='language-javascript'><p>First Paragraph</p><br /><section>...</section><br /><p>Second Paragraph</p><br /><p>Third Paragraph</p></code></pre><br />Only the second paragraph tag will be selected and matched."
},
{
"subtitle":"How to incorporte CSS into web document",
"explanation":"Currently CSS can be used 'Inline' as a style attribute of an Html element, 'Embedded' in a style tag of a document and 'Imported' as an external file with the link tag element."
"explanation":"<code>split()</code> is a string method<br /><code>pop()</code> removes from the end of an array<br /><code>unshift()</code> adds to the front of an array<br />and <code>every()</code> returns a true or false value for each element in an array."
},
{
"subtitle":"JavaScript ES6 feature",
"question":"ES6 Arrow functions written on one line require no return statement.",
"explanation":"Also Known as a Higher-order function a callback function can be passed to another function as a parameter and is called inside that function."
},
{
"subtitle":"JavaScript syntax, again",
"question":"Javascript is case sensitive true or false?",
"<pre><code class='language-javascript'>To constantly monitor if the call stack is empty and then invoke any asynchronous functions from the event queue.</code></pre>",
"<pre><code class='language-javascript'>A mechanism to best decide how to terminate any looping structure.</code></pre>"
],
"answer":2,
"explanation":"Briefly the event loop constantly runs to monitor state between the callstack, the event table and the event queue. When asynchronous code is executed it\nis placed on to the event table only to be executed as and when a specific event occurs, when it does it is then placed on the event queue until the call\nstack is empty then when invoked, moved from the queue to the callstack."
},
{
"subtitle":"JavaSript type",
"question":"<code>console.log(typeof(NaN))</code> Will log?",
"<pre><code class='language-javascript'>t e s t s t r i n g</code></pre>"
],
"answer":0,
"explanation":"The spread syntax introduced in es6 can be used to iterate through each character of a string, and here stored in an array similar to calling <code>x.split(\"\")</code>"
},
{
"subtitle":"ES6 let / const declarations",
"question":"What will the following code log?<code><br />function myFunction() {<br />const a = 'variableA'<br />if( 3 > 1) {<br />let b = 'variableB'<br />}<br />console.log(a)<br />console.log(b)<br />}<br />myFunction();</code>",
"<pre><code class='language-javascript'>variableA, Uncaught ReferenceError: b is not defined</code></pre>"
],
"answer":3,
"explanation":"Due to the keywords let and const being block scoped rather than just locally function scoped like var, the variable b will be garbage collected after the\nconditional if statement has finished and will no longer exist for the console.log() method."
},
{
"subtitle":"JavaSript function arguments",
"question":"The following code will return?<code><br />function getsum(num1 = 1, num2 = 1) {<br />return num1 + num2;<br />}<br />getsum(3);</code>",
"explanation":"Due to only one argument being passed this will override the first default parameter giving num1 the value of 3 + num2 default value of 1.\nIf the function were to be executed without any arguments at all both defaults would be used and return 2."
},
{
"subtitle":"JavaSript inheritance",
"question":"All Javascript objects inherit properties and methods from a class true or false?",
"explanation":"Due to only one argument being passed this will override the first default parameter giving num1 the value of 3 + num2 default value of 1.\nIf the function were to be executed without any arguments at all both defaults would be used and return 2."
}
],
"tests":[],
"challengeType":8
},
{
"id":"5a933ce3a9178457a6f12824",
"title":"Networking questions part 1",
"description":[
{
"subtitle":"Address identification",
"question":"00:26:2D:55:42:1f is an example of what?",
"choices":[
"<pre>MAC Address</pre>",
"<pre>IPv4 Address</pre>",
"<pre>IPv6 Address</pre>",
"<pre>A wireless protocol</pre>"
],
"answer":0,
"explanation":"A valid MAC Address."
},
{
"subtitle":"OSI networking model",
"question":"Which one of the following is not part of the seven layer OSI networking model.",
"choices":[
"<pre>Application</pre>",
"<pre>Presentation</pre>",
"<pre>Session</pre>",
"<pre>Protocol</pre>",
"<pre>Network</pre>",
"<pre>Data Link</pre>",
"<pre>Physical</pre>"
],
"answer":3,
"explanation":"Protocol is not part of the OSI networking model layer 4 should be the transport layer."
},
{
"subtitle":"RAID",
"question":"In networking a RAID implementation relates to?",
"choices":[
"<pre>Wireless standards</pre>",
"<pre>Password policies</pre>",
"<pre>Remote access</pre>",
"<pre>Fault tolerance</pre>"
],
"answer":3,
"explanation":"RAID stands for Redundant array of inexpensive disks and is a model that allows servers to\nendure the failure of one or more hard disks without interuption to services and resources."
},
{
"subtitle":"Server status",
"question":"Your console or terminal throws up a 404 error, this means?",
"choices":[
"<pre>Upgrade required</pre>",
"<pre>Not found</pre>",
"<pre>Gateway Timeout</pre>",
"<pre>No Response</pre>"
],
"answer":1,
"explanation":"This error informs you that an internal or external resource has not been found and can not be loaded into a page or application."
},
{
"subtitle":"Server Status, again",
"question":"Your console or terminal throws up a 500 error, this means?",
"choices":[
"<pre>Internal Server Error</pre>",
"<pre>Proxy Authentication Required</pre>",
"<pre>Upgrade Required</pre>",
"<pre>Too Many Requests</pre>"
],
"answer":0,
"explanation":"A generic error message which refers to an error on the webserver when no precise detail is available."
},
{
"subtitle":"HTTP methods",
"question":"GET and POST are important HTTP request methods which of the following list are Not an example of an HTTP request method?",
"choices":[
"<pre>HEAD</pre>",
"<pre>PUT</pre>",
"<pre>BODY</pre>",
"<pre>DELETE</pre>"
],
"answer":2,
"explanation":"HEAD is similar to the Get method but returns no response body, PUT is used to replace and update a specified resource, DELETE will delete a resource,\nthere is no such method as a BODY request."
},
{
"subtitle":"Loopback",
"question":"In networking which of the following is considered to be a loopback ip address or 'localhost'?",
"choices":[
"<pre>172.0.0.1</pre>",
"<pre>127.0.0.1</pre>",
"<pre>10.0.0.0</pre>",
"<pre>192.168.0.0</pre>"
],
"answer":1,
"explanation":"127.0.0.1 is the loopback address or localhost, option a is an example of a public address and options c and d are examples of private network addresses."
},
{
"subtitle":"Network & Security Architecture",
"question":"Ring, Star, Mesh and Bus are all examples of?",
"choices":[
"<pre>Network topologies</pre>",
"<pre>Security Protocols for mobile development</pre>",
"<pre>Restful API's</pre>",
"<pre>File server storage methods</pre>"
],
"answer":0,
"explanation":"A network topology is a logical and physical layout of how the network appears to the devices using it."
}
],
"tests":[],
"challengeType":8
},
{
"id":"5a933d04a9178457a6f12825",
"title":"Networking questions part 2",
"description":[
{
"subtitle":"Default port for FTP",
"question":"In attempting to connect to an FTP (File Transfer Protocol) server and failing, which port can you check is open to troubleshoot the connection issue?",
"explanation":"A subnet mask is used along side an IP address in order to isolate the extended or 'subnet' of the network address and the host machine address."
"explanation":"A Network Interface Card or (Network Interface Controller) is a hardware component that connects to a Pc or printer in order to\nconnect and be identified on a network."
},
{
"subtitle":"Default gateway",
"question":"A 'default gateway' provides a way for a local network to connect to a larger external network true or false?",