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

D278 Practice Exam 3 Questions with Verified Correct Answers

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

D278 Practice Exam 3 Questions with Verified Correct Answers

Vista previa del contenido

D278 Practice Exam 3 Questions with Verified

Correct Answers

A program runs: x = 10; y = x; x = 20. What is the final value of y?

10

A program runs: a = 5; b = 3; a = b; b = a. What is the final value of b?

3

A program tracks the average GPA of a class. Which data type should be used?

Float

A program tracks the number of times a button has been clicked. Which data type should be
used?

Integer

A program needs to store whether a user is logged in. Which data type should be used?

Boolean

Given integer a = 9 and integer b = 4. What is the value of a / b?

2

Given integer a = 9 and integer b = 4. What is the value of a % b?

1

Given integer a = 9 and integer b = 4. What is the value of (a + b) / 2?

6

Given float p = 7.0 and integer q = 2. What is the value of p / q?

3.5

A program checks if userAge is exactly 18 OR exactly 21. Which expression captures this?

(userAge == 18) or (userAge == 21)

A program checks if temperature is below 32 OR above 100. Which expression captures this?

, (temp < 32) or (temp > 100)

Why should a programmer use a constant instead of a regular variable for the value of pi?

The value should not change during program execution

A program has logic: if score >= 90 Put "A"; elseif score >= 80 Put "B"; elseif score >= 70 Put
"C"; else Put "F". What is output if score = 85?

B

A program has logic: if x > 0 then y = 1; if x > 10 then y = 2; if x > 100 then y = 3. Given x = 50,
what is the final value of y?

2

A delivery service: if weight > 100 then fee = 50, else fee = 20. If weight is exactly 100, which
branch executes?

else (false) branch

A program runs: i = 10; while i > 0; Put i; i = i - 2. How many times does the loop iterate?

5

A program runs: i = 1; while i < 20; i = i * 2. How many times does the loop iterate?

5

A program runs: count = 0; while count < 3; Put "Hi"; count = count + 1. What is the output?

HiHiHi

A program runs: x = 5; do; Put x; x = x - 1; while x > 5. What is the output?

5

Why does a do-while loop always execute its body at least once?

The condition is checked after the body executes

A program needs to process exactly each item in a 20-element array. Which loop is preferred?

For loop

A scores array has 10 elements with valid indices 0 to 9. A programmer writes scores[10] = 95.
What happens?

Out-of-bounds error (index 10 is invalid)

Información del documento

Subido en
18 de septiembre de 2026
Número de páginas
7
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$24.89

¿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

Vendido
0
Seguidores
0
Artículos
300
Última venta
-




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