Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 8.2, Problem 8.2.4CP
Which of the following statements are valid?
int [] [] r = new int[2];
int [] x = new int[];
int [] [] y = new int[3] [];
int [] [] z = {{1, 2}};
int [] [] m = {{1, 2}, {2, 3}};
int [] [] n = {{1, 2}, {2, 3},} ;
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
int X[10]={2,0,6,11,4,5,9,11,-2,-1);
From the code above, what is the value of X[8] ?
void changeAll(int x[]) {
x[0] = x[0] + 5;
return;
The first element in an array would be increased by 5
The array would be the same because it was passed by value
x would be increased by 5
All the elements in the passed array would be incremented by 5
Consider the following code segment that includes a method called
multiply. The multiply method is a sample method for the multiplication
of an n by m array and an m by p array. Suppose the multiply method is
invoked as shown after replacing the element indicated as x by a number.
What number should replace x so that the b3[0][0] = 9 after the execution
of b3 = multiply(b1,b2)?
Note that the initializeArray method puts a O to every cell of the array
passed to initializeArray. *
Chapter 8 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 8.2 - Declare an array reference variable for a...Ch. 8.2 - Prob. 8.2.2CPCh. 8.2 - What is the output of the following code? int[] []...Ch. 8.2 - Which of the following statements are valid? int...Ch. 8.3 - Show the output of the following code: int[][]...Ch. 8.3 - Show the output of the following code: int[][]...Ch. 8.4 - Show the output of the following code: public...Ch. 8.5 - Prob. 8.5.1CPCh. 8.6 - What happens if the input has only one point?Ch. 8.7 - What happens if the code in line 51 in Listing 8.4...
Ch. 8.8 - Declare an array variable for a three-dimensional...Ch. 8.8 - Assume char[][][] x =new char[12][5][2], how many...Ch. 8.8 - Show the output of the following code: int[][][]...Ch. 8 - (Sum elements column by column) Write a method...Ch. 8 - (Sum the major diagonal in a matrix) Write a...Ch. 8 - (Sort students on grades) Rewrite Listing 8.2,...Ch. 8 - (Compute the weekly hours for each employee)...Ch. 8 - (Algebra: add two matrices) Write a method to add...Ch. 8 - (Algebra: multiply two matrices) Write a method to...Ch. 8 - (Points nearest to each other) Listing 8.3 gives a...Ch. 8 - (All closest pairs of points) Revise Listing 8.3,...Ch. 8 - Prob. 8.9PECh. 8 - (Largest row and column) Write a program that...Ch. 8 - (Game: nine heads and tails) Nine coins are placed...Ch. 8 - (Financial application: compute tax) Rewrite...Ch. 8 - (Locate the largest element) Write the following...Ch. 8 - (Explore matrix) Write a program that prompts the...Ch. 8 - (Geometry: same line ?) Programming Exercise 6.39...Ch. 8 - (Sort two-dimensional array) Write a method to...Ch. 8 - (Financial tsunami) Banks lend money to each...Ch. 8 - (Shuffle rows) Write a method that shuffles the...Ch. 8 - (Pattern recognition: four consecutive equal...Ch. 8 - Prob. 8.20PECh. 8 - (Central city) Given a set of cities, the central...Ch. 8 - (Even number of 1s) Write a program that generates...Ch. 8 - (Game: find the flipped cell) Suppose you are...Ch. 8 - (Check Sudoku solution) Listing 8.4 checks whether...Ch. 8 - Prob. 8.25PECh. 8 - (Row sorting) Implement the following method to...Ch. 8 - (Column sorting) Implement the following method to...Ch. 8 - (Strictly identical arrays) The two-dimensional...Ch. 8 - (Identical arrays) The two-dimensional arrays m1...Ch. 8 - (Algebra: solve linear equations) Write a method...Ch. 8 - (Geometry: intersecting point) Write a method that...Ch. 8 - (Geometry: area of a triangle) Write a method that...Ch. 8 - (Geometry: polygon subareas) A convex four-vertex...Ch. 8 - (Geometry: rightmost lowest point) In...Ch. 8 - (Largest block) Given a square matrix with the...Ch. 8 - (Latin square) A Latin square is an n-by-n array...Ch. 8 - (Guess the capitals) Write a program that...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
The decimal number 17 is equal to the binary number 10010 11000 10001 01001
Digital Fundamentals (11th Edition)
Write some Java code to create an output stream of type ObjectOutputStream that is named to File and is connect...
Java: An Introduction to Problem Solving and Programming (7th Edition)
Explain the problems that denormalized tables may have for insert, update, and delete actions.
Database Concepts (8th Edition)
What is the output of the following program? #include iostream using namespace std; void fund1(double, int); //...
Starting Out with C++: Early Objects (9th Edition)
What are the advantages in implementing a language with a pure interpreter?
Concepts of Programming Languages (11th Edition)
What is an object? What is a control?
Starting Out With Visual Basic (7th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- If int abc[5]= {1,2,3,4,5}. What is the value of abc[4]?arrow_forward#include for(int i = 0; i { int main() for(int j = 0; j< 2; j++) { { int matrix[2][2] = { printf(" %d", matrix[i][j]); } {2,3,}, //rowo printf("\n"); } {5,7}//row1 getch(); }; } printf("\n Resultant \n"); Try to execute, screenshot the resul and try to explain the sequence of the program. Post it in space-ners provided. FRAMEWORK HTPE ADACHE e OrcE outATION roR TECHO A LEarrow_forwardAn array is given as int x[6] = {19, 10, 8, 17, 9, 15};, what is x[4]arrow_forward
- C++arrow_forwardHow many elements are there in arrays x, y, and z? int x[27]; const int base = 10; int y[base + 5]; int z[100][100][100];arrow_forwardAnalyze the statements below: double [] templ = {50.0, 69.0, 75.0, 80.0, 55.0}; printArray (temp1); The call to printArray sends the of/to the array temp1.arrow_forward
- using java programming int a[] = {5,10,4,20,1,7}; 1- search for the smallest element in array 2-if you found the smallest element in the array :swap the first element with the smallest elementarrow_forwardint[] cars = {1,2,3,4,5}; for (int i=0; iarrow_forwardAssume that the following program segment is executed. What is the first element of testArray3 after the execution of the statement sortArray2(testArray3);? *arrow_forwardPrint the elements of the array ‘a’ using the mentioned notations: int a[]={1,2,3,4,5}; int *p; p = a; for (int i = 0; i< 5; i++) { //Subscript notation with name of array //Subscript notation with pointer 'p' //Offset notation using array name //Offset notation using pointer 'p' }arrow_forwardCorrect errorsarrow_forwardchar[] X = { ‘A’, ‘E’, ‘I’, ‘O’, ‘U’, ‘V’}; What is the value of X[2]? a. I b. U c. E d. Oarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License