Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Have a midterm tomorrow. Need help badly.

Name: Dead. 2008-10-20 1:58

I have to know WHY these functions give the  answers they do.  I'm at a loss when it comes to figuring out what order a program will run shit.

If anyone can give any insight, thanks.

(10%) What is printed in the "alert" box at the end of running this JavaScript code fragment?

   var i;            // loop index
   var flag = true;

   for (i=0; i<5; i++) {
      flag = !flag ;
   }

   alert(flag);

Next one:

(10%) What is printed in the "alert" box at the end of running this JavaScript code fragment?

   var x = 5;         
   var f = 5;

   if (x < 10 ) { x = x + 1; }
   else if (x == 5) { x = x - 2 ; }
   else if (x > 0) { x = x * 3; }
   else { x = -8 ; }

   if (f < 10 ) { f = f + 1; }
   if (f == 5) { f = f - 2 ; }
   if (f > 0) { f = f * 3; }
   else { f = -8 ; }

   alert("x: " + x + ", f: " + f);

Two more to come.

Name: Anonymous 2008-10-20 2:00

(15%) What is printed in the "alert" box at the end of running this JavaScript code fragment?

   var max = 6;
   var num = 0;
   var k = 0;            // loop index
   while (k < max) {
      num = num + k;
      k = k + 1;
   }
   alert(num);

Last one:

(15%) What is printed in the "alert" box at the end of running function "doesSomething()" ?

   function doesSomething () {
      var num = 16;
      var res = 5;
      res = cruncher(num);
      alert("num: " + num + ", res: " + res);
   }

   function cruncher (aParm) {
      aParm = aParm * 2;
      return aParm;
   }

ANYTHING would be helpful.  Thanks.

Name: Anonymous 2008-10-20 2:23

Got all my answers.  Fuck you faggots.

Name: Anonymous 2008-10-20 2:26

NO EXCEPTIONS

Name: Anonymous 2008-10-20 4:20

lol, high school

Name: Anonymous 2008-10-20 4:44

>>5
Saging top thread.
I lol'd

Name: Anonymous 2008-10-20 6:08

"I'm at a loss when it comes to figuring out what order a program will run shit."

it will run from left to right, then down to up, and depends what u set it to... it can read diagonal from right to left and u can also make it read backwards

:O

Name: sage 2008-10-20 6:10

sage

Name: Anonymous 2008-10-20 8:56

>>7
:O
Are you sucking a cock right now?

Name: Anonymous 2008-10-20 10:34

>>9
Nothing wrong with that.

Name: Anonymous 2008-10-20 11:52

I wish my midterms were this easy.

Name: Anonymous 2008-10-20 12:32

>>10
Ginger fag.

Name: Anonymous 2010-12-17 1:24

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2010-12-17 1:33

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Don't change these.
Name: Email:
Entire Thread Thread List