AP CSA - Unit 6 Arrays Test Review

Quiz
•
Computers
•
10th - 12th Grade
•
Medium
Wendy Beuglas
Used 17+ times
FREE Resource
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Which index is the last element in an array called
nums at?
nums.length
nums.length - 1
Answer explanation
Since the first element in an array is at index 0 the last element is the length minus 1.
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Which of the following declarations will cause a compile time error?
int[ ] scores = null;
int [ ] scoreArray = {50,90,85};
String [ ] nameArray = new String [10];
String [ ] nameArray = {5, 3, 2};
int [ ] scores = new int [5];
Answer explanation
You can not put integers into an array of String objects
3.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What is returned from arr[3] if arr = {6, 3, 1 , 2} ?
1
2
3
6
4
Answer explanation
This returns the value in arr at index 3. Remember that the first item in an array is at index 0.
4.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What is returned from mystery when it is passed {10, 30, 30, 60}?
17.5
30.0
130
32
32.5
Answer explanation
This sums all the values in the array and then returns the sum divided by the number of items in the array. This is the average.
5.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Given the following values of a and the method doubleLast what will the values of a be after you execute: doubleLast()?
{-20, -10, 2, 8, 16, 60}
{-20, -10, 2, 4, 8, 30}
{-10, -5, 1, 8, 16, 60}
{-10, -5, 1, 4, 8, 30}
Answer explanation
It loops from the middle to the end doubling each value. Since there are 6 elements it will start at index 3.
6.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What are the values in a after multAll(3) executes?
{1, 3, -5, -2}
{3, 9, -15, -6}
{2, 6, -10, -4}
The code will never stop executing due to an infinite loop
Answer explanation
This code multiplies each value in a by the passed amt which is 3 in this case.
7.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What are the values in a after mult(2) executes?
{1, 3, -5, -2}
{3, 9, -15, -6}
{2, 6, -10, -4}
The code will never stop executing due to an infinite loop
Answer explanation
The value of i is initialized to 0 and then never changes inside the body of the loop, so this loop will never stop. It is an infinite loop.
Create a free account and access millions of resources
Similar Resources on Wayground
32 questions
1.4.2 Data Structures

Quiz
•
12th Grade
27 questions
APCS Principles 24-25 Midterm review Questions

Quiz
•
10th Grade
25 questions
AP CSA Unit 1&2 Test

Quiz
•
8th Grade - Professio...
30 questions
Array Basics Quiz

Quiz
•
7th - 11th Grade
25 questions
1st Period Feb 22, 2024 - Virtual AP CompSci AP

Quiz
•
9th - 12th Grade
25 questions
10.sınıflar-Javascript-2.dönem

Quiz
•
10th Grade
25 questions
C++ arrays

Quiz
•
12th Grade
25 questions
C Programming Quiz

Quiz
•
12th Grade
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
Discover more resources for Computers
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
40 questions
LSHS Student Handbook Review: Pages 7-9

Quiz
•
11th Grade
10 questions
Characteristics of Life

Quiz
•
9th - 10th Grade
10 questions
Essential Lab Safety Practices

Interactive video
•
6th - 10th Grade
20 questions
Scalars, Vectors & Graphs

Quiz
•
11th Grade
62 questions
Spanish Speaking Countries, Capitals, and Locations

Quiz
•
9th - 12th Grade