• ¿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 13 páginas
Examen

Java Programming EXAM 2 100% ACCURATE!!

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

CH 6 - ANSWER A structure that allows repeated execution of a block of statements is a ___________. - ANSWERloop A loop that never ends is a(n) ___________ loop - ANSWERinfinite To construct a loop that works correctly, you should initialize a loop control ___________. - ANSWERvariable What is the output of the following code? b = 1; while(b 4) S(b + " "); - ANSWER1 1 1 1 1 1... Why? - ANSWERWhen b is 1, the comparison in the while statement is true, so 1 prints. The comparison is made again, it is still true (because b is still 1), and 1 prints again. The value 1 prints infinitely because b is never altered. What is the output of the following code? b = 1; while(b 4) { S(b + " "); b = b + 1; } - ANSWER1 2 3

Vista previa del contenido

Java Programming EXAM 2 100% ACCURATE!!

CH 6 - ANSWER



A structure that allows repeated execution of a block of statements is a ___________. - ANSWERloop



A loop that never ends is a(n) ___________ loop - ANSWERinfinite



To construct a loop that works correctly, you should initialize a loop control ___________. -
ANSWERvariable



What is the output of the following code?

b = 1;

while(b < 4)

System.out.print(b + " "); - ANSWER1 1 1 1 1 1...



Why? - ANSWERWhen b is 1, the comparison in the while statement is true, so 1 prints. The
comparison is made

again, it is still true (because b is still 1), and 1 prints again. The value 1 prints infinitely

because b is never altered.



What is the output of the following code?

b = 1;

while(b < 4)

{

System.out.print(b + " ");

b = b + 1;

} - ANSWER1 2 3



Why?? - ANSWERWhen b is 1, the comparison in the while statement is true, so 1 is output. Then b
becomes 2,

, the Boolean evaluation is still true, and 2 is output. The b becomes 3, the Boolean evaluation is

true and 3 is output. Then b becomes 4, the Boolean expression is false, and the loop ends.



What is the output of the following code?

e = 1;

while(e < 4);

System.out.print(e + " "); - ANSWERnothing



WHYY - ANSWERThe semicolon at the end of the second line creates an empty loop body. The value
of e remains

1 forever; it keeps being compared to 4 infinitely



If total = 100 and amt = 200, then after the statement total += amt, ___________. - ANSWERtotal is
equal to 300



whyyyy - ANSWERThe statement total += amt is equivalent to total = total + amt



The prefix ++ is a ___________ operator. - ANSWERa. unary



If g = 5, then after h = ++g, the value of h is ___________. - ANSWER6



If m = 9, then after n = m++, the value of m is ___________. - ANSWER10



why? - ANSWERThe variable n receives the value of m prior to incrementing



If j = 5 and k = 6, then the value of j++ == k is ___________. - ANSWERfalse



whyyyyyyyyyy - ANSWERThe value of j++ is 5, so it does not equal k. After this statement executes, j
will be 6, but that

will be after the value of this comparison has been determined.



You must always include ___________ in a for loop's parentheses - ANSWER2 semicolons

Información del documento

Subido en
2 de agosto de 2024
Número de páginas
13
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$15.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.
papersmaster01
3.9
(74)
Vendido
310
Seguidores
106
Artículos
14769
Última venta
2 semanas 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