Вы находитесь на странице: 1из 3

Dashboard / Courses / BLENDED 1923T.

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

Started on Friday, 8 November 2019, 11:43 AM


State Finished
Completed on Friday, 8 November 2019, 12:06 PM
Time taken 23 mins 13 secs
Marks 9/10
Grade 90 out of 100

Question 1 In a regular array, access to an element is usually through the use of a(n) __________.
Correct

Mark 1 out of 1 Select one:


a. index number 

b. random number

c. string

d. None of the choices

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. if (x=2)

d. None of the choices 

Your answer is correct.

Question 3 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)

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

d. None of the choices 

Your answer is correct.


Question 4 Which of the following will correctly access the fifth element of an array named "age"?
Correct

Mark 1 out of 1 Select one:


a. None of the choices

b. age[4]; 

c. age(5);

d. age[5];

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


Correct

Mark 1 out of 1 Select one:


a. 2ndarray

b. None of the choices

c. soap 

d. my array

Question 6 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. None of the choices

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

Your answer is correct.

Question 7 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. Maria

d. Isabella

Your answer is correct.


Question 8 What is the result of the script below? 
Incorrect
<script>
Mark 0 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. 1

b. 12

c. 0

d. None of the choices 

Your answer is incorrect.

Question 9 What does the following code do?


Correct var s_list= new Array()
Mark 1 out of 1
Select one:
a. Creates an array that can never have any elements added to it

b. None of the choices 

c. Creates an empty array named list

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

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

Mark 1 out of 1 Select one:


a. None of the above

b. None

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

d. Once

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

Вам также может понравиться