JavaScript Homework Help

I need help with this homework

Page 1 of 1

3 Replies - 1185 Views - Last Post: 02 July 2009 - 08:45 AM

#1 Zerobu  Icon User is offline

  • Black Hatter

Reputation: 13
  • View blog
  • Posts: 1,822
  • Joined: 14-January 08

JavaScript Homework Help

Posted 15 February 2009 - 03:04 PM

I need help with these multiple choice questions.

1. if statements
(Points: 1)
Javascript if and if-else statements are syntactically similar to C++.

TrueFalse
Save Answer

2. Infinite loop
(Points: 1)
Both IE and Firefox will show a dialog box allowing the user to terminate a script that it detects has an infinite loop.

TrueFalse
Save Answer


3. parseInt
(Points: 1)
What is the value of x after the following statement executes?

x = parseInt("2.6") + parseInt("4")

1. 6
2. 7
3. 2.64
4. NaN
Save Answer



4. Assignment
(Points: 1)
Which of the following statements is not legal (syntactically correct) Javascript syntax?

1. x *= 4;
2. --y;
3. z = x < 10 ? "yes" : "no";
4. a = a % 2;
5. They are all legal statements.
Save Answer


5. for loop
(Points: 1)
What would the following Javascript display in the browser window?

for (i=0; i<5; i++)
document.writeln(i)



1. 0 1 2 3 4
2. 1 2 3 4 5
3. 01234
4. The code contains a syntax error.
Save Answer



6. while loop
(Points: 1)
What would the following Javascript produce in the browser window?

c = 1;
while (c != 5)
{
if (c % 2 == 0)
document.writeln("<b>");

document.writeln©;
if (c % 2 == 0)
document.writeln("</b>");
c++;
}



1. 1 2 3 4
2. 1 2 3 4
3. 1234
4. The code contains an infinite loop.
Save Answer



7. toFixed and Math.pow
(Points: 1)
What is the output from the following Javascript?

a = 12.345;
document.writeln(a.toFixed(2) + " " + Math.pow(2, 3));



1. 12.345 2 3
2. 12.345 1
3. 12.35 8
4. NaN
Save Answer



8. switch and do-while
(Points: 1)
The Javascript switch and do-while statements work very similar to the way they work in C++.

TrueFalse
Save Answer




9. Logical operators
(Points: 1)
The following Javascript evaluates to true: if (3 < 2 || 5 != 6)

TrueFalse
Save Answer



10. true and false
(Points: 1)
The words true and false are reserved words in Javascript.

TrueFalse
Save Answer

Is This A Good Question/Topic? 0
  • +

Replies To: JavaScript Homework Help

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4354
  • View blog
  • Posts: 12,160
  • Joined: 18-April 07

Re: JavaScript Homework Help

Posted 15 February 2009 - 05:30 PM

Do you seriously expect us to help you cheat? Not to mention these are questions that are super simple and you can figure out in two seconds of thought. Please don't be lame and waste our time.

Sorry.
Was This Post Helpful? 0
  • +
  • -

#3 laces12  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 20-November 08

Re: JavaScript Homework Help

Posted 27 February 2009 - 12:24 PM

From the rules:

Post the code you have so far using the [code] tags. We can't help you if you don't post your code. We will not do your homework for you. You MUST show some effort.

This post has been edited by laces12: 27 February 2009 - 12:24 PM

Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: JavaScript Homework Help

Posted 02 July 2009 - 08:45 AM

Please read the Forum Rules before making another post. We will not do your homework for you.

** Topic Closed **
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1