aa

42
QN=1 (2726 ) Which of these characters can be included within the text in an XML document in literal form? a. > b. ; c. : d. - QN=2 (2928 ) XML parser checks for validity and well formed ness? a. True b. False QN=3 (2724 ) Which of the following is/are optional in the creation of an XML file? a. The <?xml version="1.0"?> statement b. The root element c. The opening tag in an element d. Entities QN=4 (2713 ) Which of the following XML attribute names is invalid? a. _notvalid b. I am not valid c. not-valid.1 d. _not1valid2 QN=5 (2934 ) A descendant having a new namespace cannot override the namespace defined by the parrent element? a. true b. false QN=6 (2926 ) Parameter entities use ampersand (&) and semicolon (;) as delimiters? a. true b. false QN=7 XML developer has to ensure the uniqueness of the element

Transcript of aa

Page 1: aa

QN=1 (2726)

Which of these characters can be included within the text in an XML document in literal form?

a. >b. ;c. :d. -

QN=2 (2928)

XML parser checks for validity and well formed ness?

a. Trueb. False

QN=3 (2724)

Which of the following is/are optional in the creation of an XML file?

a. The <?xml version="1.0"?> statementb. The root elementc. The opening tag in an elementd. Entities

QN=4 (2713)

Which of the following XML attribute names is invalid?

a. _notvalidb. I am not validc. not-valid.1d. _not1valid2

QN=5 (2934)

A descendant having a new namespace cannot override the namespace defined by the parrent element?

a. trueb. false

QN=6 (2926)

Parameter entities use ampersand (&) and semicolon (;) as delimiters?

a. trueb. false

QN=7 (2930)

XML developer has to ensure the uniqueness of the element names and attributes in a document?

a. trueb. false

QN=8 (2929)

XML is transformed only via XSLT?

a. trueb. false

QN=9 (2931)

Browser has the ability distinguish duplicate element names in an XML document?

a. trueb. false

Page 2: aa

QN=10 (2725)

Which of these is a valid comment in XML?

a. <!-–This is a sample XML document>b. <?This is a sample XML document?>c. <!- -This data should be hidden

<FIRSTNAME>Joe</FIRSTNAME> <LASTNAME>Johnson</LASTNAME>- ->

d. <?--This is a sample XML document-->

QN=11 (2731)

What does the keyword SYSTEM indicate in the following code?<?xml version =”1.0”?><!DOCTYPE Book SYSTEM “book.dtd”>

a. It is a system generated DTDb. Book.dtd is an internal DTDc. Book.dtd is an external DTDd. Book is a system variable

QN=12 (2728)

Which of the following statements is not true?

a. The <!DOCTYPE […] > declaration follows the XML declarationb. Entities that appear anywhere in an XML document are referred to as Parameter

entitiesc. Attributes are added to an element to provide information about the elementd. Entities must be declared within the document DOCTYPE declaration

QN=13 (2718)

Which of the following is not a keyword used for default settings in an! ATTLIST element?

a. #IMPLIEDb. #DEFINEc. #REQUIREDd. #FIXED

QN=14 (2938)

External DTDs use the keyword URL to specify the location of the DTD?

a. trueb. false

QN=15 (2717)

The question mark (?) operator indicates

a. either zero or one occurrence.b. any number of occurrences.c. one or more occurrences.d. more than one occurrence.

QN=16 (2945)

For each element type associated with a sequence element, there must be an element in the XML instance in the same order?

a. trueb. false

Page 3: aa

QN=17 (2948)

Specifies that the attribute cannot be used?

a. prohibitedb. requiredc. optionald. use

QN=18 (2918)

An XML Schema defines whether an element is empty or can include text.

a. trueb. false

QN=19 (2920)

In schema, the ALL element requires that

a. each element in the group must occur at most onceb. there must be an element in the XML instance in the same orderc. the maxOccurs attribute can be 0 or 1

QN=20 (2944)

The default value for the minOccurs attribute in Schema is 0

a. trueb. false

QN=21 (2771)

See the snipset below and choose one answer:

<xsl:value-of select=”floor(-2.3)”/>a. -2b. -2.5c. -3

QN=22 (2760)

Which top level XSLT elements is used to define a variable in a stylesheet or template and to assign it a value

a. xsl:includeb. xsl:outputc. xsl:variabled. xsl:text

QN=23 (2763)

Xpath can be thought of as a query language like SQL

a. Trueb. False

QN=24 (2738)

Which of these is the correct syntax to link an XSL file to an XML document?

a. <?xmls type="text/xsl" href="candidate.xsl"?>b. <?xml-stylesheet type="text/xsl" href="candidate.xsl"?>c. <?xsl type="text/xsl" href="candidate.xsl"?>d. <?xml:xsl href="candidate.xsl"?>

Page 4: aa

QN=25 (2901)

CSS positions can be either absolute or ________.

a. Staticb. relativec. transferredd. Disabled

QN=26 (2889)

________ are declared in each individual HTML element using the keyword STYLE.

a. Cascading style sheetsb. Inline stylesc. External stylesd. User style sheets

QN=27 (2773)

XSLT takes two things as input: an XSLT stylesheet and an xml input document

a. Trueb. false

QN=28 (2897)

What is the significance of the following CSS rule?LI, EM { color: red;cfont-weight: bold }

a. It will apply the specified style to text enclosed by either LI or EM tags.b. It will apply the specified style to text enclosed by the EM tags which are within LI tags.c. It will apply the specified style to text enclosed by the LI tags which are within EM tags.d. It will apply the specified style to text not enclosed by either LI or EM tags.

QN=29 (2893)

Which of the following selections is the proper way to apply this CSS rule:.blue { color: blue }

a. <P COLOR = "blue">b. <P CLASS = "blue">c. <P COLOR = .blue>d. <P CLASS = .blue>

QN=30 (2737)

In CSS, when a style is applied to an element containing other elements inside it

a. The style is applied to the element and all the other elements contained in itb. The style is applied only to the main elementc. The style is applied only to the child elementsd. The user is prompted with a message enquiring whether the style is to be applied to the

child elements as well

QN=31 (2747)

In DOM, a node can have

a. More than one parent nodesb. More than one children nodesc. No sibling nodes

QN=32 (2951)

Tree model is applied to static documents?

a. true

Page 5: aa

b. false

QN=33 (2754)

Method hasChildNodes of XMLDOMNode mean

a. Determine if a given node is empty or notb. Determine if a given node has child nodes or notc. Determine if a given node and all descendants has been parsed and instantiatedd. Return an integer representing the XML DOM node type

QN=34 (2739)

With reference to the snippet of code given below, choose the correct syntax to complete the second line in order to create a XML Document Object

var samplesample = ________________________

a. CreateXMLDocument()b. new ActiveXObject("microsoft.XMLDOM")c. NewXMLDocumentd. New XMLDOMObject

QN=35 (2740)

Which object represents the top level of the XML source?

a. XMLb. DOMParentc. DOMDocumentd. None of them

QN=36 (2753)

In SAX, to provide customized DTD handling, application need to implement

a. ErrorHandlerb. DTDHandlerc. EntityResolverd. DefaultHandler

QN=37 (2746)

SAX uses

a. Pull parsing machenic for processingb. Push parsing machenic for processingc. A in memory data structure for processing

QN=38 (2923)

The StAX cursor API represents

a. a cursor with which you can walk an XML document from beginning to end.b. an XML document stream as a set of discrete event objects.c. an object - based tree in computer memory

QN=39 (2751)

SAX support random access

a. Trueb. False

Page 6: aa

QN=40 (2756)

Method characters() of ContentHandler interface receives events for

a. The begining of elementb. Character datac. The end of elementd. The begining of document

QN=41 (2819)

What is the value of num after the following statement is performed? num = Math.round( 2.45 );

a. 0b. 2c. 2.5d. 3

QN=42 (2880)

What does the value string contain after the following code is executed?var string = "Good luck on the test";string = string.link("www.deitel.com")

a. a link to www.deitel.com with the text "www.deitel.com"b. a link to www.deitel.com with the text "Good luck on the test"c. the text "www.deitel.com"d. Nothing, the string conversion will generate an error.

QN=43 (2857)

To divide the value of the seventh element of array a by 2 and assign the result to the variable x, we would write ________.

a. x / 2 = a( 7 )b. x = a[ 7 ] / 2c. x = a[ 6 ] / 2d. x = a( 6 / 2 )

QN=44 (2788)

A procedure for solving a problem in terms of the actions to be executed and the order in which these actions are to be executed is called ________.

a. program controlb. a program structurec. a control structured. an algorithm

QN=45 (2811)

Which of the following is not required for counter-controlled repetition?

a. final valueb. initial valuec. Sentineld. Increment

QN=46 (2812)

What is wrong with the following line of code? <P><FONT SIZE='5'>This is a test.</FONT></P>

a. Nothingb. There is no attribute named SIZE for the element FONTc. The value 5 must not be placed within quotesd. The value 5 must be placed within double quotes

Page 7: aa

QN=47 (2908)

Which of the following statements regarding filters and transitions is false?

a. They are built into Internet Explorer.b. They are applied on a client computer at run time by the server.c. They enable portions of pages and entire pages to be faded in an out.d. They enable 3-d effects.

QN=48 (2790)

A program in which all statements are executed one after the other in the order in which they are written exhibit ________.

a. transfer of controlb. Algorithmsc. sequential executiond. direct execution

QN=49 (2871)

________ and ________ run slower when they are applied to large arrays.

a. linear search, binary searchb. linear search, bubble sortc. binary search, bubble sortd. linear – bubble search, binary - linear sort

QN=50 (2881)

What is the value of s3 after the following code is executed?var s1 = one, s2 = two, s3 = three;s1.concat(s2)s3 = s1;

a. Oneb. Onetwoc. Threed. Onetwothree

Page 8: aa
Page 9: aa

For Examination Department OnlyAnswer of Paper Code=IS321_XML_070610

***************************************************************[id=2726, Mark=1]1. BCD ABC[id=2928, Mark=1]2. A[id=2724, Mark=1]3. D[id=2713, Mark=1]4. B[id=2934, Mark=1]5. B[id=2926, Mark=1]6. B[id=2930, Mark=1]7. A[id=2929, Mark=1]8. B[id=2931, Mark=1]9. B[id=2725, Mark=1]10. C[id=2731, Mark=1]11. C[id=2728, Mark=1]12. B[id=2718, Mark=1]13. B[id=2938, Mark=1]14. B[id=2717, Mark=1]15. A[id=2945, Mark=1]16. A[id=2948, Mark=1]17. A[id=2918, Mark=1]18. A[id=2920, Mark=1]19. A[id=2944, Mark=1]20. B[id=2771, Mark=1]21. C[id=2760, Mark=1]22. C[id=2763, Mark=1]23. A[id=2738, Mark=1]24. B[id=2901, Mark=1]25. B[id=2889, Mark=1]26. B[id=2773, Mark=1]27. A[id=2897, Mark=1]28. A[id=2893, Mark=1]29. B[id=2737, Mark=1]30. A[id=2747, Mark=1]31. B[id=2951, Mark=1]32. B[id=2754, Mark=1]33. B[id=2739, Mark=1]34. B[id=2740, Mark=1]35. C[id=2753, Mark=1]36. B[id=2746, Mark=1]37. B[id=2923, Mark=1]38. A[id=2751, Mark=1]39. B[id=2756, Mark=1]40. B[id=2819, Mark=1]41. B[id=2880, Mark=1]42. B

Page 10: aa

[id=2857, Mark=1]43. C[id=2788, Mark=1]44. D[id=2811, Mark=1]45. C[id=2812, Mark=1]46. A[id=2908, Mark=1]47. B[id=2790, Mark=1]48. C[id=2871, Mark=1]49. B[id=2881, Mark=1]50. B***************************************************************Chapter 8 JavaScript/JScript: Introduction to Scripting8.1 Microsoft's version of scripting that uses the Java syntax is called ________.a) JavaScriptb) JScriptc) ECMAScriptd) J++ 8.2 ________ was originally created by ________.a) JScript, Netscapeb) JScript, ECMAc) JavaScript, Microsoftd) JavaScript, Netscape 8.3 The default scripting language for Netscape and Internet Explorer is ________.a) JavaScriptb) Perlc) ECMAScriptd) Python  8.4 In the following line, the word document is a ________ which resides in the computer’s memory andcontains information used by the script.document.writeln("Hello World");a) attributeb) behaviorc) objectd) method 8.5 In the following line, the word writeln is a ________ which performs a task or action in the script.document.writeln("Hello World");a) structureb) collectionc) objectd) method 

Page 11: aa

8.6 Consider the following HTML code.<HTML><SCRIPT LANGUAGE = "JavaScript"><!--document.writeln("Hello World");// --></SCRIPT></HTML>What would a browser capable of scripting display when executing this code?a) document.writeln("Hello World");b) nothingc) Hello Worldd)<HTML><SCRIPT LANGUAGE = "JavaScript"><!--document.writeln("Hello World");// --></SCRIPT></HTML>Ans: c)8.7 The line window.alert("Hello world") will display output in ________.a) a dialog boxb) the HTML documentc) the Debug windowd) the status bar 8.8 The \n,\t, \r escape sequences do not affect HTML rendering unless they are used between whichtags?a) <SELECT></SELECT>b) <SCRIPT></SCRIPT>c) <PRE></PRE>d) <A></A> 8.9 Consider the following script. What is wrong with the following code?1 <SCRIPT LANGUAGE = "JavaScript">2 var firstNumber,3 secondNumber;4 thirdNumber;56 thirdNumber =7 parseInt( window.prompt( "Enter an integer", 0 ) );8 document.write( thirdNumber );9 </SCRIPT>a) thirdNumber in line 8 must be in quotes.

Page 12: aa

b) The words Enter an integer in line 7 should not be in quotes.c) The word var must be placed before secondNumber in line 3.d) The word var must be placed before thirdNumber in line 4. 8.10 What would the browser display if the following script was executed and the user entered 5 at bothprompts?1 <SCRIPT LANGUAGE = "JavaScript">2 var firstNumber = window.prompt("Enter an integer", 0);3 var secondNumber = window.prompt("Enter an integer",0);4 var thirdNumber;5 thirdNumber = firstNumber + secondNumber;6 document.write( thirdNumber );7 </SCRIPT>a) nothingb) 0c) 10d) 55 8.11 What is the result of the statement 17 % 5?a) 0b) 2c) 3d) 12 8.12 Which of the following selections does not follow the rules of operator precedence. Assume that theoperators on the left are evaluated first.a) multiplication, division, additionb) parentheses, subtraction, modulusc) division, multiplication, additiond) parentheses, modulus, subtraction.8.13 What is the evaluation of the following expression?((3+ ( 5 + 4 ) * 7 ) + 4 ) / 5a) 8b) 14c) 17.6d) 26.4 8.14 Which of the following is not a valid equality or relational operator?a) =b) <c) >d) != 

Page 13: aa

Chapter 9: JavaScript/JScript: Control Structures I 9.1 A procedure for solving a problem in terms of the actions to be executed and the order in which theseactions are to be executed is called ________.a) program controlb) a program structurec) a control structured) an algorithm 9.2 ________ is an artificial and informal language that helps programmers develop algorithms.a) JavaScriptb) ECMAScriptc) Pseudocoded) AlgorithmCode 9.3 A program in which all statements are executed one after the other in the order in which they arewritten exhibit ________.a) transfer of controlb) algorithmsc) sequential executiond) direct execution 9.4 Which of the following contradicts the notion of structured programming?a) ifb) for/inc) gotod) while 9.5 The word sequence in the term sequence structure refers to the sequence of ________.a) bits in a JavaScript instructionb) JavaScript instructions in a scriptc) scripts in a HTML filed) HTML files in a Web site 9.6 Which of the following is not one of Bohm and Jacopini's three control structures?a) goto-less structureb) sequence structurec) selection structured) repetition structure 9.7 Which of the following flowchart symbols indicates that a decision is to be made?a) diamond

Page 14: aa

b) oval/circlec) rectangled) flowline 9.8 Which of the following is not a JavaScript selection structure?a) if/elseb) for/inc) switchd) if 9.9 Which of the following is a JavaScript repetition structure?a) while/repeatb) do/whilec) do/repeatd) for/do 9.10 Which of the following is not a JavaScript keyword?a) breakb) deletec) subd) function 9.11 Which of the following statements is correct?a) If ( studentGrade >= 60 )document.writeln( "Passed" );b) if ( studentGrade >= 60 );document.writeln( "Passed" );c) if ( studentGrade >= 60 )document.write( "Passed" );d) If ( studentGrade >= 60 );document.write( "Passed" ); 9.12 What would the browser display if the following code is executed in a script?var x = 11,y = 14;if ( x > 13 )if ( y > 13 )document.writeln( "x and y are > 13" );elsedocument.writeln( "x is <= 13" );a) nothing, the code will generate an errorb) 11c) x and y are > 13d) x is <= 13Ans: d)9.13 What would the browser display if the following code is executed in a script?

Page 15: aa

var grade = 59if ( grade >= 60 )document.writeln( "Passed." );elsedocument.write( "Failed. " );document.writeln( "You must take this course again." );a) Passed.b) Failed.c) You must take this course again.d) Failed. You must take this course again. 9.14 What would the browser display if the following code was executed in a script?var product = 0;while ( product <= 25 );product = 2 + product;a) nothing, the script would result in an errorb) 0c) 25d) 26 9.15 What would the browser display if the following script is executed?<SCRIPT LANGUAGE = "JavaScript">var count = 0,total = 0;while ( count <= 5 ) {total = total + 10;count = count + 1;}document.write(total);</SCRIPT>a) Nothing, the browser would generate an error.b) 0c) 50d) 60 9.16 What would the browser display if the following script is executed?<SCRIPT LANGUAGE = "JavaScript">var count = 5,total = 0;while ( count > -1 ) {total = total – 10;count = count – 1;}document.write(total);</SCRIPT>a) Nothing, the browser would generate an error.

Page 16: aa

b) 0c) -50d) -60 9.17 If the string passed to parseInt contains a floating-point numeric value, parseInt will________.a) return NaNb) return 0c) round the value to the nearest tenthd) truncate the floating-point part 9.18 If the string passed to parseInt contains text characters, parseInt will ________.a) return NaNb) return 0c) return the sum of the characters' ASCII valuesd) truncate the text entries 9.19 What type of loop is shown in the script below?<SCRIPT LANGUAGE = "JavaScript">var gradeValue = 0,total = 0,grade = 0;while ( gradeValue != - 1 ) {total = total + gradeValue;grade = window.prompt("Enter Integer Grade, -1 to Quit:", "0");gradeValue = parseInt( grade );}</SCRIPT>a) count controlledb) sentinel controlledc) algorithm controlledd) stepwise controlled 9.20 The word top in the term top-down stepwise refinement refers to which of the following?a) the first statement that appears in the programb) the first statement that appears in the algorithmc) the single statement that completely represents the programd) the entire algorithm 9.21 What is the value of i after the following statements?i = 2;i += 25;

Page 17: aa

a) 25b) 27c) 50d) 52 9.22 What is the value of i after the following statements?i = 2;i++;a) 0b) 2c) 3d) 4 9.23 What is the value of i after the following statements?i = 2;i--;i--;a) 0b) 1c) -2d) -4 Chapter 10: JavaScript/JScript: Control Structures II 10.1 Which of the following is not required for counter-controlled repetition?a) final valueb) initial valuec) sentineld) increment 10.2 What is wrong with the following line of code?<P><FONT SIZE='5'>This is a test.</FONT></P>a) Nothingb) There is no attribute named SIZE for the element FONTc) The value 5 must not be placed within quotesd) The value 5 must be placed within double quotes 10.3 What would the browser display if the following script was executed?<SCRIPT LANGUAGE = "JavaScript">for( int i = 0; i < 5; i++ )document.write("X");</SCRIPT>a) Nothing, the script would generate an errorb) XXXXc) XXXXXd) XXXXXX

Page 18: aa

 10.4 What would the browser display if the following script was executed?<SCRIPT LANGUAGE = "JavaScript">for( var i = 0; i < 5; i++ )document.write("O");</SCRIPT>a) Nothing, the script would generate an errorb) OOOOc) OOOOOd) OOOOOO 10.5 Which of the following are declared correctly?a) for (var i=0;i<100;++i ) [statement;]b) for (var i=0;i<100;++I ) [statement;}c) for (var i=0;i<100;++i ) {statement;}d) for (var i=0;i<100;++i; ) {statement;} 10.6 Which of the following is declared correctly and will not result in an error assuming x = 2 and y =30?a) for ( var j = 10; j <= 80; j-- )b) for ( var j = x, j <= y, j += 5 )c) for ( var j = x; j <= 80 * y; j += 5 / x )d) for ( var j = x; j <= 80 * y; j -= 5 ) -10.7 Which of the following is true?a) for and while structures both increment their counters before the body statement is performed.b) for and while structures both increment their counters after the body statement is performed.c) for loops increment before the body statement is performed and while loops increment after the bodystatement is performedd) for loops increment after the body statement is performed and while loops increment in eithercondition or body 

Page 19: aa

10.8 What is the value of num after the following statement is performed?num = 2 * Math.pow( 2, 3 );a) 16b) 18c) 64d) 8 10.9 What is the value of num after the following statement is performed?num = Math.round( 2.45 );a) 0b) 2c) 2.5d) 3 10.10 The ________ multiple selection structure is used to handle multiple decision making and can beused to replace multiple if and if/else statements.a) do/whileb) casec) breakd) switch 10.11 Every switch structure must have ________ labels which are separated by the keyword break.a) defaultb) if/elsec) cased) choice 10.12 In a switch structure, the ________ case clause is used to process exceptional conditions and isusually listed last.a) breakb) defaultc) elsed) then 10.13 Consider the following code selections. Assume count is initialized to 7 and num is initialized to 0.i) ii)do { while ( count < 6 )num = count; num = count;} while ( count < 6 )What will the value of num be for i) and ii) respectively after the loops have been executed?a) 0, 0

Page 20: aa

b) 0, 7c) 7, 0d) 7, 7 10.14 What would the browser display if it executed the following script?<SCRIPT LANGUAGE = "JavaScript">for ( var count = 1; count <= 10; ++count ) {if ( count == 5 )break;}document.writeln( count );</SCRIPT>a) Nothing, the script would generate an error.b) 1c) 5d) 10 10.15 What would the browser display if it executed the following script?<SCRIPT LANGUAGE = "JavaScript">for ( var count = 0; count < 10; ++count ) {if ( count == 5 )continue;}document.writeln( count );</SCRIPT>a) Nothing, the script would generate an error.b) 1c) 5d) 10 10.16 What would the browser display if it executed the following script?<SCRIPT LANGUAGE = "JavaScript">var total = 0;stop: { // labeled compound statementfor ( var i = 0; i < 5; ++i ) {for ( var j = 0; j < 2 ; ++j ) {if ( i == 2 )break stop;total++;}total++;}total++;}total++;document.writeln( total );

Page 21: aa

</SCRIPT>a) 7b) 8c) 9d) 10 10.17 What would the browser display if it executed the following script?<SCRIPT LANGUAGE = "JavaScript">var total = 0;nextLoop:for ( var i = 0; i < 5; ++i ) {for ( var j = 0; j < 2 ; ++j ) {if ( i < 2 )continue nextLoop;total++;}total++;}total++;document.writeln( total );</SCRIPT>a) 7b) 8c) 9d) 10 10.18 Which of the following will not evaluate to true?a) false || falseb) true || truec) false || trued) true || falseAns: a)conditions are false. Figure 10.16 is a truth table for the logical OR operator (||).10.19 Which of the following will evaluate to false?a) false && falseb) true && truec) false && trued) true && false 10.20 Which of the following is false?a) In any flowchart, any rectangle (action) can be replaced by 2 rectangle (actions) in sequence.b) In any flowchart, any rectangle (action) can be replaced by any control structure (sequence, if,if/else, switch, while, do/while or for).

Page 22: aa

c) In any flowchart, control structure (sequence, if, if/else, switch, while, do/while or for) canbe replaced by 2 rectangle (actions) in sequence.d) Connecting control structures in sequence is called control structure stacking 10.21 According to Bohm and Jacopini, which of the following does not follow structured programming?a) Stacked building blocksb) Nested building blocksc) Overlapping building blocksd) Invisible building blocks Chapter 11: JavaScript/JScript: Functions 11.1 The best way to develop and maintain a large program is to construct it from small, simple piecescalled ________.a) scriptsb) modulesc) scriptletsd) objects 11.2 The technique of developing and maintaining a large program by constructing it from small, simplepieces is called ________.a) divide and conquerb) modular programmingc) multitaskingd) multiprogramming 11.3 Modules in JavaScript are called ________.a) subroutinesb) routinesc) methodsd) functions 11.4 The “prepackaged” functions that belong to JavaScript objects such as Math.pow and Math.roundare often called ________.a) subroutinesb) routinesc) methodsd) functions 11.3 Programmer-Defined Functions11.5 All variables declared in function definitions are ________.

Page 23: aa

a) global variablesb) local variablesc) static variablesd) constant variables 11.6 Functions are invoked by writing the name of the function, followed by the function's ________ inclosed parenthesis.a) nameb) static variablesc) argumentsd) constant variables 11.7 Function definitions often contain ________ which are considered to be local variables andcorrespond with the arguments in the function call.a) parametersb) static variablesc) register variablessd) constant variables 11.8 Which of the following is a legal function call for the function definition provided below?function square( y ){return y * y;}a) square(7+2);b) square("7");c) square(7,2);d) square 7; 11.9 What is the result of writing the keyword var in a function parameter list?a) The result would be a JavaScript runtime error.b) The parameter following the keyword would have global scope.c) The parameter following the keyword would have local scope.d) The parameter following the keyword would become a static variable.11.10 What would the function cube return, assuming it is called with the line cube(3).function cube( y );{return y * y * y;}a) JavaScript runtime errorb) 3c) 9

Page 24: aa

d) 27 11.11 What does the following statement do?Math.floor( Math.random() * 12 );a) This creates a random number from 0 up to and including 12.b) This creates a random number from 0 up to but not including 12.c) This creates a random number from 1 up to and including 12.d) This creates a random number from 1 up to but not including 12. 11.12 The value a in the following statement is called the ________ and the value b is called the________.face = Math.floor( a + Math.random() * b );a) scaling factor, shifting valueb) shifting value, scaling factorc) scaling value, shifting factord) shifting factor, scaling value 11.6 Example: A Game of Chance11.13 Where on the browser will the command window.status( "text" ) display output?a) in the bodyb) in an alert dialog boxc) in a status dialog boxd) on the status bar 11.14 The style of programming in which the user interacts with a GUI component is called ________programming.a) object-orientedb) automaticc) event-drivend) modular 11.15 If the HTML form game has a text field named point in it, what is the proper way to set the textassociated with point to 10?a) game.point = "10"b) game.point.text = "10"c) game.point.caption = "10"d) game.point.value = "10" 11.16 The member access operator is which of the followinga) *b) %c) .

Page 25: aa

d) / 11.17 The ________ of a variable is the period during which it exists in memory.a) scopeb) recursionc) durationd) length 11.18 Identifiers that represent local variables in a function ________.a) are globally accessible to the scriptb) exist while the function in which they are declared is still activec) exist while the function in which they are declared is no longer actived) are not automatically destroyed when the function in which they are declared is exited. 11.19 Local variables have ________ duration.a) localb) globalc) automaticd) static 11.20 Identifiers which have static duration ________.a) are globally accessible to the scriptb) exist while the function in which they are declared is still activec) exist while the function in which they are declared is no longer actived) are not automatically destroyed when the function in which they are declared is exited. 11.21 Script-level variables have ________ duration.a) localb) globalc) automaticd) static 11.22 The _______ of an identifier for a variable or function is the portion of the program in which theidentifier can be referenced.a) scopeb) recursionc) durationd) length 11.23 Giving a local function variable the same name as a global variable will result in which of thefollowing?a) JavaScript runtime error.b) Data corruption.c) The local function variable will rename itself.

Page 26: aa

d) The local variable will "hide" the global variable. 11.24 A function that calls itself either directly or indirectly through another function is called a ________function.a) base caseb) iterativec) recursived) fibonacci 11.25 Iteration uses ________ structures and recursion uses ________ structures.a) counter - recursive, counter - iterativeb) repetition, function callingc) repetition, selectiond) function calling, repetition 11.26 When does a recursive process go into an infinite recursion?a) if the loop-continuation test never becomes falseb) if the recursion test never becomes falsec) if the loop-continuation test never becomes trued) if the recursion step does not converge on the base case Chapter 12: JavaScript/JScript: Arrays12.1 _________ are data structures consisting of related data items (sometimes called collections of dataitems).a) lvaluesb) compositesc) arraysd) databases 12.2 To refer to a particular location or element in the array, we specify the name of the array and the________ of the particular element in the array.a) contentsb) sizec) position numberd) type 12.3 Which of the following is the proper method to access the length of the array arr[]?a) arr[].lengthb) arr[subscript].lengthc) arr.lengthd) arr(length) 

Page 27: aa

12.4 To divide the value of the seventh element of array a by 2 and assign the result to the variable x, wewould write ________.a) x / 2 = a( 7 )b) x = a[ 7 ] / 2c) x = a[ 6 ] / 2d) x = a( 6 / 2 ) 12.5 Which of the following is the proper method to dynamically allocate memory to an array of 100elements?a) var c = new c[ 100 ];b) var c = new c( 100 );c) var c = new Array[ 100 ];d) var c = new Array( 100 ); 12.5 Which of the following is the proper method to dynamically allocate memory to an array of 100elements?a) var c = new c[ 100 ];b) var c = new c( 100 );c) var c = new Array[ 100 ];d) var c = new Array( 100 ); 12.6 The statement on line 1 ________ the array while the statement on line 2 ________ the array.1 var c;2 c = new Array( 12 );a) declares, initializesb) initializes, declaresc) declares, allocatesd) allocates, declares 12.7 Initializing an array directly involves using the ________ control structure.a) for loopb) newc) functiond) dynamic memory allocation operator 12.8 What would the browser display if this script was executed?<SCRIPT LANGUAGE = "JavaScript">var c = new Array(8)for( var i = 0; i < 8; i++ )c[i] = i;document.write(c[8])</SCRIPT>

Page 28: aa

a) undefinedb) 0c) 7d) 8 12.9 What would the browser display if this script was executed?<SCRIPT LANGUAGE = "JavaScript">var c = new Array(8)for( var i = 0; i < 10; i++ )c[i] = i;document.write(c[9])</SCRIPT>a) undefinedb) 0c) 8d) 9 12.10 Which of the following is an illegal array initialization statement?a) var n = [ 10, 20, 30, 40, 50 ];b) var n = new Array( 10, 20, 30, 40, 50 );c) var n = new Array( 5 );n = [ 10, 20, 30, 40, 50 ];d) var n = new Array( 5 );for ( var i = 1; i <= 5; i++ )n[ i ] = i * 10 ; 12.11 In the following statement, the range of the variable element is ________.for ( var element in theArray )total2 += theArray[ element ];a) 0 to the array lengthb) 1 to the array lengthc) 0 to the array length - 1d) 1 to the array length - 1 12.12 What is the value of num assuming that all 12 elements of array test are initialized to 3?++test[ 7 ];var num = test[ 7 ];a) 3b) 4c) 8d) 10 12.13 In JavaScript, all objects and Arrays are passed to functions by ________.a) valueb) parameters

Page 29: aa

c) memoryd) reference 12.14 Call-by- ________ is the method of passing a copy of the argument's value to a function.a) valueb) parametersc) memoryd) reference 12.15 Call-by- ________ is the method of passing the argument's actual location in memory to a function.a) valueb) parametersc) memoryd) reference 12.16 In JavaScript, numbers and boolean values are passed to functions by ________.a) valueb) parametersc) memoryd) reference 12.6 Passing Arrays to Functions12.17 What is the effect of the join statement in the following code?var theArray1 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],theArray2 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];var value = theArray1.join( " " );a) The join method will concatenate the values of theArray2 to theArray1.b) The join method will concatenate the values of theArray1 to theArray2.c) The join method will create a string from the values in theArray1.d) The join method will create a string with the values of theArray2 concatenated to the values oftheArray1. 12.18 What will the browser display if the following script is executed?< SCRIPT LANGUAGE = "JavaScript" >var theArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ];modifyArray( theArray[ 3 ] );document.write( theArray.join( " " ) );function modifyArray( i ) {i = 11;}</SCRIPT>a) Nothing, the browser will generate an error.b) 1 2 3 4 5 6 7 8 9

Page 30: aa

c) 1 2 11 4 5 6 7 8 9d) 1 2 3 11 5 6 7 8 9 12.9 Multiple-Subscripted Arrays12.21 What would the browser output if the following script is executed?< SCRIPT LANGUAGE = "JavaScript" >var array = [ [ 1, 2, 3 ], [ 1, 2, 3 ] ];for ( var i in array ) {for ( var j in array[ i ] )document.write( array[ i ][ j ] + " " );document.writeln("<BR>");}< /SCRIPT >a) Nothing, the script would generate an errorb) 1 2 3c) 1 2 3 4 5 6d) 1 2 3 1 2 3Ans: d)< SCRIPT LANGUAGE = "JavaScript" >var array = [ [ 1, 2, 3 ], [ 1, 2, 3 ] ];for ( var i in array ) {for ( var j in array[ i ] )document.write( array[ i ][ j ] + " " );document.writeln("<BR>");}< /SCRIPT >a) Nothing, the script would generate an errorb) 1 2 3c) 1 2 3 4 5 6d) 1 2 3 1 2 3 Chapter 13: JavaScript/JScript Objects13.2 Thinking About Objects13.1 Each object has ________ or data and ________ or behavior.a) properties, attributesb) attributes, propertiesc) attributes, methodsd) methods, attributesAns: c)13.2 Which of the following is false?a) Programs communicate with objects by using well-defined interfaces.b) Objects do not have the property of information hiding.c) Browsers have a set of objects that encapsulate the HTML document.d) Characters are the building blocks of JavaScript programs.Ans: b)

Page 31: aa

13.3 An object's methods and attributes are accessed by writing the name of the object followed by the________.a) method name/attribute nameb) method/attribute indexc) dot operatord) property operatorAns: c)13.4 String Object13.4 What does the value string contain after the following code is executed?var string = "Good luck on the test";string = string.charAt( 3 );a) Goob) 3c) dd) Nothing, the string conversion generates an error.Ans: c)13.5 What does the value string contain after the following code is executed?var string = "Good luck on the test";string = string.split( " " );a) Good luck on the testb) Good.luck.on.the.testc) Good,luck,on,the,testd) Nothing, the string conversion will generate an error.Ans: a)13.6 What does the value string contain after the following code is executed?var string = "Good luck on the test";string = string.link("www.deitel.com")a) a link to www.deitel.com with the text "www.deitel.com"b) a link to www.deitel.com with the text "Good luck on the test"c) the text "www.deitel.com"d) Nothing, the string conversion will generate an error.Ans: b)13.7 What is the value of s3 after the following code is executed?var s1 = one,s2 = two,s3 = three;s1.concat(s2)s3 = s1;a) oneb) onetwoc) threed) onetwothreeAns: b)13.8 What is the value of s1 after the following code is executed?var s1 = "deitel and associates"

Page 32: aa

s1 = s1.slice( 6 )a) deitelb) deitel and assoc) and associatesd) deitel and associatesAns: c)13.9 Which of the following methods would you use to search a character for a specific string?a) substringb) charAtc) substrd) indexOfAns: d)13.10 Which of the following methods would you use to convert a list of Unicode values into a stringcontaining the corresponding characters?a) charAtb) charCodeAtc) fromCharCoded) UCodeToChar13.5 Date Object13.11 What will value contain after the following code is executed?var value = new Date();value = value.valueOf();a) the current date in the format hh:mm:ss calculated from the number of milliseconds between midnightJanuary 1, 1970 and the current dateb) a large integer representing the number of milliseconds between midnight January 1, 1970 and thecurrent datec) the current date in the format hh:mm calculated from the number of milliseconds between midnightJanuary 1, 1970 and the current dated) a large floating point number representing the number of milliseconds between midnight January 1, 1970and the current dateAns: b)13.6 Boolean and Number Objects13.12 Which of the following methods does the JavaScript Boolean object not possess?a) toStringb) valueOfc) toIntd) The JavaScript Boolean object does not possess publicly accessible methods.Ans: c)

Page 33: aa

13.13 Which of the following methods does the JavaScript Number object not possess?a) toStringb) toFloatc) valueOfd) MAX_VALUEAns: c)13.6 Boolean and Number Objects13.12 Which of the following methods does the JavaScript Boolean object not possess?a) toStringb) valueOfc) toIntd) The JavaScript Boolean object does not possess publicly accessible methods.Ans: c)13.13 Which of the following methods does the JavaScript Number object not possess?a) toStringb) toFloatc) valueOfd) MAX_VALUEAns: c)