Question

1. Which of the following code snippets will load an array named fives(), consisting of 10...

1. Which of the following code snippets will load an array named fives(), consisting of 10 elements with the starting value of the first element = 0 and will load each subsequent element counting by 5's, ending with the last element = 45. In other words, the elements in the fives() array should be (0, 5, 10, 15, ... 45).  

A. var fives = new Array();
for(j = 1; j < 11; j++)
     fives[j] = j + 5;

B. var fives = new Array();
for(j = 1; j < 11; j++)
     fives[j] = j * 5;

C. var fives = new Array();
fives[0] = 0;
for(j = 1; j < 10; j++)
     fives[j] = fives[j - 1] + 5;


D. var fives = new Array();
for(j = 0; j < 11; j++)
     fives[j] = fives[j ] + 1

2. Which statement will delete the first two items in the food() array given below?

var food = new Array("burger", "chips", "soup", "pizza", "lasagna");

A. food.splice(1-2);

3. Buttons that can automatically be created using the type attribute are __________.

A. submit

B. reset

C. submit and reset

D. All buttons require the type attribute.

B. food.splice(2);

C. food.splice(2, 0);

D. food.splice(0, 2);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. c is correct.

2. d is correct (food.splice(0,2) )

3. c submit and reset.

DON'T FORGET TO HIT LIKE.

THANKS BY HEART.

Add a comment
Know the answer?
Add Answer to:
1. Which of the following code snippets will load an array named fives(), consisting of 10...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. True or False: The selection sort cannot be used to sort strings. A. True B....

    1. True or False: The selection sort cannot be used to sort strings. A. True B. False 2. The __________ search is most efficient for large amounts of data. A. binary B. serial C. selection D. bubble 3. What will be displayed after the following code is executed? var chips = new Array("plain", "onion", "tuna", "barbecue", "cheddar"); document.write("There are " + chips.length + 1 + " types of chips."); document.write("My favorite is " + chips[2] + "."); A. There are...

  • 1. Assuming each line of information is stored in a new array, which of the following...

    1. Assuming each line of information is stored in a new array, which of the following pairs are not parallel arrays? A. names of all students at Santa Fe College ID numbers of all students at Santa Fe College B. names of all students at Santa Fe College names of all students taking JavaScript at Santa Fe College C. names of all students at Santa Fe College email addresses of all students at Santa Fe College D. All three sets...

  • 1. Given the following array, what is the value of pets[3]? var pets = new Array("giraffe",...

    1. Given the following array, what is the value of pets[3]? var pets = new Array("giraffe", "pig", "beetle", "hamster", "spider", "goldfish", "cow"); A. pig B. beetle C. hamster D. spider 2. Given the following array, which statement will create a variable named product that multiplies 4 * 5, using array elements? var nums = new Array(2, 3, 4, 5, 6, 30, 40, 50, 60); A. var product = nums[1] * nums[2]; B. var product = nums[2] * nums[3]; C. var...

  • Use the following code, which initializes an array x with 1000 random integers, to answer the...

    Use the following code, which initializes an array x with 1000 random integers, to answer the questions a and b. java.util.Random generator = new java.util.Random( );//accessing Random class final int MAX = 1000; int[] x = new int[MAX]; for( int j = 0; j < MAX; j++ ) { x[j] = generator.nextInt( MAX ) + 1; } a. Write partial code to print all array elements of x in reverse order (one array element per line) b. Write partial code...

  • Code in C - CountingSort exact as the algorithm which takes in an array of 1000...

    Code in C - CountingSort exact as the algorithm which takes in an array of 1000 random integers. Provide comments in code for understanding purpose COUNTING-SORT(A, B, k) 1 let C[0..k] be a new array 2 for i = 0 to k C[i] = 0 4 for j = 1 to A.length 5 C[Ajl] = C[A;l] + 1 6 / C[i] now contains the number of elements equal to i. 7 for i = 1 tok C[i] = C[i] +...

  • Question: How can this code be rewritten without using array? Code in action here: After Inserting...

    Question: How can this code be rewritten without using array? Code in action here: After Inserting number: Full code is here: How would I rewrite this without using built in array or an array? C nked list ← ⓘ솔JSFiddle Ltd (GB) https:/JSfiddle.net/7m80w1c5/2/ .Most Visited @ Getting StartedのHP-See what's Hot Suggested Sites . Comments for The Ch web Slice Gallery C New Tab 60 D> Run 9 Update Fork Tidy Collaborate Embed v/ Settings <form> iddle Meta HTML Insert Number Here:<br>...

  • 1. Write a C function named find that receives a one-dimensional array of type integer named...

    1. Write a C function named find that receives a one-dimensional array of type integer named arr and its size of type integer. The function fills the array with values that are the power of four (4^n) where n is the index. After that, the function must select a random index from the array and move the array elements around the element stored in the randomly selected index Example arr = [1, 4, 16, 64, 256) if the randomly selected...

  • using matlab In Class Exercises 8-Arrays For the following exercises, assume an array is already populated, your job is to write a program that traverses the array. DO NOT HARD CODE the last in...

    using matlab In Class Exercises 8-Arrays For the following exercises, assume an array is already populated, your job is to write a program that traverses the array. DO NOT HARD CODE the last index. In other words, you code for 1-4&6 should be able to handle the following 2 arrays: amp2 10 array1 [52, 63, 99, 71, 3.1] array2 - [99:-3: 45); For 5: wordArray1 wordArray2 ('number, 'arrays', 'indices', 'hello', finish' [number, 'different, 'finish? 1. Determine the sum of all...

  • 1. Declare an array of five integers named boxes. 2. what do you type to access...

    1. Declare an array of five integers named boxes. 2. what do you type to access the third element in the boxes array? 3. what do you type to assign the number 10 to the 5th element in the boxes array? 4. Declare an array named cartons that contains these values: 4.2 , 3.1, 6.8 5. what is the subscript value of 6.8 in the cartons array? 6. what will this program output if is in a complete program? cout<<...

  • A method called linearSearch(), which takes as parameters an array of int followed by three values...

    A method called linearSearch(), which takes as parameters an array of int followed by three values of type int, and returns a value of type int. The first int parameter represents a key, the second int parameter represents a starting position, and the third int parameter represents an end position. If the key occurs in the array between the start position (inclusive) and the end position (exclusive), the method returns the position of the first occurrence of the key in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT