B4 - Common Array Algorithms

B4 - Common Array Algorithms

University

10 Qs

quiz-placeholder

Similar activities

SEMINAR COMPLETION UP 2021

SEMINAR COMPLETION UP 2021

University

15 Qs

CC101 - WEEK 7

CC101 - WEEK 7

University

10 Qs

Repaso_Calculo Integral

Repaso_Calculo Integral

University

10 Qs

Soil Mechanics

Soil Mechanics

University - Professional Development

10 Qs

Drive Thru Lane Sensor

Drive Thru Lane Sensor

University - Professional Development

10 Qs

ITEM ANALYSIS AND VALIDATION

ITEM ANALYSIS AND VALIDATION

University

10 Qs

Saving, Investment, and Financial System

Saving, Investment, and Financial System

University

15 Qs

Analise de Artigos

Analise de Artigos

University

12 Qs

B4 - Common Array Algorithms

B4 - Common Array Algorithms

Assessment

Quiz

Other

University

Practice Problem

Hard

Created by

Ahmetcan türk

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the length of the following array: byte[] data = { 12, 34, 9, 0, -62, 88 };

1

5

6

12

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code fragment:

int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };


for ( int index= 0 ; index < 5 ; index++ )

System.out.print( egArray[ index ] + " " );

2 4 6 8

2 4 6 8 10

2 4 6 8 10 1

2 4 6 8 10 1 3 5 7 9

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code fragment:

int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };


for ( int index= 0 ; index < egArray.length ; index++ )

System.out.print( egArray[ index ] + " " );

2 4 6 8

2 4 6 8 10

2 4 6 8 10 1

2 4 6 8 10 1 3 5 7 9

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code fragment:

int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };


for ( int index= 0 ; index < egArray.length ; index = index + 2 )

System.out.print( egArray[ index ] + " " );

2 4 6 8 10 1 3 5 7 9

4 8 1 5 9

2 6 10 3 7

2 6 10 3 7 0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Does a programmer always know how long an array will be when the program is being written?

Yes—the program will not compile without the length being declared.

No—the array object is created when the program is running, and the length might change from run to run.

Yes—otherwise the program will not run correctly.

No—arrays can grow to whatever length is needed.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Fill in the blanks of the following code fragment so that the elements of the array are printed in reverse order, starting with the last element.

int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };


for ( int index= ________ ; _____________ ; ______________ )

System.out.print( egArray[ index ] + " " );

index = 0; index < egArray.length; index--

index = length; index < 0; index--

index = length-1; index > 0; index--

index = egArray.length-1; index >= 0; index--

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Examine the following program fragment:


int[] array = { 1, 4, 3, 6, 8, 2, 5};

int what = array[0];


// scan the array

for ( int index=0; index < array.length; index++ )

{

if ( array[ index ] > what )

what = array[ index ];

}

System.out.println( what );


What does the fragment write to the monitor?

1

5

1 4 3 6 8 2 5

8

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?