• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 9 pages
Exam (elaborations)

CSE 1223 Intro to Computer Programming in Java Midterm II Practice Guide

Document preview thumbnail
Preview 2 out of 9 pages

CSE 1223 Intro to Computer Programming in Java Midterm II Practice Guide

Content preview

CSE 1223 Intro to Computer Programming in Java
Midterm II Practice Guide 2025-2026
1. Declaring an array double [] temperature;
int [] scores;
boolean [] answers;
String [] names;

2. Allocating an array temperatures = new double [10];
scores = new int [20];
answers = new boolean [5];
names = new String [15];

3. Accessing array ele- temperatures [2];
ments

4. how do you find the temperatures.length;
number of elements in
an array

5. Declare and allocate an int [] a = new int [10];
array of 10 integers and
call it a

6. Write a loop that initial- int [] a = new int [10];
izes the 10 elements of for (int i = 1; i < a.length; i++){
the array to the integers a[i] = i+1;
1, 2, 3, 4, 5, 6, 7, 8, 9, }
10

7. Write a loop that outputs for (int k = 0; k < a.length; k++){
the elements of the System.out.println(a[(a.length-1)-k]);
array, one per line, in re- }
verse order
the last element is a[(a.length - 1)]


1/9

, CSE 1223 Intro to Computer Programming in Java
Midterm II Practice Guide 2025-2026
length is 10
last element index is 9

8. Write a program private static void printRectangle (int w, int h){
segment—using for for (int i = 0; i<h; i++){
loops— for (int j = 0; j<w; j++){
that given two integer System.out.print('+');
variables, width and }
height, outputs a rectan- System.out.println();
gle of '+'s of the given }
width and height. }

9. Arrays in java are objects

10. Arrays hold a reference to an array object

11. Declaring an array list ArrayList<String> stringList = new ArrayList<String>();

12. We want code that reads import java.util.ArrayList;
in text one line at a time ...
until the user enters the public static void main(String [] args) {
word "stop" ArrayList<String> stringList = new ArrayList<String>();
Then the code should re- Scanner keyboard = new Scanner(System.in);
peat back all of the lines String input = "";
in reverse order while (!input.equals("stop")) {
We do not know how input = keyboard.nextLine();
many lines of text there stringList.add(input);
will }
be before we start int i = stringList.size()-1;
while (i>0) {
System.out.println(stringList.get(i));
i = i - 1;


2/9

Document information

Uploaded on
October 25, 2025
Number of pages
9
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$12.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Schopenhauer
4.7
(11)
Sold
46
Followers
0
Items
3519
Last sold
6 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions