Course Solutions Uncategorized (Solved) : 17 Sum Roll1 Roll2 Following Code Executed Var Roll1 0 Var Roll2 0 Roll1 Roll2 6 Roll1 Mat Q30645697 . . . .

(Solved) : 17 Sum Roll1 Roll2 Following Code Executed Var Roll1 0 Var Roll2 0 Roll1 Roll2 6 Roll1 Mat Q30645697 . . . .

 

17.

What is the sum of roll1 and roll2 after the following code isexecuted?

var roll1=0;
var roll2=0;

while ( roll1+roll2!=6 )
{

   roll1=Math.floor(Math.random( )*6+1);

   roll2=Math.floor(Math.random( )*6+1);

}

18.

What is the value of newStr after the following code segment isexecuted?

var str =”abc”;

var letter = str.charAt(0);
var rest = str.substring(1, str.length);
var newStr = letter;

letter =rest.charAt(0);
rest = rest.substring(1, str.length);
newStr =  
rest  + letter + newStr;

19.

What is the value of variable num after the following codesegment?

var num = 10;

while ( num > 0 )
{

  num = num -1;

}

20.

What is the value of variable num after the following codesegment is executed?

var num = 1;

while ( num >10 )
{

  num = num -1;

}

Expert Answer


An answer

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post