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

(Solved) : 6 Consider Following Directed Graph Number Strongly Connected Components Equal B 4 C 3 D Q28127965 . . . .(Solved) : 6 Consider Following Directed Graph Number Strongly Connected Components Equal B 4 C 3 D Q28127965 . . . .

<p><img alt="6. Consider the following directed graph The number of strongly connected components is equal to a. b. 4 c. 3 d. 2 e." src="https://s9.postimg.org/wvpr2aahb/screenshot_414.png" aria-describedby="d3f"/></p><p><img alt="" src="https://s9.postimg.org/yarbr0ja7/screenshot_415.png"/></p><p><img alt="" src="https://s9.postimg.org/wvpr2apwv/screenshot_416.png"/></p>6.