Quiz 006 - Attempt Review4 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Dashboard / Courses / BLENDED 1923T.

B / BL-CS-301-LEC-1923T / Week 13: JavaScript Functions / Quiz 006

Started on Wednesday, 8 January 2020, 2:15 PM


State Finished
Completed on Wednesday, 8 January 2020, 2:22 PM
Time taken 7 mins 13 secs
Marks 9/10
Grade 90 out of 100

Question 1 What is the result of the script below? 


Correct
<script>
Mark 1 out of 1 var x = 0;
var e = "gsbatingggl.x";
var domain = "";
for(var ctr = 0; ctr < e.length; ctr++)
{
if(e[ctr] == "@")
{
domain = e.substring(ctr);
if((domain == "@yahoo.com.ph") ||
(domain == "@yahoo.com") ||
(domain == "@edu.gov"))
{
x++1;
}
}
}
document.write(x);
</script>

Select one:
a. 0 

b. None of the choices

c. 12

d. 1

Your answer is correct.

Question 2 Which of the following would be valid as the first line of an if/else statement?
Correct

Mark 1 out of 1 Select one:


a. if (y ! 7)

b. if (x==2) && (y > x)

c. None of the choices 

d. if (x=2)

Your answer is correct.


Question 3 What is the result of the script below?
Correct <script>
Mark 1 out of 1 var greeting;
var time = 10;
if (time < 10) {
greeting = "Good morning";
} else if (time < 20) {
greeting = "Good day";
} else {
greeting = "Good evening";
}
document.write(greeting);
</script>

Select one:
a. Good day 

b. Good morning

c. None of the choices

d. Good evening

Your answer is correct.

Question 4 Which of the following would be valid as the first line of an if/else statement?
Correct

Mark 1 out of 1 Select one:


a. None of the choices 

b. if (x==2) && (y > x)

c. if (y ! 7)

d. if (x=2)

Your answer is correct.

Question 5 How many times can you nest a code block within another?
Correct

Mark 1 out of 1 Select one:


a. As many times as you like (though enough nesting could run the browser out of memory) 

b. None

c. Once

d. None of the above

Question 6 Which of the following is a valid name for an array?


Correct

Mark 1 out of 1 Select one:


a. soap 

b. 2ndarray

c. my array

d. None of the choices


Question 7 Which of these would be valid as the first line of a for loop?
Correct

Mark 1 out of 1 Select one:


a. for (x=1;x<6;x+=1) 

b. for (x==1;x<6;x+=1)

c. for (x+=1;x<6;x=1)

d. None of the choices

Your answer is correct.

Question 8 What is the result of the script below?


Correct <script>
Mark 1 out of 1 var n = ["Maria", "Isabella", "Georgina"];
var new_n = n.pop();
document.write(new_n);
</script>

Select one:
a. Georgina 

b. None of the choices

c. Isabella

d. Maria

Your answer is correct.

Question 9 What does the following code do?


Correct var s_list= new Array()
Mark 1 out of 1
Select one:
a. Creates an empty array named list

b. None of the choices 

c. Creates an array that can never have any elements added to it

d. Creates an array named s_list with the default number of elements, 10

Question 10 Which of the following does not correctly create an array?


Incorrect

Mark 0 out of 1 Select one:


a. var myarray= new Array(5);

b. var if= new Array[10];

c. None of the choices 

d. var myarray= new Array(“hello”,”hi”,”greetings”);

Jump to...
◄ Lesson 11: JavaScript Functions Finals ►

You might also like