Question: 5. Assume courseTitle =Principles in Information Technology and Computation; What does the following JavaScript statement do? var something = courseTitle.search('o'); It finds all o's and

5.

Assume courseTitle ="Principles in Information Technology and Computation";

What does the following JavaScript statement do?

var something = courseTitle.search('o');

It finds all o's and save them to variable something.

It saves the position of the first occurrence of "o" to variable something.

It saves the position of the last occurrence of "o" to variable something.

It will save a true or false to something depends on whether there is an 'o' in courseTitle.

6.

Assume phrase= "Peter Piper picked a peck of pickled peppers", What will be returned if phrase.search(/[aeiou]/) is called?

1

7

9

13

7.

Assume courseTitle ="Principles in Information Technology and Computation";

Which of the following can return "Information" ?

courseTitle.substring(14, 24)

courseTitle.substring(14, 25)

courseTitle.substring(13, 25)

courseTitle.substring(13, 24)

8.

UESTION 8

What does the following code segment do?

var isSeven =false;

while ( isSeven==false ) {

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

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

if(roll1 + roll2 ==7) { isSeven = true; alert(roll1 +"--"+roll2); }

}

It keeps generating two random numbers of any values until the sum of the two numbers is 7.

It keeps generateing two random numbers between 1 and 6, and adds up the two numbers.

It keeps generating two random numbers between 1 and 6, until the sum of the two numbers is 7.

It keeps generating two random numbers between 1 and 6, then check if the sum of the two numbers is 7.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!