QuestionQuestion

Question 1
What would the browser display if the following code were executed in a script?
var grade = 59;
if ( grade >= 60 )
document.writeln( "Passed." );
else
document.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.

Question 2
What would the browser display if the following code were executed in a script?
var product = 0;
while ( product <= 25 );
product = 2 + product;
a. nothing, the script would result in an error
b. 0
c. 25
d. 26

Question 3
Specifying the order in which programming statements are to be executed is called ________.
a. program control
b. a program structure
c. a control structure
d. an algorithm

Question 4
________ is an artificial and informal language that helps programmers develop algorithms.
a. JavaScript
b. ECMAScript
c. Pseudocode
d. AlgorithmCode

Question 5
The word sequence in the term sequence structure refers to the sequence of ________.
a. bits in a JavaScript instruction
b. JavaScript instructions in a script
c. scripts in an XHTML file
d. XHTML files in a Web site

Question 6
Which of the following statements is correctly written?
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" );

Question 7
Which of the following is a JavaScript repetition statement?
a. while...repeat
b. do...while
c. do...repeat
d. for...do

Question 8
If the string passed to parseInt contains a floating-point numeric value, parseInt will ________.
a. return NaN
b. return 0
c. round the value to the nearest tenth
d. truncate the floating-point part to be left with an integer value

Question 9
Which of the following flowchart symbols indicates that a decision is to be made?
a. diamond
b. oval/circle
c. rectangle
d. flowline

Question 10
Which of the following flowchart symbols can represent an if statement?
a. diamond
b. oval/circle
c. rectangle
d. flowline

Question 11
Which of the following is not one of the three control structures in Bohm and Jacopini's paper?
a. goto-less structure
b. sequence structure
c. selection structure
d. repetition structure

Question 12
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 control
b. a program structure
c. a control structure
d. an algorithm

Question 13
Which of the following is not a JavaScript keyword?
a. break
b. delete
c. sub
d. function

Question 14
Which of the following is not a JavaScript selection statement?
a. if...else
b. for...in
c. switch
d. if

Question 15
What would the browser display if the following code were executed in a script?
var x = 11;
var y = 14;
if ( x > 13 )
if ( y > 13 )
document.writeln( "x and y are > 13" );
else
document.writeln( "x is <= 13" );
a. nothing
b. 11
c. x and y are > 13
d. x is <= 13

Question 16
Which of the following contradicts the notion of structured programming?
a. if
b. for…in
c. goto
d. while

Question 17
What would the browser display if the following script were executed?
<script type = "text/javascript">
var count = 5;
var total = 0;
while ( count > -1 )
{
total = total - 10;
count = count - 1;
}
document.write( total );
</script>
a. Nothing; the browser would generate an error.
b. 0
c. -50
d. -60

Question 18
A program in which all statements are executed one after the other in the order in which they are written exhibits ________.
a. transfer of control
b. algorithms
c. sequential execution
d. direct execution

Question 19
What would the browser display if the following code were executed in a script?
var product = 0;

while (product >= 25)
product = 2 + product;
document.writeln( product );
a. nothing, the script would result in an error
b. 0
c. 24
d. 26

Question 20
What would the browser display if the following script were executed?
<script type = "text/javascript">
var count = 0;
var total = 0;
while ( count <= 5 )
{
total = total + 10;
count = count + 1;
}
document.write( total );
</script>
a. Nothing; the browser would generate an error.
b. 0
c. 50
d. 60

........................................

Question 1
What is the value of num after the following statement is performed?
num = 2 * Math.pow( 2, 3 );
a. 16
b. 18
c. 64
d. 8

Question 2
What would the browser display if it executed the following script?
<script type = "text/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. 5
c. 9
d. 10

Question 3
What would the browser display if the following script were executed?
<script type = "text/javascript">
<!--
for ( var i = 0; i < 5; i++ )
document.write( "O" );
//-->
</script>
a. Nothing; the script would generate an error
b. OOOO
c. OOOOO
d. OOOOOO

Question 4
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 )

Question 5
What would the browser display if it executed the following script?
<script type = "text/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. 1
c. 5
d. 10

Question 6
Which of the following is declared correctly (assume statement; is a valid statement)?
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;
}

Question 7
What would the browser display if it executed the following script?
<script type = "text/javascript">
<!--
var total = 0;
stop: { // labeled compound statement
for ( 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 );
//-->
</script>
a. 7
b. 8
c. 9
d.10

Question 8
What would the browser display if the following script were executed?
<script type = "text/javascript">
<!--
var i = 0;
do
{
document.write( "O" );
i++;
} while ( i > 5 );
//-->
</script>
a. Nothing; the script would generate an error
b. O
c. OOOOO
d. OOOOOO

Question 9
What would the browser display if it executed the following script?
<script type = "text/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. 7
b. 8
c. 9
d. 10

Question 10
What would the browser display if the following script were executed?
<script type = "text/javascript">
<!--
for ( var i = 0; var i < 5; var i++ )
document.write( "X" );
//-->
</script>
a. Nothing; the script would generate an error
b. XXXX
c. XXXXX
d. XXXXXX

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

Question 1: The answer is option D.
Question 2: The answer is option A.
Question 3: The answer is option A.
Question 4: The answer is option C.
Question 5: The answer is option B....
$20.70 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Web Development (HTML, XML, PHP, JavaScript, Adobe, Flash, etc.) Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats