1. Which of the following declares an array of integers?

CC 102-Computer Programming I

Quiz
•
Computers
•
Professional Development
•
Medium
John Marpa
Used 2+ times
FREE Resource
18 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
10 sec • 2 pts
A. int array;
B. int[] array;
C. int array[];
D. Both B and C
2.
MULTIPLE CHOICE QUESTION
10 sec • 2 pts
2. What is the index of the first element in an array?
A. -1
B. 0
C. 1
D. None of the above
3.
MULTIPLE CHOICE QUESTION
10 sec • 2 pts
How can you access the length of an array arr?
A. arr.size
B. arr.length
C. arr.length()
D. arr.getSize()
4.
MULTIPLE CHOICE QUESTION
10 sec • 2 pts
What will happen if you try to access an array index that is out of bounds?
A. The program will run normally.
B. An ArrayIndexOutOfBoundsException will be thrown.
C. The program will skip that index.
D. None of the above
5.
MULTIPLE CHOICE QUESTION
20 sec • 2 pts
What will this code print?
int[] arr = {10, 20, 30, 40, 50};
System.out.println(arr[2]);
10
20
30
40
6.
MULTIPLE CHOICE QUESTION
20 sec • 2 pts
Which of these is a valid for loop to iterate over an array arr?
A. for (int i : arr)
B. for (int i = 0; i < arr.length; i++)
C. for (int i = 0; i <= arr.length; i++)
D. Both A and B
7.
MULTIPLE CHOICE QUESTION
20 sec • 2 pts
Given int[] arr = {5, 10, 15};,
what does System.out.println(arr.length); output?
2
3
4
5
Create a free account and access millions of resources
Similar Resources on Quizizz
16 questions
Think it through

Quiz
•
University - Professi...
16 questions
Final Assessment

Quiz
•
Professional Development
15 questions
BrightChamps Technical Round - C language

Quiz
•
Professional Development
20 questions
first round quiz

Quiz
•
Professional Development
17 questions
Java Basics

Quiz
•
Professional Development
20 questions
Data Structure

Quiz
•
Professional Development
16 questions
JavaScript ( review I )

Quiz
•
Professional Development
20 questions
CodeHS - Intro to Python - Basics and Console Interaction

Quiz
•
9th Grade - Professio...
Popular Resources on Quizizz
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