Www1.gantep.edu.tr
JavaScript Test Answer KeyINDE 498 AWinter 2003CORRECT ANSWERS ARE IN GREEN.1. Why would someone want to use JavaScript on a Web page?(circle all letters before valid reasons for using JavaScript)A. To react to events that occur with Web page useB. To read and write HTML C. To validate data in a Web formD. To pass data to a Java applet programE. To run a clock or timer in a Web pageA, B, and C are straight from the introduction of the JavaScript tutorial.Answer D is from lecture and E is from an example deeper in the tutorial.2. Why would someone use a semi-colon when writing JavaScript?(circle all letters before true statements)A. To put more than one statement on the same lineB. To quickly reuse code when copying and pasting from JavaScript to JavaC. Because a for statement requires themD. Because a switch statement requires themE. Because a return statement requires themA and B are from lecture. C is from the JavaScript tutorial. 3. How would you properly identify a segment of JavaScript to a Web browser?(circle the letter before the one best answer)A. Use an open SCRIPT tag with a type="text/javascript" attributeB. Write JavaScript anywhere and the browser always recognizes itC. Use an open JAVASCRIPT tag with a type="text" attributeD. Use an open APPLET tag with a type="text/javascript" attribute4. Evaluate the following String method uses by writing the value of s after the evaluation(write one value on the line to the right of each evaluation)var str="Mix and Match"A. s = str.indexOf("x") __2_B. s = str.indexOf("g") _-1_C. s = str.indexOf("M") __0_D. s = str.lastIndexOf("a") __9_E. s = str.indexOf("and") __4_5. How can someone properly open a second Web browser window with a JavaScript statement?(circle the letter before the one best answer)A. document.openWin("")B. openWindow("") C. window.open("")D. document.open("") E. document.location("")6. Which of the following JavaScript statements will assign the word "and" to variable s?(circle the letter before the one best answer)var str="Mix and Match"A. s = str.substring(4,3);B. s = str.substring(5,3);C. s = str.substring(4,7);D. s = str.substring(5,7);E. s = str.substring(5,8);7. Given the following valid HTML form, how would you assign the value typed into the owner control to a variable ssn in a JavaScript statement?(circle the letter before the one best answer)<FORM Name=SSN Action=processme.html> <INPUT Name=owner></FORM>A. ssn = window.SSN.owner.value;B. ssn = document.SSN.owner.value;C. ssn = document.SSN.input.value;D. ssn = document.form.input.value;E. ssn = window.owner.value;You must include every object down in the DOM (Document Object Model) hierarchy.8. After a JavaScript function runs the following two lines of code, what value does the variable theDay contain?(circle the letter before the one best answer)var d=new Date();theDay = d.getDay();A. 1B. 2C. 26D. 27E. "Monday"getDay() starts counting with Sunday as 0, Monday as 1, etc. The String representation in the variant is "1", not "Monday".9. After a JavaScript function runs the following two lines of code, what value does the variable x contain?(circle the letter before the one best answer)arr = new Array(5);x = Math.random() / arr.length;A. a floating point number between 0.0 and 0.2B. a floating point number between 0.0 and 0.25C. a floating point number between 0.0 and 1.0D. a floating point number between 0.0 and 5.0E. x would not be assigned due to one or more errors in the codeMath.random returns a value between 0.0 and 1.0. Array.length returns the numberof Objects in the array structure.10. Why would someone use more than one pair of tags in a Web page?(circle the letter before the one best answer)A. there is no reason to use more than one pairB. to process the same algorithm in more than one scripting languageC. to call one JavaScript function from within another JavaScript functionD. to use a variable name like 'x' more than onceE. to span a switch statement across multiple functionsAs mentioned in lecture, scope is the most important reasons to use more than one SCRIPT element.11. When would someone use JavaScript to assign a new value to the window.location property of a Web page?(circle the letter before the one best answer)A. To move a Web browser window to a new place on the screenB. To redirect a Web page reader to a different page than the one they requestedC. To bookmark a page in a reader's list of favoritesD. To scroll the reader to a new location in the currently viewed Web pageE. The location property only applies to the document object, never the window object12. Where on a Web page does the following JavaScript line belong? (circle the letter before the one best answer)document.write(IBM_stock_price)A. In the HEAD element of the Web pageB. Between the HEAD and BODY elements of a Web pageC. In the BODY element of a Web pageD. After the BODY element of a Web pageE. In an external JavaScript file13. What is the value of variable x after the following block of JavaScript code is run?(circle the letter before the one best answer)x=0;y=2;while(y>0.5 || y<0.0) { x = x+1; y = y/x - y;}A. 0B. 1C. more than 1D. undetermined since the code divides by zeroE. less than 1The loop runs once since y is greater than 0.5. This adds one to the value of x.x is now 1. y is now 0.0 which is neither > 0.5 nor < 0.0. So, the loop does not run again.14. Which of the following lines of code in a JavaScript function written on a Web page could be passing data to a function written in Java?(circle the letter before the one best answer)A. document.java.update(points);B. document.script[0].update(points);C. window.alert(updatePoints(100));D. external function update(points);E. document.applets.update.update(points)You need to reference the document object, its applets property, the name of the specificapplet (update in this case) and the actual function to be run in the Java.15. So, overall, the JavaScript language is basically intended to be(circle the letter before the one best answer)A. a compiled programming language written close to the machine architectureB. an interpreted programming language written close to the machine architectureC. a compiled programming language with a high-level abstraction from machine architectureD. an interpreted programming language with a high-level abstraction from machine architectureE. an intermediary language compiled to byte code and interpreted to the machine architectureCode snippet questions[1]:<a href="#">text</a><br><a href="#">link</a><script> var as = document.getElementsByTagName('a'); for ( var i = as.length; i--; ) { as[i].onclick = function() { alert(i); return false; } }</script>Why do the anchors, when clicked on, alert?-1?instead of their respective counter inside of the loop? How can you fix the code so that it does alert the right number? (Hint: closures)[2]function User(name) { this.name = name;};var j = User('Jack');alert(j.name)Why would this code not work as expected? Is anything missing?[3]:Object.prototype.jack = {};var a = [1,2,3];for ( var number in a ) { alert( number )}I'm iterating through this array I defined, it has 3 elements in it.. the numbers 1 2 and 3.. Why on earth is jack showing up?[4]:people = { 1:'Jack', 2:'Chloe', 3:'Bruce',}for ( var person in people ) { alert( person )}Why is this not working in Internet Explorer?[5]<script> (function() { var jack = 'Jack'; })(); alert(typeof jack)</script>Why does it alert undefined when I declared the jack variable to be 'Jack'?[6]:<script src="file.js">alert(2);</script>Why isn't it alerting 2?[7]:array = [1,2]; alert( typeof array )Why does it say?object?and not array? How would I detect if its an array?[8]:<a id="clickme">click me!</a><script> var a = document.getElementById('clickme'); a.onclick = function() { alert(this.innerHTML) setTimeout( function() { alert( this.innerHTML ); }, 1000); };</script>Why does the second alert say?undefined?[9]:<p id="test">original</p><script> var test = document.getElementById('test'); test.innerHTML.replace('original', 'FOOBAR');</script>How come it doesn't replace the text with FOOBAR??[10]:function identity() { var name = 'Jack'; alert(name); return name};var who = identity();alert(who)Why does it first alert Jack, then undefined?[11]:var number = '08', parsed = parseInt(number);alert(parsed)The alert should give me 8.. why doesn't it give me 8?[12]:<script> var xhr = new XMLHttpRequest(); xhr.open("GET", "", true); xhr.onreadystatechange = function(){ if ( xhr.readyState == 4 ) { if ( xhr.status == 200 ) { alert( xhr.responseText ) } else { document.body.innerHTML = "ERROR"; } } }; xhr.send(null);</script>How come I can't retrieve Google's homepage text with?XHR[6] from my localhost?[13]:<script> var ticket = true; if (!ticket) alert('you need a ticket'); alert('please purchase a ticket.')</script>ticket?is set to true. Why is it alerting that I need to purchase one?[14]:<script> var blogEntry = 'Today I woke up to the smell of fresh coffee'; alert(blogEntry)</script>How come it doesn't alert with the blog entry? Everything seems right.[15]:alert( [typeof 'hi' === 'string', typeof new String('hi') === 'string' ] )I have two strings, but the second evaluation doesn't become true. Is this a potential bug? How come it's not true?Best practices<a href="#" onclick="javascript:window.open('about.html');">about</a>Would you change anything in the prior code example? Why?<a href="site.html" onmouseover="changeImages('button1', 'images/button1over.png'); return true;" onmouseout="changeImages('button1', 'images/button1.png'); return true;">site</a>JavaScript Interview Questions and AnswersThis is an interactive multiple-choice JavaScript Quiz that allows you to test your knowledge of JavaScript by answering the following questions. Answers are given at the end of all questions. Click here to view answers of these JavaScript Interview Questions.<!--google_ad_client = "pub-5439884258125569";google_ad_slot = "8217394354";google_ad_width = 336;google_ad_height = 280;//-->1) What is the output of following JavaScript code?<script type="text/javascript">x=4+"4";document.write(x);</script>a) 44b) 8c) 4d) Error output2) What is the output of following JavaScript code?<script type="text/javascript">var cst = "Chadha Software Technologies";var result = cst.split(" ");document.write(result); </script>a) Chadhab) C,h,a,d,h,a,S,o,f,t,w,a,r,e,T,e,c,h,n,o,l,o,g,i,e,sc) Chadha,Software,Technologiesd) Chadha Software Technologies3) Is it possible to nest functions in JavaScript?a) Trueb) False4) What is the output of following JavaScript code?<script type="text/javascript">document.write(navigator.appCodeName);</script>a) get code name of the browser of a visitorb) set code name of the browser of a visitorc) None of the above5) Which of the following is true?a) If onKeyDown returns false, the key-press event is cancelled.b) If onKeyPress returns false, the key-down event is cancelled.c) If onKeyDown returns false, the key-up event is cancelled.d) If onKeyPress returns false, the key-up event is canceled.6) Scripting language isa) High Level Programming languageb) Assembly Level programming languagec) Machine level programming language7) Which best explains getSelection()?a) Returns the VALUE of a selected OPTION.b) Returns document.URL of the window in focus.c) Returns the value of cursor-selected textd) Returns the VALUE of a checked radio input.8) What is the output of following JavaScript code?<script type="text/javascript">function x(){var s= "Good 100%"; var pattern = /\D/g;var output= s.match(pattern);document.write(output);}</script>a) Good %b) 1,0,0c) G,o,o,d,%d) Error9) What is the output of following JavaScript code?<script type="text/javascript">var cst="CHADHA SOFTWARE TECHNOLOGIES"; alert(cst.charAt(cst.length-1));</script>a) Pb) Ec) Sd) Error10) Choose the client-side JavaScript object:a) Databaseb) Cursorc) Clientd) FileUpLoad11) Are Java and JavaScript the same?a) Nob) Yes12) Syntax for creating a RegExp object:(A) var txt=new RegExp(pattern,attributes);(B) var txt=/pattern/attributes;Which of the above mentioned syntax is correct?a) (A) onlyb) (B) onlyc) Both (A) and (B)d) None of the above13) What is the output of following JavaScript code?<script type="text/javascript">function x(z,t){alert(x.length);}</script>a) Errorb) 2c) 1d) 314) What is meant by "this" keyword in JavaScript?a) It refers current objectb) It referes previous objectc) It is variable which contains valued) None of the above15) In JavaScript, Window.prompt() method returns true or false value?a) Falseb) Truec) None of above16) Math.round(-20.51) = ?a) 20b) -21c) 19d) None17) What is the output of following JavaScript code?<script type="text/javascript">function x(){var s = "Quality 100%!{[!!";var pattern = /\w/g;var output = s.match(pattern);document.write(output);}</script>a) %,!,{,[,!,!b) Q,u,a,l,i,t,y,1,0,0c) Quality 100d) Error18) What is the output of following JavaScript code?<script type="text/javascript">var cst = new Array();cst[0] = "Web Development";cst[1] = "Application Development"cst[2] = "Testing"cst[3] = "Chadha Software Technologies";document.write(cst[0,1,2,3]);</script>a) Errorb) Chadha Software Technologiesc) Web Developmentd) Web Development,Application Development,Testing,Chadha Software Technologies19) Choose the server-side JavaScript object among the following:a) FileUpLoadb) Functionc) Filed) Date20) What does parseFloat(9+10) evaluates to in JavaScript?a) 19b) 910c) None21) What is the output of following JavaScript code?<script type="text/javascript">function x(){document.write(2+5+"8");}</script>a) 258b) Errorc) 7d) 7822) _________ keyword is used to declare variables in JavaScript.a) Varb) Dimc) String23) In JavaScript, which of the following method is used to evaluate the regular expression?a) eval(2*(3+5))b) evaluate(2*(3+5))c) evalu(2*(3+5))d) None of the above24) What is the output of following JavaScript code?<script type="text/javascript">function x(){var s= "quality 100%"; var pattern = /\d/g;var output= s.match(pattern);document.write(output);}</script>a) 100b) 1,0,0c) q,u,a,l,i,t,y,%d) Error25) What is the output of following JavaScript code?<script type="text/javascript">var cst=((45%2)==0)?"hello":"bye";document.write(cst);</script>a) hellob) byec) Error in string handlingd) None of the above26) What is the output of following JavaScript code?<script type="text/javascript">function x(){var cst = "Chadha Software Technologies";var pattern = new RegExp("SOFTWARE","i");document.write(cst.match(pattern));}</script>a) Errorb) SOFTWAREc) Softwared) null27) How do you create a new object in JavaScript?a) var obj = {};b) var obj = Object();c) var obj=new {};d) None of the above28) What does isNaN function do in JavaScript?a) Return true if the argument is not a number.b) Return false if the argument is not a number.c) Return true if the argument is a number.d) None of the above29) If x=103 & y=9 then x%=y , what is the value of x after executing x%=y?a) 4b) 3c) 2d) 530) Choose the external object among the follwing:a) Dateb) Optionc) Layerd) Checkbox31) Choose the four symbol pairs that represent RegExp properties lastMatch, lastParent, leftContext, and rightContext, respectively:a) $&, $+, $`, $'b) $+, $&, $', $`c) $&, $~, $`, $'d) $+, $&, $`, $'32) Which of the following properties hold the values of the pixels of the length of the width and height of the viewer's screen resolution?a) screen.width and screen.heightb) Resolution.width and Resolution.heightc) screen.pixels.width and screen.pixels.heightd) ViewerScreen.width and ViewerScreen.height33) What does ParseInt("15",10) evaluates to?a) 15b) 10c) 151d) 15034) Which JavaScript feature uses JAR files?a) Object signingb) Style sheetsc) Netcaster channelsd) Image rollovers35) How to assign a function to a variable with the JavaScript Function contructor?a) var f=Function("x","y","return x+y");b) var f=Function(x,y){ return x+y;}c) var f= new Function("x", "y", "return x + y");36) In JavaScript, Window.alert() is used to allow user to enter somethinga) Trueb) Falsec) None of above37) What is the output of following JavaScript code?<script type="text/javascript">function x(){var cst = "We are fast growing Software Company located in Chennai, India.";var pattern = new RegExp("in","gi");document.write(pattern.exec(cst) + " ");document.write(pattern.exec(cst) + " ");document.write(pattern.exec(cst) + " ");}</script>a) in in Inb) in in inc) in in nulld) in null null38) Does JavaScript has any DATE data type?a) Yesb) No39) Math.round(-20.5)=?a) -21b) 20c) -20d) 2140) ?_name is it valid javascript identifier?a) Yesb) No41) What is the output of following JavaScript code?<script type="text/javascript">function x(){var cst = "First come, first served"; var pattern = /first/gi;document.write(cst.match(pattern)[1]);} </script>a) firstb) undefinedc) Firstd) Error42) Which of these comment lines are used in JavaScript?(1) // , /* ...... **/ (2) / , /** ......./ , /*(3) /*......*/ , //(4) \*......*\ , //a) Only (4)b) Only (3)c) Either (3) or (4)d) Only (2)43) What is the output of following JavaScript code?<script type="text/javascript">function x(){var s = "Give 100%!{[!!";var pattern = /\W/g;var output = s.match(pattern);document.write(output);}</script>a) ,%,!,{,[,!,!b) G,i,v,e,1,0,0c) Give 100d) Error44) Which best describes void?a) A methodb) A functionc) A statementd) An operator45) What is the output of following JavaScript code?<script type="text/javascript">var cst="Chadha Software Technologies";var result =cst.lastIndexOf("a");document.write(result);</script>a) 2b) 12c) 11d) 1346) What is the output of following JavaScript code?<script type="text/javascript">function x(){var cst = "First come, first served"; var pattern = /first/g;document.write(cst.match(pattern)[1]);} </script>a) firstb) Firstc) undefinedd) None of the above47) What is the output of following JavaScript code?<script type="text/javascript">function sum(x){function add(y){return x+y;}return add;}function callme(){result=sum(5)(5);alert(result);}</script>If you call the function callme(), what will happen?a) 10b) Error in calling Functionc) 5d) None of the above48) Who invented the JavaScript programming language?a) Tennis Ritchieb) James Goslingc) Brendan Eich49) Can you write HTML tags inside the JavaScript code as shown below?<script type="text/javascript">document.write("<h1>This is a heading</h1>");document.write("<p>This is a paragraph.</p>");document.write("<p>This is another paragraph.</p>");</script>a) Nob) Yesc) Impossible50) Which feature is supported in MSIE 3.x?a) split()b) document.clear()c) join()d) charAt()51) How to speicfy the color of the hypertext links with JavaScript?a) document.linkColor="#00FF00";b) document.LColor="#00FF00";c) document.LinkC="#00FF00";d) document.hyperTextLink="#00FF00":52) What will be the output of following JavaScript code?<script type="text/javascript">function x(){var cst = "Chadha Software Technologies";var pattern = /software/;var output= cst.search(pattern);document.write("Position: " + output);}</script>a) Position:-7b) Position-1c) nulld) error53) ________ method returns the number of milliseconds in a date string.a) setHours()b) setMinutes()c) parse()54) ________ converts a string to floating point numbers.a) evalb) ParseIntc) ParseFloatd) None55) ________ attempts to evaluate a string representing any javascript literals or variables, converting it to a number.a) evalb) parseFloatc) parseIntd) None56) Which is not an attribute of the cookie property?a) pathb) hostc) secured) domain57) How do substring() and substr() differ?a) One is not a method of the String object.b) substr() takes three arguments, substring() only two.c) Only one accepts a desired string length as an argument.d) Besides the spelling, nothing.58) Which is not a reserved word?a) interfaceb) shortc) programd) throws59) In Javascript, which of the following method is used to find out the character at a position in a string?a) charAt()b) CharacterAt()c) CharPos()d) characAt()60) What will be the output of following JavaScript code snippter?<script type="text/javascript">var cst = "PHPKB Knowledge Base Software";var result =cst.substring(7,8);document.write(result);</script>a) PHPKB Knb) Knc) owd) n61) How do you delete an element from an options array?a) Set it to false.b) Set it to null.c) Set it to undefined.d) Set it to -162) Is JavaScript case sensitive language?a) Yesb) No63) JavaScript RegExp Object has modifier 'i' to __________a) Perform case-sensitive matchingb) Perform case-insensitive matchingc) Perform both case-sensitive&case-insensitive matching64) What are the following looping structures are available in JavaScript?a) for, foreachb) foreach, whileloopc) do-while loop, foreachd) for, while loop65) Which of these is not a method of the Math object?a) atan()b) atan2()c) eval()d) acos()66) What will be the output of following JavaScript code snippter?<script type="text/javascript">var s = "9123456 or 80000?";var pattern = /\d{4}/;var output = s.match(pattern);document.write(output);</script>a) 9123b) 91234c) 80000d) None of the above67) In javascript, RegExp Object Method test() is used to search a string and returns _________a) true or falseb) found valuec) indexd) None of the above68) What property would you use to redirect a visitor to another page?a) document.URLb) window.location.hrefc) document.location.hrefd) link.href69) In JavaScript, which of the statements below can be used for string declaration?1) var cst="PHPKB Knowledge Base Software"; 2) var cst=new String("PHPKB Knowledge Base Software");a) Either (1) or (2)b) Only (1)c) Neither (1) nor (2)d) Only (2)70) What will be the output of following copde snippet?<script type="text/javascript">var cst = "Chadha Software Technologies";var result = cst.indexOf("Tech");document.write(result);</script>a) 15b) 16c) 19d) 1771) What will be the output of following copde snippet?<script type="text/javascript">function x(){var s = "Eat to live, but do not live to eat";var pattern = new RegExp("eat$");document.write(pattern.exec(s));}</script>a) Eatb) eatc) undefinedd) Eat eat72) What will be the output of following copde snippet?<script type="text/javascript">function x(){var cst = "We are Fast Growing Software Company located in Jalandhar, India.";var pattern = new RegExp("in","g");document.write(pattern.exec(cst) + " ");document.write(pattern.exec(cst) + " ");document.write(pattern.exec(cst) + " ");}</script>a) in in Inb) in in inc) in in nulld) in null null73) -________ method is used to remove focus from the specified object.a) blur()b) focus()c) None74) What does parseFloat("FF2") evaluates to?a) 152b) FF2c) NaNd) None75) eval((20*4)=?a) Nanb) 204c) 24d) 8076) What will be the output of following JavaScript code?<script type="text/javascript">function x(){var cst = "PHPKB Knowledge Base Software";var pattern = new RegExp("BASE","i");document.write(cst.match(pattern));}</script>a) nullb) Basec) BASEd) Error77) JavaScript is a ________ typed language.a) tightlyb) looselyAnswers of JavaScript Interview Quiz Questions<!--google_ad_client = "pub-5439884258125569";google_ad_slot = "8217394354";google_ad_width = 336;google_ad_height = 280;//-->(1) a (2) c (3) a (4) a (5) a (6) a (7) c (8) c (9) c (10) d(11) a (12) c (13) b (14) a (15) a (16) b (17) b (18) b (19) c (20) c(21) d (22) a (23) a (24) b (25) b (26) d (27) a (28) a (29) a (30) d(31) a (32) a (33) a (34) a (35) c (36) b (37) a (38) b (39) c (40) b(41) a (42) b (43) a (44) d (45) b (46) c (47) a (48) c (49) b (50) d(51) a (52) b (53) c (54) c (55) a (56) b (57) c (58) c (59) a (60) d(61) b (62) a (63) b (64) d (65) c (66) a (67) a (68) b (69) a (70) b(71) b (72) c (73) a (74) c (75) d (76) b (77) bWhich of the following Javascript Regular Expression modifiers finds one or more occurrences of a specific character in a string?a.??b.?*c.?+d.?#Question: 02Analyze the following code snippet. What will be the output of this code?<html><body><script type=”text/javascript”>var str = “Visit Gardens(now)”;var patt1 = new RegExp(“(now)”, “g”);patt1.test(str);document.write(RegExp.lastParen);</script></body></html>a.?nowb.?(now)c.?15d.?19Question: 03In an HTML page, the form tag is defined as follows:<form onsubmit=”return Validate()” action=””>The validate() function is intended to prevent the form from being submitted if the name field in the form is empty. What will the validate() function look like?a.?<script type=”text/javascript”>function Validate(){if(document.forms[0].name.value == “”)return true;elsereturn false;}</script>b.?<script type=”text/javascript”>function Validate(){if(document.forms[0].name.value == “”)return false;elsereturn true;}</script>c.?<script type=”text/javascript”>function Validate(){if(document.forms[0].name== “”)return false;elsereturn true;}</script>d.?<script type=”text/javascript”>function Validate(){if(document.forms[0].name == “”)return true;elsereturn false;}</script>Question: 04Which of the following methods is not a valid Array object method in JavaScript?a.?reverseb.?shiftc.?unshiftd.?splicee.?All of the above are valid.Question: 05Consider the code snippet below. Which of the given options represents the correct sequence of outputs when this code is executed in E4X?var p1 = <p>Kibology for all.</p>;alert(p1.name().uri);default xml namespace = ‘’;var p2 = <p>Kibology for all.</p>;alert(p2.name().uri);default xml namespace = ”;var p3 = <p>Kibology for all.</p>;alert(p3.name().uri);a.?”,,”b.?”,”,”c.?”, of the aboveQuestion: 06Which of the following Javascript Regular Expression object methods is used to search a string for a specified value and return the result as true or false?a.?exec()b.?compile()c.?return()d.?test()Question: 07Which of the following is not a valid JavaScript operator?a.?*=b.?/=c.?%=d.?^+Question: 08Analyze the following code snippet. What will be the output of this code?<html><body><script type=”text/javascript”>var str = “The drain of the plane is plain”;var patt1 =/ain/g;document.write(str.match(patt1));</script></body></html>a.?1b.?ainc.?7,29d.?7e.?ain,ainQuestion: 09Which of the following DOM objects can be used to determine the resolution of the screen?a.?It is not possible to determine the resolution of the screen.b.?Screen objectc.?Document objectd.?Window objecte.?None of the aboveQuestion: 10Which of the following statements regarding let in JavaScript is not correct?a.?The let definition defines variables whose scope is constrained to the block in which they’re defined. This syntax is very much like the syntax used for var.b.?The let expression lets you establish variables scoped only to a single expression.c.?The let keyword provides a way to associate values with variables within the scope of a block, and affects the values of like-named variables outside the block.d.?You can use let to establish variables that exist only within the context of a for loop.Question: 11Which of the following is not a valid String method?a.?link()b.?italics()c.?str()d.?sup()Question: 12Consider the following code snippet. Which of the given options would be used in E4X to change the color of the descendant node chair?var element = <Home><Room><Furniture><chair color=”Brown”/></Furniture></Room></Home>a.?element.chair.color=”light brown”b.?element.chair.@color=”light brown”c.?element..chair.@color=”light brown”Question: 13Which of the following Javascript Regular Expression Character Classes finds any non-digit character in a given string?a.?\Wb.?\Sc.?\Bd.?\DQuestion: 14Which of the following is the correct syntax for using the Javascript exec() object method?a.?RegExpObject.exec()b.?RegExpObject.exec(string)c.?RegExpObject.exec(parameter1,parameter2)d.?None of the aboveQuestion: 15Which of the following results is returned by the JavaScript operator “typeof” for the keyword “null”?a.?functionb.?objectc.?stringd.?numberQuestion: 16Which of the following methods is used to add and/or remove elements from an array and modify them in place?a.?pushb.?slicec.?joind.?spliceQuestion: 17Which of the given options represents the correct length when alert(Emp..*.length()); is applied to the following code?var Emp = <Emp><name>Mark</name><likes><os>Linux</os><browser>Firefox</browser><language>JavaScript</language><language>Python</language></likes></Emp>a.?11b.?5c.?6d.?12Question: 18Which of the following can be achieved using JavaScript?a.?Reading or writing from external filesb.?Accessing or modifying browser settingsc.?Launching the default email application of the clientd.?All of the above can be achieved using JavaScript.Question: 19Consider the code below. What will be the final value of the variable “apt”?var apt=2;apt=apt<<2;a.?2b.?4c.?6d.?8e.?16Question: 20Which of the following options can be used to delete a child node of an XML object in E4X?a.?delete xmlobject.child;b.?delete xmlobject.child[0];c.?delete xmlobject.@attribute;d.?All of the aboveQuestion: 21Which of the following can be used to create attribute values by placing variables and expressions within them?a.?[]b.?()c.?{}d.?<>Question: 22What is the output of the following JavaScript code?s2 = new String(“2 + 2″)document.write(eval(s2));a.?4b.?2+2c.?Errord.?None of the aboveQuestion: 23Analyze the following code using the source property of Regular Expressions. What will be the output of the below code snippet?<html><body><script type=”text/javascript”>var str = “Visit Garden\Showcase”;var patt1 = new RegExp(“en\S”,”g”);document.write(“The regular expression is: ” + patt1.source);</script></body></html>a.?The regular expression is: en\Sb.?The regular expression is: 11c.?The regular expression is: enSd.?The regular expression is: 10Question: 24Is the following statement true or false?A function becomes a generator if it contains one or more yield statements.a.?Trueb.?FalseQuestion: 25Is the following statement regarding expression closures in JavaScript true or false?The syntax function(x) {return x*x;} can be written as function(x) x*x.a.?Trueb.?FalseQuestion: 26What does the following JavaScript code do?<html><body><script type=”text/javascript”>function validate(){var chk=”ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz”;var ok=”yes”;var temp;var field1=document.getElementById(“t1″);var field=field1.value.substring(field1.value.length-1,field1.value.length);if(chk.indexOf(field)==”-1″){alert(“error”);field1.value=(field1.value).slice(0,field1.value.length-1);}}</script><input type=”text” id=”t1″ onkeyup=”validate()” onkeypress =”validate()”/></body></html>a.?The code will cause an error alert to be displayed if a numeric character is entered, and the numeric character is removed.b.?The code will cause an error alert to be displayed if a non-numeric character is entered, and the non-numeric character is removed.c.?The code will cause an error alert to be displayed if a numeric character is entered, and the value of textbox is reset.d.?The code will cause an error alert to be displayed if a non-numeric character is entered, and the value of textbox is reset.Question: 27Which of the following objects is the top-level object in the JavaScript hierarchy?a.?Navigatorb.?Screenc.?Windowd.?DocumentQuestion: 28In JavaScript, the encodeURI() function is used to encode special characters. Which of the following special characters is/are an exception to that rule?a.??b.?€c.?@d.?$e.?a and bf.?c and dQuestion: 29Which of the following is the correct way to create an XML object in E4X?a.?var languages = new XML(‘<languages type=”dynamic”><lang>JavaScript</lang><lang>Python</lang></languages>’);b.?var languages XML = new XML(‘<languages type=”dynamic”><lang>JavaScript</lang><lang>Python</lang></languages>’);c.?var languages = <languages type=”dynamic”><lang>JavaScript</lang><lang>Python</lang></languages>;d.?All of the above are correct.e.?a and cf.?b and cQuestion: 30Which of the following are not global methods and properties in E4X?a.?ignoreCommentsb.?ignoreWhiteSpacec.?setName()d.?setNamespace()e.?a and bf.?c and dQuestion: 31Which of the following is used to solve the problem of enumerations in JavaScript?a.?letb.?Regexc.?Generatorsd.?E4XQuestion: 32Which of the following is not a valid Date Object method in JavaScript?a.?parse()b.?setDay()c.?setTime()d.?valueOf()Question: 33Which of the following is the correct method for getting the date of February 1 of the current year into a variable called “newDate”?a.?var d = new Date();newDate=new Date(d.getFullYear(), 1, 2);b.?var d = new Date();newDate=new Date(d.getFullYear(), 2, 1);c.?var d = new Date();newDate=new Date(d.getFullYear(), 1, 1);d.?var d = new Date();newDate= (d.getFullYear(), 1, 1);Question: 34Which of the following options is used to access the attributes in E4X?a.?@b.?::c.?#d.?*Question: 35Which of the following Array methods in JavaScript runs a function on every item in the Array and collects the result from previous calls, but in reverse?a.?reduce()b.?reduceRight()c.?reverse()d.?pop()Question: 36Which of the following is not a valid method in generator-iterator objects in JavaScript?a.?send()b.?throw()c.?next()d.?stop()Question: 37Analyze the following code snippet, which uses a Javascript Regular Expression Character Set. What will be the output of this code?<html><body><script type=”text/javascript”>var str = “Is this enough?”;var patt1 = new RegExp(“[^A-J]“);var result = str.match(patt1);document.write(result);</script></body></html>a.?Ib.?Isc.?sd.?I,s,Question: 38Analyze the following code snippet. What will be the output of this code?<html><body><script type=”text/javascript”>var str = “The rose”;var patt1 = new RegExp(“rose”, “g”);patt1.test(str);document.write(“rose found. index now at: ” + patt1.lastIndex);</script></body></html>a.?rose found. index now at: 5b.?rose found. index now at: 4c.?rose found. index now at: 8d.?No outputQuestion: 39Using the concept of “iterators” and “generators” in JavaScript, what will be the output of the following code?function testGenerator(){yield “first”;document.write(“step1″);yield “second”;document.write(“step2″);yield “third”;document.write(“step3″);}var g = testGenerator();document.write(g.next());document.write(g.next());a.?firststep1secondb.?step1step2c.?step1d.?step1step2step3Question: 40Which of the following is the correct syntactical representation of a generator expression in JavaScript?a.?var doubles = [i * 2 for (i in it)];b.?var doubles = [i * 2 for [i in it]];c.?var doubles = (i * 2 for (i in it));d.?var doubles = {i * 2 for (i in it)};Formun ?stü1. A?a??daki mant?ksal ifadelerden hangisi do?rudur??(A) 2 * 2 + 2 = 8 ;?(B) (2<4) and not (5>3) ;?(C) (5 >= 6) or (2 div 2 = 1) ;?(D) (-4*5 = 20) or not (4 mod 2 = 0) ;?(E) Hi?birisiFormun Alt?Formun ?stü2. A?a??dakilerden hangisi 0 d?r??(A) 3 mod 2 -2 ;?(B) 1 - 4 mod 3 ;?(C) 6 mod 3 - 1 ;?(D) 6 div 2 + 1 ;?(E) 2 + 6 mod 2 ;Formun Alt?Formun ?stü3. var x array[-7..7] of boolean;veriliyor. x 'in her bir ??esi hangi de?erleri alabilir??(A) Bir tek mümkün de?eri al?r?(B) ?ki mümkün de?erden birisini al?r?(C) 15 de?er al?r?(D) 14 de?er al?r?(E) 7 de?er al?rFormun Alt?Formun ?stü4. var x : array[-7..7] of boolean;?veriliyor. x 'in ka? tane ??esi vard?r??(A) 7?(B) 14?(C) 15?(D) 2?(E) 1Formun Alt?5 , 6 ve 7 nci sorularda ?u bildirimler varsay?lacakt?r.type Ucus= recordKalkisZamani, VarisZamani: real;Kap?: char;Sayi: integer;TamZaman, Sat?ld?: boolean;end;Ucuslar= array[1..100] of Ucus;var THY, KLM, TWA: Ucuslar;Formun ?stü5. THY n?n 21 numaral? u?u?unun kalk?? zaman?n? yazan deyim a?a??dakilerden hangisidir??(A) writeln ( THY[21].KalkisZamani ) ;?(B) writeln ( KalkisZamani[21].THY ) ;?(C) writeln ( THY[21].Ucuslar ) ;?(D) writeln ( THY[21].Ucus ) ;?(E) THY[21] ;Formun Alt?Formun ?stü6. writeln ( THY[78].Kapi ) ;?deyimi a?a??dakilerden hangisini yazar??(A) THY[78] 'in kap? kodunu?(B) THY[78] ve kap? kodunu?(C) THY[78] 'in kalk?? zaman?n? ve kap? kodunu?(D) THY[78] 'in bütün bile?enlerini?(E) Yukar?dakilerden hi?birisiFormun Alt?Formun ?stü7. 5 inci soruda bildirimi yap?lan record'un ka? bile?eni vard?r??(A) 100?(B) 4?(C) 6?(D) 10?(E) 5Formun Alt?Formun ?stü8. Standart PASCAL'da, a?a??daki operat?rler aras?nda, ?ncelik s?ras? kimdedir??(A) not?(B) div?(C) and?(D) or?(E) inFormun Alt?Formun ?stü9. Standart PASCAL i?in a?a??dakilerden hangisi do?rudur??(A) Dosya yoktur.?(B) Yaln?zca TEXT vard?r?(C) Yaln?zca istemli eri?imli dosya vard?r?(D) S?ral? ve istemli eri?imli dosya vard?r?(E) Hi?birisiFormun Alt?Formun ?stü10. Standart PASCAL'da dosya hangi mod ile a??labilir??(A) Yazmak i?in?(B) Okumak i?in?(C) Hem yazmak hem okumak i?in?(D) Okumak veya yazmak i?in?(E) Hi?birisiFormun Alt?Formun ?stü11. Standart PASCAL'da yazmak i?in dosya hangi komut ile a??labilir??(A) Write?(B) Read?(C) WriteOrRead?(D) Rewrite?(E) ResetFormun Alt?Formun ?stü12. Standart PASCAL'da okumak i?in dosya hangi komut ile a??labilir??(A) Write?(B) Read?(C) WriteOrRead?(D) Rewrite?(E) ResetFormun Alt?Formun ?stü13. Standart PASCAL'davarf1, f2 : file of integer;bildirimini i?eren bir programda, a?a??dakilerden hangisi ge?ersiz bir deyimdir??(A) f1^ := 8 ;?(B) f1^ := f2^ ;?(C) f1 := f2 ;?(D) f1^ := f1^ * f2^ + 7 ;?(E) rewrite(f1) ;Formun Alt?Formun ?stü14. Standart PASCAL'davarf1, f2: file of integer;k, r: integer;bildirimini i?eren bir programda, a?a??dakilerden hangisi ge?ersiz bir deyimdir??(A) write(f1, 92) ;?(B) f1^ := 92 ; put(f1) ;?(C) read(f2, r) ;?(D) r := f1^ ; get(f2) ;?(E) rewrite(f1) ; read(f1, k) ;Formun Alt?Formun ?stü15. Standart PASCAL'davar^p: integer;bildirimini i?eren bir programda, a?a??dakilerden hangisi do?rudur??(A) p bir pointer'dir??(B) p^ bir pointer'dir?(C) ^p bir pointer'dir?(D) Bildirim yanl??t?r?(E) Hi?birisiFormun Alt?Formun ?stü16. Standart PASCAL'davar^p, ^q: real; bildirimini i?eren bir programda, a?a??dakilerden hangisi yanl??t?r??(A) p := q ;?(B) p^ := q^ ;?(C) ^p := ^q ;?(D) p^ := P^ *q^ + 34.27 ;?(E) Hi?birisi ;Formun Alt?Formun ?stü17. Standart PASCAL'datypeKimPtr= ^KimRec ;KimRec = recordadi,soyadi: packed array[1..20] of char ;ucret: real end;varkim, per: KimPtr;bildirimini i?eren bir programda, a?a??dakilerden hangisi do?rudur??(A) KimPtr bildirimi KimRec'dan sonra olmal?d?r?(B) KimPtr bir dinamik de?i?kendir??(C) Kim bir dinamik de?i?kendir?(D) Kim^ bir dinamik de?i?kendir?(E) Hi?birisi ;Formun Alt?Formun ?stü18. Standart PASCAL'datypeKimPtr= ^KimRec ;KimRec = recordadi, soyadi: packed array[1..20] of char;ucret: real end;varkim, per: KimPtr;bildirimini i?eren bir programda, a?a??dakilerden hangisi do?rudur??(A) new(KimPtr) ;?(B) dispose(KimPtr) ;?(C) new(Kim) ;?(D) new(Kim^) ;?(E) Hi?birisi ;Formun Alt?Formun ?stü19. Standart PASCAL'datypeDepoKayit= recordNo, Nicelik: integer;marka, maladi: packed array[1..20] of char;fiyat: real ; end;MalPtr= ^MalRec ;MalRec = recorddata : DepoKayit ;link: MalPtrend;varList, p: MalPtr;n, mode: integer ;bulundu: boolean ;procedure proc1(list : MalPtr ; n : integer; var bulundu : boolean ; var p : MalPtr);beginp := List ;bulundu := False ;while not bulundu and (p <> nil) do if p^.data.no = n then bulundu := Trueelse p := p^.linkend;procedure proc2(var list : MalPtr ; n : integer);varp : MalPtr ;beginnew(p)p^.link := list ;list := p ;with p^.data do beginno := n ;nicelik := 1 end end ;bildirimini i?eren bir programda, proc1 'in i?levi nedir ??(A) Kay?t giri?ini sa?lar?(B) Liste yapar?(C) Kay?t arar?(D) Kay?t siler?(E) Hi?birisiFormun Alt?Formun ?stü20. proc2 'nin i?levi nedir ??(A) Kay?t giri?ini sa?lar?(B) Liste yapar?(C) Kay?t arar?(D) Kay?t siler?(E) Hi?birisiFormun Alt?Formun ?stü21. Yukar?daki bildirimi i?eren programda, list pointerinin bo? bir listeyi i?aret etmesi i?in a?a??daki deyimlerden hangisi verilmelidir??(A) new(list) ;?(B) dispose(list) ;?(C) nil(list)?(D) Close(list) ;?(E) Hi?birisiFormun Alt?Formun ?stü22. Yukar?daki bildirimi i?eren bir programda, p pointerinin listede bir sonraki kayd? i?aret etmesi i?in a?a??daki deyimlerden hangisi verilmelidir??(A) new(p^) ;?(B) new(^p) ;?(C) nil(p) ;?(D) p := p^.link ;?(E) Hi?birisi?Formun Alt?Formun ?stü23. Yukar?daki bildirimi i?eren programda, list dinamik de?i?kenini a?a??daki deyimlerden hangisi yokeder??(A) new(list) ;?(B) dispose(list) ;?(C) nil(list)?(D) Close(list) ;?(E) Hi?birisiFormun Alt?Formun ?stü24. A?a??dakilerden hangisi do?rudur??(A) Bellekteki bir de?i?kene onun sembolik ad? ile eri?ilebilir ;?(B) Bellekteki bir de?i?kene onu i?aret eden bir pointer ile eri?ilebilir ;?(C) Statik de?i?ken, ya?am? (life-time) süresince ana bellekteki adresini korur ;?(D) Dinamik de?i?ken program ko?arken yarat?l?p yokedilebilir ;?(E) HepsiFormun Alt?A?a??daki bildirim sonraki sorularda kullan?lacakt?r.Varm, n : integer;x, y : real;p, q : ^integer;a, b : ^real;Formun ?stü25. A?a??daki deyimlerden hangisi yanl??t?r??(A) p := 17 ;?(B) q := n ;?(C) b := b^ ;?(D) ReadLn(p,a) ;?(E) HepsiFormun Alt?Formun ?stü26. A?a??daki deyimlerden hangisi yanl??t?r??(A) a := 134.45 ;?(B) p + q ;?(C) a := b^ ;?(D) WriteLn(q,b) ;?(E) HepsiFormun Alt?Formun ?stü27. A?a??daki deyimlerden hangisi do?rudur??(A) m := 245 ;?(B) n := 3*m ;?(C) p^:= n ;?(D) WriteLn(p^ :5) ;?(E) HepsiFormun Alt?Formun ?stü28. A?a??daki deyimlerden hangisi do?rudur??(A) m := 245 ;?(B) n := 3 * m ;?(C) p^ := n ;?(D) WriteLn(p^ :5) ;?(E) HepsiFormun Alt?Formun ?stü29. A?a??daki deyimlerden hangisi do?rudur??(A) m := 4 * p^ ;?(B) q^:= n * p^ ;?(C) a^ := 236.76 * m / 5 ;?(D) WriteLn(q^ :5) ;?(E) HepsiFormun Alt?Formun ?stü30. A?a??daki deyimlerden hangisi do?rudur??(A) Bir pointerin de?eri i?aret etti?i dinamik de?i?kenin adresidir ;?(B) Bir pointerin de?eri kendi bulundu?u yerin adresidir ;?(C) Bir pointer, i?aret etti?i dinamik de?i?kenin elverdi?i her i?leme girebilir ;?(D) Bir dinamik de?i?ken, i?aret etti?i pointerin tipinin elverdi?i her i?leme girebilir ;?(E) Bir pointer ayn? anda birden ?ok dinamik de?i?keni i?aret edebilir ;Formun Alt?A?a??daki program sonraki soruda kullan?lacakt?r.PROGRAM ust;Var Taban,Ust: Real;FUNCTION KUVVET(a, x : real) : real ;BeginKuvvet := exp(ln(a) * x )End;BEGINWriteln('Taban ve Ust''u giriniz');Readln(Taban,Ust);Writeln(Taban:10:3,' ^ ',Ust:5:2,' = ', Kuvvet(Taban, Ust):10:3)END.Formun ?stü31. ust adl? program i?in a?a??dakilerden hangisi do?rudur ??(A) Büyük harfler kullan?ld??? i?in program yanl??t?r?(B) Koyu harfler kullan?ld??? i?in program yanl??t?r?(C) Kullan?c? a ve x say?lar?n? girince ax?hesaplan?r?(D) Kullan?c? a ve x say?lar?n? girince xa?hesaplan?r?(E) Yürütme b?lümünde kuvvet fonksiyonu ?a?r?lmad??? i?in ??kt? olmazFormun Alt?Javascript quizFebruary 8th, 2010I was recently reminded about?Dmitry Baranovsky’s Javascript test, when N. Zakas answered and?explained it in a blog post. First time I saw those questions explained was by?Richard Cornford in comp.lang.javascript, although not as thoroughly as by Nicholas.I decided to come up with my own little quiz. I wanted to keep question not very obscure, practical, yet challenging. They would also cover wider range of topics.Host objectsContrary to Dmitry’s test, quiz does?not involve host objects?(e.g.?window), as their behavior is unspecified and can vary sporadically across implementations. We are talking about pure ECMAScript (3rd ed.) behavior. Now, it’s worth pointing out that sometimes implementationsdeviate from the standard collectively, forming their own, de-facto standard. An example of this is?for-in?statement, where none of the popular implementations throw?TypeError?when expression evalutes to?null?or?undefined?—?for (var prop in null) { ... }?— and instead just silently ignore it. I tried to avoid these non-standard cases. Every question has a correct answer that can be reproduced in at least one of the major implementations.So what are we testing?Not a lot really. Quiz mainly focuses on knowledge of scoping, function expressions (and how they differ from function declarations), references, process of variable and function declaration, order of evaluation, and a couple more things like?delete?operator and object instantiation. These are all relatively simple concepts, which I think every professional Javascript developer should know. Most of these are applied in practice quite often. Ideally, even if you can’t answer a question, you should be able to infer answer from specs (without executing the snippet). When creating these questions, I made sure I can answer each one of them off the top of my head, to keep things relatively simple.Note, however, that?not all questions are very practical, so don’t worry if you can’t answer some of them. We don’t often use?withstatement, for example, so failing to know/remember its exact behavior is understandable.Few notes about codeAssuming ECMAScript 3rd edition (not 5th)Implementation quirks do not count (assuming standard behavior only)Every snippet is run as a global code (not as?eval?or?function?one)There are no other variables declared (and host environment is not extended with anything beyond what’s defined in specs)Answer should correspond to exact return value of entire expression/statement (or last line)“Error” in answer indicates that overall snippet results in a runtime errorQuizPlease make sure you?select answer in each question, as lack of answer is not checked and counts as failure. The final score is simply a number of wrong answers, less is better. Quiz requires Javascript to be enabled.1. (function(){ return typeof arguments; })();?“object”?“array”?“arguments”?“undefined”2. var f = function g(){ return 23; }; typeof g();?“number”?“undefined”?“function”?Error3. (function(x){ delete x; return x; })(1);?1?null?undefined?Error4. var y = 1, x = y = typeof x; x;?1?“number”?undefined?“undefined”5. (function f(f){ return typeof f(); })(function(){ return 1; });?“number”?“undefined”?“function”?Error6. var foo = { bar: function() { return this.baz; }, baz: 1 }; (function(){ return typeof arguments[0](); })(foo.bar);?“undefined”?“object”?“number”?“function”7. var foo = { bar: function(){ return this.baz; }, baz: 1 } typeof (f = foo.bar)();?“undefined”?“object”?“number”?“function”8. var f = (function f(){ return "1"; }, function g(){ return 2; })(); typeof f;?“string”?“number”?“function”?“undefined”9. var x = 1; if (function f(){}) { x += typeof f; } x;?1?“1function”?“1undefined”?NaN10. var x = [typeof x, typeof y][1]; typeof typeof x;?“number”?“string”?“undefined”?“object”11. (function(foo){ return typeof foo.bar; })({ foo: { bar: 1 } });?“undefined”?“object”?“number”?Error12. (function f(){ function f(){ return 1; } return f(); function f(){ return 2; } })();?1?2?Error (e.g. “Too much recursion”)?undefined13. function f(){ return f; } new f() instanceof f;?true?false14. with (function(x, undefined){}) length;?1?2?undefined?Error1)?Inside which HTML element do we put the JavaScript????????a)??<scripting>???????b)??<javascript>???????c)??<script>???????d)??<js>2)?What is the correct JavaScript syntax to write "Hello World"????????a)??response.write("Hello World")???????b)??document.write("Hello World")???????c)??("Hello World")???????d)??echo("Hello World")3)?How do you call a function named "myFunction"????????a)??call function myFunction???????b)??myFunction()???????c)??call myFunction()4)?How do you write a conditional statement for executing some statements only if "i" is equal to 5????????a)??if i==5 then???????b)??if i=5 then???????c)??if (i==5)???????d)??if i=55)?How do you write a conditional statement for executing some statements only if "i" is NOT equal to 5????????a)??if (i <> 5)???????b)??if (i != 5)???????c)??if =! 5 then???????d)??if <> 56)?How many different kind of loops are there in JavaScript????????a)??Two. The "for" loop and the "while" loop???????b)??Four. The "for" loop, the "while" loop, the "do...while" loop, and the "loop...until" loop???????c)??One. The "for" loop7)?How does a "for" loop start????????a)??for (i = 0; i <= 5)???????b)??for (i = 0; i <= 5; i++)???????c)??for i = 1 to 5???????d)??for (i <= 5; i++)8)?What is the correct way to write a JavaScript array????????a)??var txt = new Array(1:"tim",2:"shaq",3:"kobe")???????b)??var txt = new Array="tim","shaq","kobe"???????c)??var txt = new Array("tim","shaq","kobe")9)?How do you round the number 8.25, to the nearest whole number????????a)??Math.rnd(8.25)???????b)??Math.round(8.25)???????c)??round(8.25)???????d)??rnd(8.25)10)?How do you find the largest number of 6 and 8????????a)??Math.max(6,8)???????b)??top(6,8)???????c)??ceil(6,8)???????d)??Math.ceil(6,8)11)?What is the correct JavaScript syntax for opening a new window called "window5" ????????a)??new("","window5")???????b)??window.open("","window5")???????c)??open.newwindow("","window5")???????d)??new.window("","window5")12)?How do you put a message in the browser's status bar????????a)??window.status = "put your message here"???????b)??statusbar = "put your message here"???????c)??status("put your message here")???????d)??window.status("put your message here")13)?How do you find the client's browser name????????a)??browser.name???????b)??navigator.appName???????c)??client.navName14)?You define an array using???????a)??var myarray = new Array();???????b)??var myarray = array new;???????c)??var new Array() = myarray;???????d)??var new array = myarray;15)?Onclick is equivalent to which two events in sequence???????a)??onmouseover and onmousedown???????b)??onmousedown and onmouseout???????c)??onmousedown and onmouseup???????d)??onmouseup and onmouseout16)?Whicj best describe void????????a)??A method???????b)??A function???????c)??An operator???????d)??A statement17)?Which property would you use to redirect visitor to another page????????a)??window.location.href???????b)??document.href???????c)??java.redirect.url???????d)??link.redirect.href18)?Which of the following JavaScript statements use arrays????????a)??setTimeout("a["+i+"]",1000)???????b)??k = a & i???????c)??k = a(i)1. (function(){ return typeof arguments; })();?“object”?“array”?“arguments”?“undefined”2. var f = function g(){ return 23; }; typeof g();?“number”?“undefined”?“function”?Error3. (function(x){ delete x; return x; })(1);?1?null?undefined?Error4. var y = 1, x = y = typeof x; x;?1?“number”?undefined?“undefined”5. (function f(f){ return typeof f(); })(function(){ return 1; });?“number”?“undefined”?“function”?Error6. var foo = { bar: function() { return this.baz; }, baz: 1 }; (function(){ return typeof arguments[0](); })(foo.bar);?“undefined”?“object”?“number”?“function”7. var foo = { bar: function(){ return this.baz; }, baz: 1 } typeof (f = foo.bar)();?“undefined”?“object”?“number”?“function”8. var f = (function f(){ return "1"; }, function g(){ return 2; })(); typeof f;?“string”?“number”?“function”?“undefined”9. var x = 1; if (function f(){}) { x += typeof f; } x;?1?“1function”?“1undefined”?NaN10. var x = [typeof x, typeof y][1]; typeof typeof x;?“number”?“string”?“undefined”?“object”11. (function(foo){ return typeof foo.bar; })({ foo: { bar: 1 } });?“undefined”?“object”?“number”?Error12. (function f(){ function f(){ return 1; } return f(); function f(){ return 2; } })();?1?2?Error (e.g. “Too much recursion”)?undefined13. function f(){ return f; } new f() instanceof f;?true?false14. with (function(x, undefined){}) length;?1?2?undefined?Error ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- minecraft edu edition
- minecraft edu download free
- minecraft edu edition recipes
- minecraft edu mod download
- michigan tr 34
- tr 34 certification
- tr price funds historical performance
- tr 34 michigan form
- tr 34 certification michigan
- tr 34 blank certification form
- form tr 30 15 3
- form tr 30 15 3 certificate to terminate existence