• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 9 páginas
Examen

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

Document preview thumbnail
Vista previa 2 fuera de 9 páginas

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

Vista previa del contenido

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

Información del documento

Subido en
25 de octubre de 2025
Número de páginas
9
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$12.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Schopenhauer
4.7
(11)
Vendido
46
Seguidores
0
Artículos
3519
Última venta
6 días hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes