0 var tempdiv

This preview shows page 8 - 11 out of 11 pages.

(thisState.toLowerCase().indexOf(str.toLowerCase()) == 0) { var tempDiv = document.createElement("div"); tempDiv.innerHTML = thisState; tempDiv.onclick = makeChoice; tempDiv.className = "suggestions"; document.getElementById("popups").appendChild(tempDiv); } } var foundCt = document.getElementById("popups").childNodes.length; if (foundCt == 0) { document.getElementById("searchField").className = "error"; } if (foundCt == 1) { document.getElementById("searchField").value = document.getElementById("popups").firstChild.innerHTML; document.getElementById("popups").innerHTML = ""; } } }
Image of page 8
9 function makeChoice(evt) { var thisDiv = (evt) ? evt.target : window.event.srcElement; document.getElementById("searchField").value = thisDiv.innerHTML; document.getElementById("popups").innerHTML = ""; }[for graders: each line is worth 2 points] JQuery Questions [10 pts] Each question is worth 2 points. Q1: (2 points) What is the JQuery code that corresponds to the following? Q2: (2 points) What are three examples of JQuery “basic” selectors? Q3: If you were to use JQuery make your code independent of Browser differences, which set of functions would you pick? Q4: Name 2 categories of JQuery selectors A4: Any 2 of Attribute, Basic, Basic Filter, Child Filter, Content Filter, Form Q5: [Each “correct” missing line is worth 1 point. NO PARTIAL CREDIT] Consider the following example without JQuery: hex=255 // Initial color value. function fadetext() { if(hex>0) { //If color is not black yet hex -= 11; // increase color darkness document.getElementById("sample").style.color="rgb("+hex+","+he x+","+hex+")"; setTimeout("fadetext()",20); }
Image of page 9
10 else hex=255 //reset hex value } A5: Rewrite it using JQuery. Assume #fadeText is the id of the button. $ (function() { // when document is ready $ ( "#fadeText" ). click (function() { // set a onClick handler on fadeText $ ( "h3" ). fadeOut ( 125 ). delay (). fadeIn ( 125 ); // fadeOut the h3 for 125 ms, delay, then fadeIn for 125 ms }); }); Grading Guidelines: If any student came with different solution might be correct please spread the solution to the other graders to take a decision JavaScript Frameworks, Libraries & Serverless Questions [10 pts] Each question is worth 2 points. Q1. Which of the following are TRUE of React? [ X ] ReactJS is a “view layer library [ ] ReactJS is a framework like AngularJS [ ] ReactJS implements MVC [ X ] Using ReactJS it is easy to mix HTML and JavaScript [ X ] React Native allows to build iOS apps [ ] ALL OF THE ABOVE Note: there is no partial credit Q2. What is JSX? Q3. Which of the following are TRUE of Firebase? [ X ] Is a cross platform set of tools [ X ] Includes functionality for authentication [ ] Includes functionality for data mapping [ ] Requires the use of a GCP project
Image of page 10
11 [ ] ALL OF THE ABOVE Note: there is no partial credit Q4. Which of the following are TRUE of Node.js? [ X ] Is a JavaScript runtime built on Chrome V8 [ ] Uses blocking IO model [ X ] Includes modules that handle HTTP [ ] Includes modules that handle IP [ X ] Is bundled with ‘npm’ [ ] ALL OF THE ABOVE Note: there is no partial credit Q5. Name 2 platforms for serverless architectures. A5. Any 2 of AWS Lambda, GCP Functions, Azure Functions, and IBM OpenWhisk
Image of page 11

You've reached the end of your free preview.

Want to read all 11 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture