Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 10 pts If the first element in an array is an integer, what do we know about all of the elements in the

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Question 1 10 pts If the first element in an array is an integer, what do we know about all of the elements in the array? it does not tell us anything about the rest of the array they are all integers the first element tells us the length of the array the first element tells us the largest index of the array Question 2 10 pts What s the highest index in an array of 20 elements? O 21 20 It is open-ended O 19 Question 3 10 pts How is memory numbered in most computer systems? it depends on the word length of the computer most computer memory is byte addressable most modern computers use 64-bit offset addressing computers that run Java use UTF-16 bit memory addressing Question 4 10 pts Which of the following illustrates is a common way of including both parts of an array declaration in the same Java statement? String[] empName = new String[10]; String[10] empName; String empName[10]; empName = new String[10]; Question 5 10 pts If the data type of an array is an object, what does each element contain? an actual object a reference to an object itself the name of an object arrays can only be used for primitive data types Question 6 10 pts How is an entire array passed as a parameter? a reference to the array, and not the values in the array, is passed to another method when an array is passed in Java all of the elements of the array named in the formal parameter list are passed to the elements of the array named in the actual parameter list all of the elements of the array named in the actual parameter list are passed to the elements of the array named in the formal parameter list entire arrays cannot be passed as parameters in Java Question 7 10 pts If an entire array is passed as a parameter and we change the value of an element in the array, what happens in the original array? the address of the array is passed. This means whatever we do to one we do to the other. The original array is not affected entire arrays cannot be passed as parameters it depends on the return type of the method Question 8 10 pts What is a good way to initialize all the elements of a large array with the same value? by using a statement similar to String empName[10] = "Smith"; using a for loop or an enhanced for loop to assign each element the same value each element in an array must have a unique value by using a statement similar to String[10] empName = "Smith"; Question 9 10 pts How can we find the sum of the values in a numeric array? by using java's sum() function Ojava does not store numeric values in arrays, only Strings. by using a for loop or enhanced for loop to add each value to a sum that was initialized to zero by using the array's length property Question 10 10 pts How can we find the minimum of the values in a numeric array? by using java's minimum() function Ojava does not store numeric values in arrays, only Strings. by setting a minimum variable equal to the array's first element, then iterating the rest of the array and setting the minimum equal to any value less than the minimum in each iteration by using java's Math.minArray() function Question 11 10 pts What String class methods can we use to see if two Strings have the same value? only the equals() method works with Strings only the matches() method works with Strings O only the == operator The matches() and compareTo() methods Question 12 10 pts What advantage is provided by using a Boolean found variable in a compound condition for a search loop? It is more efficient -- with the compound condition, the loop will stop as soon as the value is found Each pass through the loop is significantly faster compound conditions cannot be used with for loops there is no advantage -- it will slow down each pass through the loop Question 13 10 pts When does the algorithm stop making passes in an efficient bubble sort? it only goes through the entire array once when the number of passes equals the number of elements in an array when it can make a pass through the entire array without swapping anything when it finds the element it is searching for Question 14 10 pts What are the two steps involved in accessing text data files from a Java application? reading from the file then writing to the file we establish a File class object, then connect a data stream between the file and the application the file variable must be declared, then initialized Scanner must be initialized, then PrintWriter must be initialized Question 15 10 pts In what two ways can a Java application deal with exceptions? by throwing exceptions or catching exceptions through inheritance and polymorphism by using the debug feature in an IDE, such as NetBeans by using try blocks and doNotTry blocks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Genomes Browsers And Databases Data Mining Tools For Integrated Genomic Databases

Authors: Peter Schattner

1st Edition

0521711320, 978-0521711326

More Books

Students also viewed these Databases questions

Question

What is the nature of a joint-production process?

Answered: 1 week ago

Question

1. Effort is important.

Answered: 1 week ago