Consider the following code segment.
int[] arr = {1, 2, 3, 4, 5};
Which of the following code segments would correctly set the first two elements of array arr to 10 so that the new value of array arr will be {10, 10, 3, 4, 5} ?
AP Computer Science A Unit 6 Lesson 1 (Introduction)
Quiz
•
Computers
•
10th - 12th Grade
•
Hard
Herman Galioulline
Used 34+ times
FREE Resource
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following code segment.
int[] arr = {1, 2, 3, 4, 5};
Which of the following code segments would correctly set the first two elements of array arr to 10 so that the new value of array arr will be {10, 10, 3, 4, 5} ?
arr[0] = 10;
arr[1] = 10;
arr[1] = 10;
arr[2] = 10;
arr[0, 1] = 10;
arr[1, 2] = 10;
arr = 10, 10, 3, 4, 5;
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
I only
II only
III only
I and II
I and III
3.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
int arr = {40, 30, 20, 10, 0};
System.out.println(getValue(arr, 1, 2));
int[] arr = {40, 30, 20, 10, 0};
System.out.println(getValue(arr, 1, 2));
int[] arr = {50, 40, 30, 20, 10};
System.out.println(getValue(arr, 1, 2));
int arr = {40, 30, 20, 10, 0};
System.out.println(getValue(arr, 2, 1));
int arr = {50, 40, 30, 20, 10};
System.out.println(getValue(arr, 2, 1));
4.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
int[] myArray = new int[4];
changeIt(myArray, 1, 5);
int[] myArray = new int[4];
changeIt(myArray, 2, 5);
int[] myArray = new int[4];
changeIt(myArray, 5, 1);
int[] myArray = new int[5];
changeIt(myArray, 1, 4);
int[] myArray = new int[5];
changeIt(myArray, 1, 5);
5.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
int[] array1 = {5, 2, 8, 6, 4, 3, 9};
int[] array2 = addNum(array1, 2, 4, 5);
int[] array1 = {-5, -5, 13, 0, 9, 0, 0};
int[] array2 = addNum(array1, 2, 4, 5);
int[] array1 = {5, 2, 8, 6, 4, 3, 9};
int[] array2 = addNum(array1, 3, 5, 5);
int[] array1 = {5, 8, 2, 4, 6, 3, 9};
int[] array2 = addNum(array1, 2, 4, 5);
int[] array1 = {0, -5, 8, 0, 9, 0, 0};
int[] array2 = addNum(array1, 2, 4, 5);
10 questions
Программирование C#
Quiz
•
1st - 10th Grade
10 questions
Белгіленген сипаттары бар элементті іздеу
Quiz
•
9th - 12th Grade
10 questions
Metode Array dalam JavaScript XI RPL 2
Quiz
•
11th Grade
10 questions
Introduction to Arrays
Quiz
•
KG - University
5 questions
2 D Arrays
Quiz
•
12th Grade
10 questions
Unit 6
Quiz
•
12th Grade
10 questions
Arrays
Quiz
•
10th - 12th Grade
10 questions
Programming
Quiz
•
1st - 10th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
17 questions
Parts of Speech
Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University