Question

QUESTION 1 Consider the following section of code. Assume the syntax is correct and that it will execute. This question is worth 6 points. int numbers[6]; int sub; for (sub = 0; sub <= 5; sub +=...

QUESTION 1

  1. Consider the following section of code. Assume the syntax is correct and that it will execute. This question is worth 6 points.

    int numbers[6];
    int sub;

    for (sub = 0; sub <= 5; sub += 2)   
         numbers[sub] = sub;

    What is contained in the array numbers?

    A.

    numbers

    0

    1

    2

    3

    4

    5

    x

    x

    x

    x

    [ 0 ]

    [ 1 ]

    [ 2 ]

    [ 3 ]

    [ 4 ]

    [ 5 ]

    [ x ]

    [ x ]

    [ x ]

    [ x ]

    B.

    numbers

    0

    1

    2

    3

    4

    5

    6

    x

    x

    x

    [ 0 ]

    [ 1 ]

    [ 2 ]

    [ 3 ]

    [ 4 ]

    [ 5 ]

    [ 6 ]

    [ x ]

    [ x ]

    [ x ]

    C.

    numbers

    0

    2

    4

    6

    x

    x

    x

    [ 0 ]

    [ 1 ]

    [ 2 ]

    [ 3 ]

    [ 4 ]

    [ 5 ]

    [ 6 ]

    [ x ]

    [ x ]

    [ x ]

    D.

    numbers

    0

    2

    4

    x

    x

    x

    x

    x

    [ 0 ]

    [ 1 ]

    [ 2 ]

    [ 3 ]

    [ 4 ]

    [ x ]

    [ x ]

    [ x ]

    [ x ]

    [ x ]

    E.

    numbers

    0

    2

    4

    x

    x

    x

    x

    [ 0 ]

    [ 1 ]

    [ 2 ]

    [ 3 ]

    [ 4 ]

    [ 5 ]

    [ x ]

    [ x ]

    [ x ]

    [ x ]

QUESTION 27

  1. Elements of an array are related by the fact that they have the same __________.

    A.

    Zero

    B.

    Size

    C.

    Data type

    D.

    Value

    E.

    Index

1 points   

QUESTION 28

  1. When referencing an array element, the position number contained within brackets [] is called a(n) __________.

    A.

    Zero

    B.

    Size

    C.

    Data type

    D.

    Value

    E.

    Index

1 points   

QUESTION 29

  1. The elements of an array are numbered beginning at __________.

    A.

    Zero

    B.

    Size

    C.

    Data type

    D.

    Value

    E.

    Index

1 points   

QUESTION 30

  1. By default, variables are passed to procedures Call-By- __________.

    A.

    Zero

    B.

    Size

    C.

    Data type

    D.

    Value

    E.

    Index

1 points   

QUESTION 31

  1. When specifying the number of elements in an array, we are establishing a ______ of the array.

    A.

    Zero

    B.

    Size

    C.

    Data type

    D.

    Value

    E.

    Index

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

If you have any doubts, please give me comment...

Question 1: Answer E

Question 27: C (Data type)

Question 28: E (Index)

Question 29: A (Zero)

Question 30: D (Value)

Question 31: B (Size)

Add a comment
Know the answer?
Add Answer to:
QUESTION 1 Consider the following section of code. Assume the syntax is correct and that it will execute. This question is worth 6 points. int numbers[6]; int sub; for (sub = 0; sub <= 5; sub +=...
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 1 What is the value of x after the following int x = 5; x++;...

    Question 1 What is the value of x after the following int x = 5; x++; x++; x+=x++; A)14 B)10 C)13 D)15 Question 2 The last line in value returning function (before the }) should contain the word return. True False Question 3 This contains three parts: Void or Data Type the name optional parameter list A)Menu System B)Function Header C)Switch Question 4 What is a variable? A)a pointer B)a place in memory to hold data C)int D)a computer programming...

  • 1. (TCO 1) What is the output of the following C++ code? int list[5] = {0,...

    1. (TCO 1) What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++)      cout << list[j]; (Points : 4)         0 1 2 3 4         0 5 10 15         0 5 10 15 20         5 10 15 20 Question 2.2. (TCO 1) What is stored in alpha after the following code executes? int alpha[5] = {0}; int j; for (j = 0; j...

  • 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...

  • One dimensional array What this code print #include <iostream> using namespace std; int main () {...

    One dimensional array What this code print #include <iostream> using namespace std; int main () { const int SIZE = 7; int numbers [SIZE] = {1, 2, 4, 8): // Initialize first 4 elements cout << “Here are the contents of the array:\n"; for (int index = 0; index < SIZE: index++} cout << numbers[index] << “ “; cout << endl; return 0; }

  • 5. (12 points) Consider the following code fragment (part of a program): int index 3; String...

    5. (12 points) Consider the following code fragment (part of a program): int index 3; String dna "ACTGTCA char nucleotide dna.charAt (index); Matching: For each term below, write the letter of the ONE choice that best matches the term. Data types Variables Literals Object Method ーParameter nde x a. coumt, nucleotide, and d b. 3 and "ACTGTCA c. int, char, and String d. index e. charAt f. dna na 6. (10 points) a. Wrte a statement that assigns true to...

  • 1. What is the output of the following code segment? int array[] = { 8, 6,...

    1. What is the output of the following code segment? int array[] = { 8, 6, 9, 7, 6, 4, 4, 5, 8, 10 }; System.out.println( "Index Value" ); for ( int i = 0; i < array.length; i++ ) System.out.printf( "%d %d\n", i, array[ i ] ); 2. What is the output of the following code segment? char sentence[] = {'H', 'o', 'w', ' ', 'a', 'r', 'e', ' ', 'y', 'o', 'u' }; String output = "The sentence...

  • Consider the following statements: int numbers[][] = {{1}, {1, 2}, {1, 2, 3}}; What is the...

    Consider the following statements: int numbers[][] = {{1}, {1, 2}, {1, 2, 3}}; What is the size of the array? 3 rows, 3 columns 3 rows, 1 column 1 row, 3 columns 3 rows, 2 columns When you declare an array using the following statement inside a function, the element values are automatically initialized to 0. int matrix[5][5]; How many elements are array matrix[5][5][2]?

  • Question Part Points Submissions Used 1 2 3 4 5 –/1 –/1 –/1 –/1 –/1 0/5...

    Question Part Points Submissions Used 1 2 3 4 5 –/1 –/1 –/1 –/1 –/1 0/5 0/5 0/5 0/5 0/5 Total –/5 For each of the following sets of quantum numbers, name the orbital. (Type your answer using the format 3p.) (a) n = 6, ℓ = 1 1 (b) n = 1, ℓ = 0 2 (c) n = 4, ℓ = 3 3 (d) n = 5, ℓ = 2 4 (e) n = 6, ℓ = 4...

  • Question 2 [5 points) State if each of the below statements is True or False 1...

    Question 2 [5 points) State if each of the below statements is True or False 1 2 3 The Compiler skips comments. A function can return a value of type array. An array index starts with 1. Pass by value is the default in CH, except when passing arrays as arguments to function The default storage class for local variables is static. A pointer provides an indirect means of accessing the value of a particular data item The logical operators...

  • What elements does the array numbers contain after the following code is executec int[] numbers =...

    What elements does the array numbers contain after the following code is executec int[] numbers = new int [8]; numbers [1] = 3; numbers [4] = 99; numbers [7] = 2; int x = numbers[1]; numbers(x) = 44; numbers (numbers [7]] = 11; O 13, 11, 44, 99, 2] O 10, 3, 11, 44, 99, 0, 0, 2] O 13, 0, 11, 44, 99, 0, 21 O 10, 3, 2, 44, 99, 0, 0, 11]

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