Question

What would be the results of the following code? Create array1 ← [33, 88, 11, 44,...

What would be the results of the following code?

Create array1 ← [33, 88, 11, 44, 99, 55]

value ← array1[0]

FOR each value in array1

IF(array1[i] < value) THEN

value ← array1[i]
ENDIF
ENDFOR

Question 7 options:

A)

Value contains the lowest value in array1.

B)

Value contains the highest value in array1.

C)

Value contains the sum of all the values in array1.

D)

Value contains the average of the values in array1.

Question 8 (1 point)

What would be the value of x[1] after the following code is executed?

Create array x [22, 33, 44]

CALL ARRAY_PROCESS with x

...

METHOD ARRAY_PROCESS(parameter [] a)

BEGIN

FOR EACH value in a

    a[i] ←a[i] + 5

ENDFOR

END ARRAY_PROCESS   



Question 8 options:

A)

27

B)

33

C)

38

D)

22

Question 9 (1 point)

For the following code, what would be the value of str[2]?

Create array myStrings ← ["abc", "def", "ghi", "jkl"]

Question 9 options:

A)

A reference to the string "def"

B)

A reference to the string "jlk"

C)

A reference to the string "ghi"

D)

A reference to the string "abc"

Question 10 (1 point)

The index of the center position of a 3*3 2D array would be:

Question 10 options:

a)

[1][1]

b)

[2][1]

c)

[0][1]

d)

[1][2]

Question 11 (1 point)

Choose the answer that best describes the array created upon executing the following:

Create array myStudents[30][6]

Question 11 options:

a)

Creates a 2D array with 30 rows and six columns

b)

Creates a 2D array with 30 columns and 6 rows

c)

Creates a 3D array

d)

Creates a 1D array with 180 positions

Question 12 (1 point)

What value is stored in myNumbers[1][2] after the following code executes:

y ← 3

Create array myNumbers[3][4]
FOR rows in myNumbers
   FOR columns in myNumbers

            myNumbers ← y
        y ← y + 2

   ENDFOR
ENDFOR

Question 12 options:

a)

12

b)

13

c)

15

d)

5

Question 13 (1 point)

Select the code you would use to create a 2D array with 5 rows and 12 columns.

Question 13 options:

a)

Create array myNums[5*12]

b)

Create array myNums[5][12]

c)

Create array myNums[60]

d)

Create array myNums[12][5]

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

7) Value contains the lowest value in array1.

explanation:-

each time value parameter get update when it compare array smaller values

8) 38

explanation:-  x [22, 33, 44]

FOR EACH value in a

    a[i] ←a[i] + 5

so x [27,38,49]

so x[1]=38

9) A reference to the string "ghi"

10) [1][1]

11)

Creates a 2D array with 30 rows and six columns

12) 13

matrix after execution is:-

3 5 7 9

11 13 15 17

19 21 23 25

13) Create array myNums[5][12]

Add a comment
Know the answer?
Add Answer to:
What would be the results of the following code? Create array1 ← [33, 88, 11, 44,...
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
  • Question 21 What will be the results after the following code is executed? int[] arrayi =...

    Question 21 What will be the results after the following code is executed? int[] arrayi = new int [25]; // Code that will put values in array1 int value = array1[0]; for (int a = 1; a < array1.length; a++) مه if (arrayl[a] < value) value = arrayi[a]; value contains the sum of all the values in arrayi value contains the lowest value in array1 value contains the average of all the values in array value contains the highest value...

  • Create a class called Lab7b and in it implement all of the methods below. Also, write...

    Create a class called Lab7b and in it implement all of the methods below. Also, write a main method with test calls to all of these methods. Don’t forget to turn in your file to Canvas before the end of the lab today. int[][] random(int N, int start, int end) returns an N-by-N matrix of random integers ranging from start to end; int rowSum(int[][] a, int i) returns the sum of the elements in row i of the 2-D array...

  • Create a java project. Create a class called cls2DarrayProcessor.java. with the following: Reads numbers from a...

    Create a java project. Create a class called cls2DarrayProcessor.java. with the following: Reads numbers from a pre-defined text file. A: Text file name should be data.txt B: Text file should be in the same workspace directory of your project's folder C: Text file name should be STORED in a String and called: String strFile ='./data.txt' Defines a 2-D array of integers with dimensions of 5 rows by 5 columns. Inserts the data from the text file to the 2-D array...

  • In Java Please Create A Program For The Following; Please Note: This program should be able...

    In Java Please Create A Program For The Following; Please Note: This program should be able accept changes to the values of constants ROWS and COLS when testing the codes. Switch2DRows Given a 2D array with ROWS rows and COLS columns of random numbers 0-9, re-order the rows such that the row with the highest row sum is switched with the first row. You can assume that 2D arrau represents a rectangular matrix (i.e. it is not ragged). Sample run:...

  • Java programming: I need to create a method that is given a 2D char array and...

    Java programming: I need to create a method that is given a 2D char array and a String that returns a part of the original 2D array. The input string will tell the method which rows from the input array need to be returned. For example, a 5x5 char array input along with a string "0 4" would return rows 1 and 5 of the input array. The String input will always be numbers divided by spaces and will not...

  • Step 1: Getting Started Create a new .java file named Lab12.java. At the beginning of this...

    Step 1: Getting Started Create a new .java file named Lab12.java. At the beginning of this file, include your assignment documentation code block. After the documentation block, you will need several import statements. import java.util.Scanner; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; Next, declare the Lab12 class and define the main function. public class Lab12 { public static void main (String [] args) { Step 2: Declaring Variables For this section of the lab, you will need to declare...

  • Create a class called Play that has an InputReader as an instance variable. Be sure to...

    Create a class called Play that has an InputReader as an instance variable. Be sure to initialize it in the constructor. The class has two methods. Write a method with this signature: Write a method with this signature: public void stringPlay() The method prompts the user for a string, reads it in, and then displays the string as many times as the length of that string. The output string should be formatted with the first letter uppercase and the rest...

  • C# Code please with picture of code.Thanks! 1. Create a Main method, and create a 2D...

    C# Code please with picture of code.Thanks! 1. Create a Main method, and create a 2D integer array called data, with a size of five (5) by five (5). Ask the user to input the values for this array (Scanner’s nextInt) 2.Create a method called LongestPositiveSeries, that takes in a 2D array and finds the length of the longest continuous series of positive numbers in it. For example, if we had an array like this: 0 1 2 3 4...

  • Question 1) Suppose a program has the following code: const int X = 2, Y =...

    Question 1) Suppose a program has the following code: const int X = 2, Y = 3; int sum; int values[X][Y] = {{1, 2, 3},                                  {4, 5, 6}}; for(int i=0; i<X; i++) {      sum=0;      for(int j=0; j<Y; j++)         sum+=values[i][j];    cout<<sum<<endl; } What is this program getting the sum of? Group of answer choices D-) The columns of the 2D array C-) The rows of the 2D array A-) All of the elements of the 2D...

  • help with C++ code The aim of this is to practice writing template classes. You must...

    help with C++ code The aim of this is to practice writing template classes. You must use SafeArray template class and implement a SafeMatrix template class that will allow you to work with two dimensional arrays of any type. The boundaries are checked. You must be able to create instances of SafeMatrix template class like, SafeMatrix<int> m(2,3); The above statement will create a 2 by 3 dimensional array of integers. You must be able to access and set values using...

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