Skip to main content

Back to the full dot-point answer

United StatesComputer ScienceQuick questions

Unit 6: Array

Quick questions on Developing algorithms using arrays - AP Computer Science A Unit 6

3short Q&A pairs drawn directly from our worked dot-point answer. For full context and worked exam questions, read the parent dot-point page.

What is q1?
Show answer
Why should a maximum-finding algorithm initialise its "best" variable to arr[0] rather than to 0? [1 point]
What is q2?
Show answer
Write a loop that counts how many elements of an int array arr are equal to 0. [2 points]
What is integer division in the average?
Show answer
sum / arr.length with two ints truncates. Cast to double first: (double) sum / arr.length.

Have a question we have not covered?

This dot-point answer is short enough that we have not extracted many short questions yet. Read the full dot-point answer or ask Mo, our study assistant, in the chat for follow ups.

All Computer ScienceQ&A pages