cs571_15sp-final-papa-s1 - Computer)Science)571)2nd)Exam Prof)Papa Tuesday)April)28)2015)5:30pm)6:40pm Name Student)ID)Number 1

cs571_15sp-final-papa-s1 - Computer)Science)571)2nd)Exam...

This preview shows page 1 out of 10 pages.

You've reached the end of your free preview.

Want to read all 10 pages?

Unformatted text preview: Computer)Science)571)2nd)Exam) Prof.)Papa) ) Tuesday,)April)28,)2015,)5:30pm)–)6:40pm) ! ! Name:)) ) ) ) ) Student)ID)Number:) ) ) 1.! This)is)a)closed)book)exam.)) 2.! Please)answer)all)questions)on)the)test) ) ) Security)and)Privacy)Questions)[10)pts]) ) Each)question)is)worth)2)points.) Q1:)What)is)a)recent)technique)to)construct)highly)secure)passwords?) ) A1:)) Diceware(rolling a dice) ) Q2:)What)functionality)do)PGP)and)S/MIME)provide?) ) A2:)) provide encryption for data especially for email ) and signing Q3:)What)is)the)main)functionality)of)TOR?) ) network that provide anonymous path between client A3:)) and browser ) ) Q4:)Why)are)browser)plugins)inherently)insecure?) bypass the browser sandbox(same with js, css and ) others)=>link to everything in sandbox, A4:)) ⽂文本 execute arbitrary malicious code ) sandbox: limit what you can do, can’t go outside Q5:)Is)it)possible)to)send)a)virus)in)a)cookie?) ) A5:)YES)[)])NO)[)])) no only data, can’t execute ) ) Hi\Performance)Web)Questions)[10)pts])) Each)question)is)worth)2)points.) ! 1! Q1.)What)percentage)of)the)end\user)response)time)is)spent)in)the)front\end?)) ) 80% 80-90% Q2.)What)are)2)ways)that)reduce)the)number)of)HTTP)requests? ) ) ) combine image, combine script combine image maps, css sprites Q3.)What)5)components)can)be)GZIP\ed?)! ) image, xml, json, js, php html,css,js,json,xml,txt Q4.)What)2)components)should)not)be)GZIP\ed?)! )! html,txt image and pdf, rtf(binary format) Q5.)Where)should)CSS)and)scripts)be)placed)in)a)HTML)file?)! ! css at the top of html, in <head> js at the bottom, before </body> ) HTML5)Questions)[10)pts])) ) Each)question)is)worth)2)points.) ) Q1:)The)use)of)the)<div>)tag)has)been)replaced)by)a)number)of)new)elements)included)in) HTML5.)Name)two)of)them) ) A1:)) <header>, <nav>, <article> ) Q2:)Which)of)the)following)capabilities)are)included)in)HTML5?) ) A2:) [)])drag)file)in)browser) [)])interactive)canvas)gradient) [)])editable)content) [)])geolocation) 7 [)])drag)and)drop) [)])storage) [)])ALL)OF)THE)ABOVE) ) [You)must)choose)the)correct)choice)or)choices.)There)is)no)partial)credit]) ) ! 2! Q3:))What)is)the)purpose)of)the)different)“profiles”)included)in)the)H.)264)video)standard?) ) each profile define a set of opt features that A3:))) ⽂文本 trade complexity for file size ) Q4:)What)is)the)meaning)of)the)“preload”)video)attribute?) ) when user is at wifi, it can save network A4:) play more fluently video will be loaded at page load and ready to run ) Q5:)If)you)were)asked)to)make)sure)that)your)video)files)could)be)viewed)on)the)large) majority)of)browsers,)what)two)video)containers)would)you)select?) ) A5:))) ogg, mp4 mpeg4(90%) and webM, ) ogg(only used in Firefox) ) ) ) JSON/AJAX)Questions)[20)pts])) Each!question!is!worth!2!points.! ! Q1:)Which)of)the)following)calls)to)send())is)invalid?)Circle)your)answer.! ! a.)send()) ) b.)send(null))) a,b ) no answer c.)send(“x=1&y=2”)) ) Q2:)What)is)the)major)difference)in)behavior)between)client)and)server)in)an)AJAX) transaction?) Ajax transaction are asynchronous(not proper answer) ) client use XMLHttpRequest to asynchronous send data to server, ) server can deal with data without refreshing whole web page ) Q3:)What)are)the)4)basic)technologies)in)AJAX?) ) html, css, js, xml, or json jquery, json, xmlhttprequest ) ) Q4:)Which)readyState)and)Status)combination)should)you)check)for)to)know)that)an)AJAX) request)is)complete?)Circle)your)answer.! c ! a.) 3)and)304)) ) b.) 2)and)200)) ! 3! ) c.) 4)and)200)) ) d.) 5)and)404) ) ) Q5:)List)3)properties)of)JSON) ) human and machine readable ) can’t extend language independent, text-based, light-weight, ) no namespace not a document format, not a markup language, ) not a serialization format ) ) ) ) ) Q6. What is a possible drawback of the eval() function? safety vulnerable, treat string as js script execute code Q7. What is the first index in a JSON array? 0 or 1 Q8. A JSON encoder must only produce well-formed JSON text. [ ]True [ ]False True Q9. What is JSONP? json with padding, add callback function the name of a callback func is specified as an input argument of the call itself Q10. What are the responsibilities of an “AJAX engine”? manage transfer data between client and server interact with the user, communicate asynchronously with server:only data, “render” the user interface JavaScript)and)Ajax)Questions)[10)pts]))! ! ! ! 4! ! Below)is)the)HTML)source)code)that)produces)the)web)page)above.)There)are)4)links.)When) the)user)cursor)is)placed)over)each)link,)a)pop\up)widget)is)displayed)viewing)the)contents)of) the)Web)page)being)hyperlinked.) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html> <head> <title>My Fourth Ajax Script</title> <link rel="stylesheet" rev="stylesheet" href="script04.css" /> <script src="script04.js" type="text/javascript" language="Javascript"> </script> </head> <body> <h2>A Gentle Introduction to JavaScript</h2> <ul> <li><a href="jsintro/2000-08.html">August Page</a></li> <li><a href="jsintro/2000-09.html">September Page</a></li> <li><a href="jsintro/2000-10.html">October Page</a></li> <li><a href="jsintro/2000-11.html">November Page</a></li> </ul> <div id="previewWin"> </div> </body> </html> ! Below)is)the)JavaScript)source)code,)script04.js,)that)was)imported)into)the)HTML)above,)but) some)of)the)lines)are)missing,)replaced)by)XXXXXXXs.)Fill)in)the)missing.) window.onload = initAll; var xhr = false; var xPos, yPos; function initAll() { var allLinks = document.getElementsByTagName("a"); ! 5! for (var i=0; i< allLinks.length; i++) { XXXXXXXXX1; var link=allLinks[i]; link.onmoseover=showPreview; } } function showPreview(evt) { getPreview(evt); return false; } function hidePreview() { XXXXXXXXX2; document.getElementById(“previewWin”).style.visibility=“hidden”; } function getPreview(evt) { if (evt) { var url = evt.target; } else { evt = window.event; var url = evt.srcElement; } xPos = evt.clientX; yPos = evt.clientY; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { if (window.ActiveXObject) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } } if (xhr) { xhr.onreadystatechange = showContents; xhr.open("GET", url, true); xhr.send(null); } else { alert("Sorry, but I couldn't create an XMLHttpRequest"); } } function showContents() { var prevWin = XXXXXXXXX3; $(“#prevWin”) if (xhr.readyState == 4) { ! 6! var response xhr.responseText XXXXXXXXX4 = (xhr.status == 200) ? XXXXXXXXX5: prevWin.innerHTML "There was a problem with the request " + xhr.status; prevWin.style.top = parseInt(yPos)+2 + "px"; prevWin.style.left = parseInt(xPos)+2 + "px"; prevWin.style.visibility = "visible"; prevWin.onmouseout = hidePreview; } } ) ) JQuery)Questions)[10)pts])) ) Q1)(2)pts):)Please)give)an)example)of)a)jQuery)Basic)Class)selector)that)modifies)a)“border”) property.)) A1:)) $(“#thisBorder”).css(“border”,”solid”); Q2)(2)pts):)What)does)jQuery)simplify?) ! 1,2,4,5,6 A2:)) 7 ) [)])HTML)document)traversing) [)])XMLHttpRequest) [)])HTTP)header)manipulatin) [)])Event)Handling) [)])Animating) [)])AJAX)interactions) [)])ALL)OF)THE)ABOVE) ) [You)must)choose)the)correct)choice)or)choices.)There)is)no)partial)credit]) ) ! Q3)(6)pts):)[This)question)is)worth)6)points])Consider)the)following)example)without)JQuery:) <html> <body><DIV ID="counter">Number of clicks = 0</DIV> <FORM> <INPUT TYPE="button" VALUE="Increment Counter" onclick="updateMessage()"> </FORM> <SCRIPT LANGUAGE="JavaScript"> var hits = 0; function updateMessage() { hits += 1; ! 7! document.getElementById("counter").innerHTML = "Number of clicks = " + hits; } </SCRIPT> <noscript></body> ) A3:))Rewrite)it)using)JQuery.)Fill)in)the)missing)code. <html> <head> <meta charset="UTF-8"> <script src=" ipt> <script> $(function() { var hits = 0; $("XXXXXXXXX1").click(function() { #counter #updateMsg XXXXXXXXX2 ("Number of clicks = " + ++hits); $(“#counter”).text $(“#counter”).html }); }); </script> </head> <body> <DIV ID="counter">Number of clicks = 0</DIV> <FORM> <INPUT TYPE="button" VALUE="Increment Counter" id=" XXXXXXXXX3"> counter updateMsg(or any other id) </FORM> <noscript> </body> ) ) ) Responsive)Website)Design)Questions)[10)pts])) ) Each)question)is)worth)2)points.) Q1:)Mention)one)reason)why)hosting)a)separate).mobi)website)is)not)recommended?) ) A1:)) cost more, few users duplicateredirect take time content synchronization of content issue ) may only work on a specific mobile size ) ! 8! Q2:)Mention)one)reason)why)hosting)a)mobile)website)within)your)current)domain) (m.mycompany.com))is)not)recommended?) ) redirect take time(in seconds) A2:)) if share it to desktop, user will see a tiny website redirect and hinder search engines only work on single size ) Q3:)What)is)the)CSS)code)(property)and)value))to)hide)content)on)small)screens?) ) A3:))) display: none ) Q4:)RWD)is)abased)on))“media)queries.)Please)write)an)example)of)a)media)query.) ) A4:))) @media all and (max-width:800px) max-device-width ) ) Q5:)List)one)property)of)“fluid”)grids.) ) relative-based A5:))) relative-based define a grid divided into a specific number of columns each grid designed with proportional width and height,not pixels ) XML)Schema)Questions)[20)pts])) ) Consider)the)following)XML)empty)complex)element)that)has)no)content,)and)only)one) attribute:) ) <product prodid="1345" /> [10)pts])Write)an)XML)Schema)that)defines)a)“product”)element)using,)xs:element.) Xs:complexType)and)positive)integer)xs:attribute: <xs:schema xmlns:xs=" ; elementFormDefault="qualified"> </xs:schema> ) Consider)the)following)simple)XML)instance)document,)note.xml:) ) <?xml version="1.0"?> ! 9! <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> [10)pts])Write)an)XML)Schema)that)conforms)to)such)document:) ) <?xml version="1.0"?> <xs:schema xmlns:xs=" ; targetNamespace=" ; xmlns=" ; elementFormDefault="qualified"> </xs:schema> ) ) ) ! 10! ...
View Full Document

  • Fall '07
  • Papa
  • Ajax, JSON, pts, malicious code, div id=

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture