
Data Structures & Algorithms Quiz
Authored by John Alvin Omiles
Other
2nd Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
51 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following code snippet: int[] arr1 = {1, 2, 3}; int[] arr2 = new int[3]; arr2 = arr1; arr2[0] = 10 System.out.println(arr1[0]); What will the output be?
A) 1
B) 10
C) 0
D) An error will occur at runtime.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following code snippets will result in a compilation error?
A) Int[] numbers = new int[5]; numbers[0] = 1;
B) double[] fractions = {1.2, 2.4, 3.6}; System.out.println(fractions[2]);
C) char letters[] = new char[3]; letters[3] = 'A';
D) String[] names = new String[2]; names[0] = "Alice"; names[1] = 123;
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? int[] arr = {1, 2, 3, 4}; System.out.println(arr[arr.length - 1]);
A) 1
B) 4
C) 3
D) An error will occur
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Analyze the following code: String[] fruits = {"Apple", "Banana", "Orange"}; System.out.println(fruits[fruits.length]); What will happen when this code is executed?
A) It prints Orange.
B) It prints null.
C) An ArrayIndexOutOfBoundsException will be thrown.
D) It prints the length of the array.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Analyze the following scenario: If the base address in a 1D integer array arr is 2000, and each integer takes 4 bytes, what will be the address of the 5th element (arr[4])?
A) 2004
B) 2020
C) 2016
D) 2008
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Identify the issue in the following computed addressing formula in a 1D Array: Address = Base Address + (Index + 1) * Element Size
A) It will compute the wrong address for the first element.
B) It skips over even elements.
C) It results in a runtime error for negative indices.
D) It correctly computes addresses for all elements.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If ArrayKo is an integer array having 6 elements with a base address of 1000, and each integer occupies 2 bytes, what happens if you try to access A[6]?
A) It will access memory at address 1012.
B) It will access memory at address 1016.
C) It will result in an out-of-bounds error if the array has more than 6 elements.
D) It will access memory at address 1018.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
50 questions
Prelim Review (Applied Economics)
Quiz
•
1st - 10th Grade
48 questions
Introduction to the Stock Market
Quiz
•
KG - University
50 questions
Minecraft
Quiz
•
2nd Grade - Professio...
50 questions
Revision
Quiz
•
2nd - 3rd Grade
50 questions
ILMU PELAYARAN DATAR Il
Quiz
•
2nd Grade
50 questions
Quiz Seleksi Putra Putri SD Negeri Unggulan Magetan 2025-2026
Quiz
•
1st - 5th Grade
50 questions
Spelling Bee 3rd-4th #12 (words 551-600)
Quiz
•
1st - 5th Grade
50 questions
Discover! 1: The Sky
Quiz
•
1st - 5th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
Discover more resources for Other
22 questions
Equal Groups and Arrays
Quiz
•
2nd Grade
10 questions
Life Cycle of a Frog
Quiz
•
1st - 2nd Grade
10 questions
Exploring Rosa Parks and Black History Month
Interactive video
•
1st - 5th Grade
20 questions
Counting Coins
Quiz
•
2nd Grade
20 questions
Place Value
Quiz
•
KG - 3rd Grade
30 questions
DA Math Mania Bowl - Primary
Quiz
•
2nd Grade
19 questions
Subject-Verb Agreement
Quiz
•
2nd - 5th Grade
10 questions
Harriet Tubman
Quiz
•
2nd - 3rd Grade