• ¿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 3 fuera de 21 páginas
Examen

Codehs Midterm Exam Questions With Answers

Document preview thumbnail
Vista previa 3 fuera de 21 páginas

CodeHs Midterm EXAM QUESTIONS WITH ANSWERS

Vista previa del contenido

CodeHs Midterm EXAM |\ |\ |\




QUESTIONS WITH ANSWERS |\ |\




What is the output of this program?
|\ |\ |\ |\ |\ |\




int sum = 1;
|\ |\ |\ |\




System.out.println("Welcome to the adding machine!"); |\ |\ |\ |\ |\




while(sum < 10) |\ |\ |\




{ |\




|\ sum += sum;
|\ |\ |\




|\ System.out.println(sum); |\




} - CORRECT ANSWERS ✔✔Welcome to the adding
|\ |\ |\ |\ |\ |\ |\ |\



machine! {Unit 2} |\ |\




2
4
8
16


What is the output of this for loop?
|\ |\ |\ |\ |\ |\ |\




for(int i = 0; i < 100; i += 2)
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\




{ |\




|\ System.out.println(i); |\

,} - CORRECT ANSWERS ✔✔The even numbers from 0 to
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\



98, inclusive {Unit 2}
|\ |\ |\




What is the proper syntax to initialize a double called
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\



temperature to have the value 70.4? - CORRECT |\ |\ |\ |\ |\ |\ |\ |\



ANSWERS ✔✔double temperature = 70.4; {Unit 2} |\ |\ |\ |\ |\ |\




Which of the following is not a primitive type? - CORRECT
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\



ANSWERS ✔✔String {Unit 2} |\ |\ |\




What in this code segment could potentially cause a bug
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\



in our program?
|\ |\




String myString = readLine("What is your name?");
|\ |\ |\ |\ |\ |\ |\




if (myString == "Karel")
|\ |\ |\ |\




{ |\




|\ System.out.println("Hi Karel!"); |\ |\




} |\




else |\




{ |\




|\ System.out.println("You're not Karel!"); |\ |\ |\




} - CORRECT ANSWERS ✔✔Comparing Strings with ==
|\ |\ |\ |\ |\ |\ |\ |\



instead of the .equals method. {Unit 2} |\ |\ |\ |\ |\ |\

, Which of these is not a logical operator? - CORRECT
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\



ANSWERS ✔✔++ {Unit 2} |\ |\ |\




What is the output of this for loop?
|\ |\ |\ |\ |\ |\ |\




for(int i = 10; i > 2; i -= 3) |\ |\ |\ |\ |\ |\ |\ |\ |\ |\




{ |\




|\ System.out.println(i); |\




} - CORRECT ANSWERS ✔✔10
|\ |\ |\ |\




7
4
{Unit 2} |\




What will the values of x and y be after this code segment
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\



runs?
|\




int x = 100; int y = 100; if (x <= 100)
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\




{ |\




|\ if (y > 100)
|\ |\ |\




|\ { |\




|\ x = 200;
|\ |\ |\




|\ } |\




|\ else |\




|\ {

Información del documento

Subido en
20 de marzo de 2026
Número de páginas
21
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$22.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.
EXAMSTUDYPLUG
4.5
(242)
Vendido
394
Seguidores
107
Artículos
21100
Última venta
5 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