AP CS A Unit 6 Quiz PRACTICE

Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Scott Chamberlain
Used 3+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Assume you have the following array: int[] num = {3, 2, 8, 1, 7}; How would you decrement (subtract) the second element in the array by one?
2--
1--;
num[1]--;
num[2]--;
num[1]++;
Answer explanation
The second element of num has index of 1 and the -- subtracts 1 from the value accessed by the []
2.
FILL IN THE BLANK QUESTION
2 mins • 1 pt
Consider the following code: double[] list = new double[25]; The index of the first value is ______ and the last index is ______.
Answer explanation
The first element of an array always has index 0, meaning that the 25th and final element of this array must have index 24, one less than the number of elements in the array.
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What data types can a standard array not hold?
ints
booleans
doubles
Strings
All the data types can be in a standard array
Answer explanation
All primitive data types + Strings can be stored in a standard array
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Consider the code shown here. What is output?
24
26
28
36
38
Answer explanation
The i % 2 == 0 will pick every even indexed value and then will sum them together, 2, 8, 12, 16 are those values and sum to 38
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Consider the following code, intended to search an array for a value and print the position where that value was found.
What could replace /* Missing Code */ so that the code works as intended?
number[i] = location;
location = numbers[i];
location = i;
i = location;
location = 1;
Answer explanation
In a linear search, we need to find the index in the array where the value we are searching for is stored. The missing code runs when we have found the value, so we need to store the index of that value in the found variable.
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
The following is intended to count the number of times the number 100 is found in an array of test scores.
Which of the following could replace /* Missing Code */ so that the code works as intended?
tests[i] == 100
tests == 100
tests != 100
tests.equals(100)
tests[i].equals(100)
Answer explanation
The loop should check one value in the array on each pass through the loop, and check whether it is equal to 100.
7.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Consider the following code, intended to count the number of words in the array with a length greater than or equal to 5.
What could be used to replace /* Missing Code */ so that the code works as intended?
vocab.length[i]() >= 5
vocab[i].length() >= 5
vocab.length() > 5
vocab[i].length() > 5
vocab.length() >= 6
Answer explanation
The loop should check one value in the array on each pass through the loop, and check whether its length is greater than or equal to 5.
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Quiz 2: Introduction to PHP

Quiz
•
11th Grade
11 questions
CodeHS 5.3 Using Arrays

Quiz
•
9th - 12th Grade
15 questions
CPM9.1-9.3 Quiz Review

Quiz
•
9th - 12th Grade
14 questions
Polymorphism in OOP

Quiz
•
12th Grade
15 questions
Technical Quiz R2

Quiz
•
12th Grade
10 questions
Year 9 Programming Constructs

Quiz
•
1st - 12th Grade
15 questions
Pseudocode

Quiz
•
9th - 11th Grade
6 questions
Topic 6.1 Video 2

Quiz
•
11th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
30 questions
Introduction to Computers

Quiz
•
8th - 9th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade