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.3, Problem 8.3.1CP
Show the output of the following code:
int[][] array = {{1, 2}, {3, 4}, {5, 6}} ;
for (int i = array. Length - 1 ; i >= 0 ; i--) {
for (int j = array[i].length - 1 ; j >= 0 ; j--)
System.out.print(array[i] [j] + " " );
System.out.println();
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
int[] cars = {1,2,3,4,5};
for (int i=0; i
Analyze 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.
What does the following code do?
const int SIZE = 5;
double x[SIZE];
for (int i = 2; i <= SIZE; i++)
{
x[i] = 0.0;
Each element in the array is initialized to 0.0.
Each element in the array except the first is initialized to 0.0.
Each element in the array except the first and last is initialized to 0.0.
An error will occur when the code runs.
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
You can use_________ to create an empty dictionary. a. {} b. () c. [] d. empty ()
Starting Out with Python (4th Edition)
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
What limits the resolution of a stylus-type surface-measuring device.
Degarmo's Materials And Processes In Manufacturing
The resistance and inductance of the circuit in Fig. 8.5 are 100 and 20 mH, respectively.
Find the value of C t...
Electric Circuits. (11th Edition)
Consider the following skeletal C program: void fun1(void); / prototype / void fun2(void); / prototype / void f...
Concepts Of Programming Languages
How many cells can be in a computers main memory if each cells address can be represented by two hexadecimal di...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
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
- #include #include main () { int array [3] [2] [2], value=0, i, j, k; int *p= (int *) array; } for (i = 0; i < 3; i++) { for(j= } = 0; j < 2; j++) { for (k = 0; k < 2; k++) { array[i][j] [k] = value; value = value + 1; } } for (i = 0; i < 12; i++) printf("%d ", p[i]); printf("\n"); printf ("Examine memory now.\n");arrow_forwardDeclare and initialize an array as such, int arr[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1); Considering the following code snippet, what value does 'arr' have after the function call 'arrayTest(arr);'? 1 void arrayTest(int a[]){ 2 3 4 5 } for (int i = 0; i<10; i+= 2) { a[i] = i; 0123456789 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 02468 } 0927456381 Question 33 (1 point) Suppose that strl, str2, and str3 are string variables. After the following statements execute, the value of str3 is " strl1 = "abc"; str2 = "xyz"; abc xyz str3= strl + 1_1 + str2; abc-xyz C++ xyz-abcarrow_forwardpublic int[] selectionSort(int[] array) {for (int i = 0; i < array.length - 1; i++) {int min = array[i];int minIndex = i;for (int j = i + 1; j < array.length; j++) {if (min > array[j]) {min = array[j];minIndex = j;}}if (minIndex == i) {array[minIndex] = array[i];array[i] = min;}}return array;}arrow_forward
- public int[] selectionSort(int[] array) {for (int i = 0; i < array.length - 1; i++) {int min = array[i];int minIndex = i;for (int j = i + 1; j < array.length; j++) {if (min > array[j]) {min = array[j];minIndex = j;}}if (minIndex == i) {array[minIndex] = array[i];array[i] = min;}}return array;}arrow_forwardHow do you initialize an array in C? a. int arr[3] = (1,2,3); b. int arr(3) = {1,2,3}; C. int arr(3) = [1,2,3]; Od. int arr[3] = {1,2,3};arrow_forwardAn array int[] intArray can be initialized during its definition by A.) It can't be initialized B.) by writing int[] intArray = {1.0f}; C.) by writing int[] intArray = {0,1,2}; D.) by writing int[0-10] intArray = {0,1,2,3,4,5,6,7,8,9};arrow_forward
- Print 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_forwardConsider the following code: int a[5] = {1,3,5,7,9};int b = a[3]; // <--- here Rewrite the last statement (marked “here”) without using array brackets [ ]. Group of answer choices int b = a + 3; int b = *(a + 3); int b = *a + 3; int b = *(a + 2);arrow_forwardint X[10]={2,0,6,11,4,5,9,11,-2,-1); From the code above, what is the value of X[8] ?arrow_forward
- Code for this in C: You have created three arrays:array A of size 100array B of size 50array C of size 200You are to store the first 100 numbers (1,2,3,...,100) into array A, the first 50 positive odd numbers (1,3,5,...,) into array B, and the reciprocal of each position [C(5) = 1/5] into array C. Then, output the contents of each array.arrow_forwardGiven the Array declaration below, determine the output: int T[8] = {2, 3, 7, 9, -1, 2, 4, 5}; int x = 5; cout << T[x-2] / T[12-2*x]; int y = -3; cout << pow(T[y+4],T[3-y]);arrow_forward//convert array of numbers from farenheit to celcius// example:// argument: [23, 32, 41, 50, 59]// return: [-5, 0, 5, 10, 15]// hint: use Array.mapfunction toCelcius(array){ } //write a function that takes an input array and returns an array of booleans (>=75) or fail (<75)// example:// argument: [20, 30, 50, 80, 90, 100]// return: [false, false, false, true, true, true]// hint: use Array.mapfunction passOrFail(array){ }arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_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