SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 19 Nov 2017 My Price 10.00

contains a group of items that are all of the same

Java quiz, having difficulty with working on these

Question 1 (2 points)

 

An array contains a group of items that are all of the same type and that are directly accessed through the use of an array index.

Question 1 options:

True

False

Save

Question 2 (2 points)

 

Accessing areas outside of the array bounds results in:

Question 2 options:

both b and c

both a and c

bizarre and unexpected results

increased memory usage

an error

Save

Question 3 (2 points)

 

Using arrays leads to more reliable programs.

Question 3 options:

True

False

Save

Question 4 (2 points)

 

If i and j are not the same value the following code segments are equivalent:

Question 4 options:

both b and d

Array[ j ][ j ] and Array[ i ][ i ]

Array[ i ][ i ] and Array[ j ][ j ]

Array[ i ][ j ] and Array[ j ][ i ]

Array[ i ][ j ] and Array[ i ][ j ]

Save

Question 5 (2 points)

 

Because there is random access to array items there is no time difference in using multi-dimensional arrays vs one dimensional arrays.

Question 5 options:

True

False

Save

Question 6 (2 points)

 

How could the following code segment be better optimized?
for ( discountType = 0; discountType<typeCount; discountType++ ) {
   for ( discountLevel = 0; discountLevel<levelCount; discountLevel++ ) {
      rate[ discountLevel ] = rate[ discountLevel ] * discount[ discountType ];
   }
}

Question 6 options:

multiply rate and discount in the outer loop

store discountType in the outer loop for use in the inner loop

store discountLevel in the outer loop for use in the inner loop

compute rate in the outer loop

Save

Question 7 (2 points)

 

The optimization in the code from question #6 is because:

Question 7 options:

Accessing an array element takes longer than a accessing a non-array variable

Storing the rate in the outer loop requires fewer math problems

The multiplication can be done fewer times in the outside loop

The inner loop runs more times than the inner loop

Save

Question 8 (2 points)

 

What are the missing labels from the following image?
 
 

Question 8 options:

X and y

First and second

Column and row

Row and column

Save

Question 9 (2 points)

 

The following pseudo code is legal: variableType[][] b = {1, 2}, {3, 4, 5}

Question 9 options:

True

False

Save

Question 10 (2 points)

 

A jagged array is implemented as a two-dimensional array in which each element refers to a one-dimensional array.

Question 10 options:

True

False

Save

Question 11 (2 points)

 

What is the output for the following code:
int array[] = {10,23,45,1,78};
for(intcounter:array)
                System.out.println(counter);

Question 11 options:

102345178

10,23,45,1,78

12345

1,2,3,4,5

Save

Question 12 (2 points)

 

The following is the correct syntax for passing a multi-dimensional array into a function:
public void function(int[][] matrix){
}

Question 12 options:

True

False

Save

Question 13 (2 points)

 

Describe the following code segment:
int[][] b = new int[5][];

Question 13 options:

This is a dynamic array

This is an matrix with the columns initialized

This is an matrix with the rows initialized

This is a syntax error

Save

Question 14 (2 points)

 

Which is the correct code to process all the values in a 5x5 matrix:

Question 14 options:

nfor(inti=0;i<5;i++)
for(int j= i;j<5;j++)
                                matrix[i][j] = 0;

for(inti=0;i<5;i++)
for(int j= 4;j>=0;j--)
                                matrix[i][j] = 0;

for(inti=0;i<5;i++)
for(int j= 0;j<5;j++)
                                matrix[i,j] = 0;

for(inti=0;i<5;i++)
matrix[i] = 0;
for(int j= 0;j<5;j++)
                                matrix[j] = 0;

Save

Question 15 (2 points)

 

Which code adds a new element to a variable length String array called items?

Question 15 options:

items.add(0,”Yellow”)

items.add(“Yellow”)

items = new String(“Yellow”)

items.addString(“Yellow”)

Save

Attachments:

Answers

(5)
Status NEW Posted 19 Nov 2017 07:11 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)