Question

Given this 2D array, which of the following statements are valid or invalid to use? String[][]...

Given this 2D array, which of the following statements are valid or invalid to use?

String[][] a = {{“It’s”, “always”, “a”, “hassle”}, {“converting”, “to”, “Celsius”}};

//valid or invalid?

a[1][2] = a[2][1];

a[1][0] = a[0][1];

a[-1][0] = a[1][0];

a[0][3] = a[1][3];

a[0][2] = a[1][1];

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

a[1][2] = a[2][1];  ->  invalid
a[1][0] = a[0][1];  ->  valid
a[-1][0] = a[1][0]; ->  invalid
a[0][3] = a[1][3];  ->  invalid
a[0][2] = a[1][1];  ->  valid
Add a comment
Know the answer?
Add Answer to:
Given this 2D array, which of the following statements are valid or invalid to use? String[][]...
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
  • 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...

  • 1. (2 points each) Indicate whether each of the following statements are valid or invalid function...

    1. (2 points each) Indicate whether each of the following statements are valid or invalid function declarations (prototypes) by highlighting your answer choice (Are they syntactically correct?). a) double change( X, Y);                           answer:                Valid       Invalid b) char sign(double x);                               answer:                Valid       Invalid c) int max(int x, int y, int z)                         answer:                Valid       Invalid 2. (2 points each) Indicate whether each of the following statements are syntactically valid or invalid function headers by highlighting your answer choice. a) double change( X,...

  • Question 1. Is the following argument valid or invalid? It’s often good to give to charity....

    Question 1. Is the following argument valid or invalid? It’s often good to give to charity. If it’s often good to give to charity, then the Earth is round. ∴ The Earth is round. Question 2. Is the following argument valid or invalid? If Ruldoph's nose is shiny, then it is reflective Ruldoph's nose is not shiny ∴ Ruldoph's nose is reflective

  • Consider the following statements: struct nameType { string first; string last; }; struct courseType { string...

    Consider the following statements: struct nameType { string first; string last; }; struct courseType { string name; int callNum; int credits; char grade; }; struct studentType { nameType name; double gpa; courseType course; }; studentType student; studentType classList[100]; courseType course; nameType name; Mark the following statements as valid or invalid. If a statement is invalid, explain why. student.course.callNum = "CSC230"; cin >> student.name; classList[0] = name; classList[1].gpa = 3.45; name = classList[15].name; student.name = name; cout << classList[10] << endl;...

  • Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D...

    Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D array of integers which is 10x10. 2. Prints out the contents of the 2D array after assigning the data to make sure correct data was assigned. 3. Figures out and prints out the square root of the sum of ALL the elements in the 2D array. 4. Figures out and prints out the average of ALL THE ELEMENTS in the 2D array. 5. Figures...

  • Classify the following hypotheses statements as valid or invalid.       -       A.   ...

    Classify the following hypotheses statements as valid or invalid.       -       A.       B.    H0:μ≤68 H1:μ>68       -       A.       B.    H0:μ≥86 H1:μ<86       -       A.       B.    H0:μ=104 H1:μ≠104       -       A.       B.    H0:μ<14 H1:μ>14       -       A.       B.    H0:μ≠68 H1:μ=68       -       A.       B.    H0:μ≤55...

  • ,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" :...

    ,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" : B) cout << Hello World; C) cout << "Hello " << "World" ; D) cout << "Hello" << "World" ; 2. What is the difference between the literals 'A' and "A"? ,3. Read the input from user; Check for valid entries If input is invalid: print an error message; else: calculate the result and print to the console; exit; The code snippet above may...

  • The last element in each array in a 2D array is incorrect. It’s your job to...

    The last element in each array in a 2D array is incorrect. It’s your job to fix each array so that the value 0 is changed to include the correct value. In the first array, the final value should be the length of the first array. In the second array, the final value should be the sum of the first value, and the second to last value in the array. In the third array, the final value should be the...

  • Use Euler diagrams to determine whether the following argument is valid or invalid. Some factors of...

    Use Euler diagrams to determine whether the following argument is valid or invalid. Some factors of 6 are factors of 10 All factors of 10 are factors of 70. . Some factors of 6 are factors of 70. Is the syllogism valid or invalid? The syllogism is invalid The syllogism is valid Click to select your answer

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