Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Critical Thinking Questions in A Guide to Programming in Java, Edition 5, Beth Brown, Lawrenceville Press please. 1. What index value does the third element

Critical Thinking Questions in A Guide to Programming in Java, Edition 5, Beth Brown, Lawrenceville Press please.

1. What index value does the third element of an array have?


2. Write the declaration for an array named quantities that stores 20 integers.


3. Write the declaration for an array named heights storing the numbers 1.65, 2.15, and 4.95.


4. Write the for-each statement that displays the integer values stored in an array named grades.


5.

a) Write the algorithm for inserting data into an array so that existing data is moved up one position to make room for the new data.

b) Write the algorithm for deleting data from an array so that existing data is moved to close the gap made by the deleted data.


6. How does passing an entire array to a method differ from passing a single element of the array?


7. Why are offset array indexes required in some cases.


8. What output is displayed by the statements below? String name = "Elaine"; System.out.println(name.charAt(3));


9. Compare and contrast an array to an ArrayList by describing the differences between the two for:

a) accessing an element.

b) adding an element.

c) deleting an element.

d) assigning a new value to an element.

e) determining the size of the collection.


10. Give an example of when a dynamic array might be a better structure choice over an array.


11. How does the ArrayList indexOf() method determine equality between the object passed to the method and an element in the array?


12. How can the values of wrapper class objects be compared?


13. Determine if each of the following are true or false. If false, explain why.

a) All data in an array has the same data type.

b) Index values always begin at 0.

c) The statement int[] empNums = new int[10] declares an array with 10 elements.

d) In the statement int[] empNums = new int[10], the elements are automatically initialized to 1.

e) An entire array can be passed to a method.

f) The method toCharArray() converts a String object to a char array.

g) A linear search never searches an entire array.

h) The statement int[][] grid = new int[4][4] declares a total of eight elements.

i) In Unicode, uppercase letters have higher base 10 number values than lowercase letters.

j) The size of an array can change during the execution of a program.

k) The ArrayList class implements a dynamic array.

l) Primitive data types can be stored directly in an ArrayList.

Screenshot

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The detailed answer for the above question is provided below the critical thinking questions from Chapter 10 of A Guide to Programming in JavaEdition 5 by Beth BrownHoweverIm unable to provide complet... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting Principles Part 2

Authors: Jerry J. Weygandt, Donald E. Kieso, Paul D. Kimmel, Barbara Trenholm, Valerie Kinnear, Joan E. Barlow

6th Canadian edition Volume 1

1118306791, 978-1118306796

More Books

Students also viewed these Programming questions

Question

To whom, and how oft en, are payroll deductions remitted?

Answered: 1 week ago