Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

17. What is the sum of roll1 and roll2 after the following code is executed? var roll1=0; var roll2=0; while ( roll1+roll2!=6 ) { roll1=Math.floor(Math.random(

17.

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

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 is executed?

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 code segment?

var num = 10;

while ( num > 0 ) {

num = num -1;

}

20.

What is the value of variable num after the following code segment is executed?

var num = 1;

while ( num >10 ) {

num = num -1;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions