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

CS 170 Final Exam Study Guide || A+ Guaranteed.

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

What is the output of the following code? 1 for i in range(1, 11): 2 print (i, end = " ") A) 1 2 3 4 5 6 7 8 9 B) 1 2 3 4 5 6 7 8 9 10 C) 1 2 3 4 5 D) 1 3 5 7 9 correct answers B) 1 2 3 4 5 6 7 8 9 10 What is the output of the following code? 1 num = 5 2 for i in range(num, 15): 3 num += i 4 print(num) A) 10 B) 100 C) 99 D) 15 correct answers B) 100 What is the output of the following code? 1 y = 4 2 for i in range(y, 15): 3 y = i 4 print (y) A) 4 B) 14 C) 15 D) 13 E) Error, there is no output. correct answers B) 14 Consider the following code: 1 for i in range (1, 6): 2 print(i) 3 else: 4 print("The end.") What does the code output? A) 1 2 3 4 5

Vista previa del contenido

CS 170 Final Exam Study Guide || A+ Guaranteed.
What is the output of the following code?
1 for i in range(1, 11):
2 print (i, end = " ")

A) 1 2 3 4 5 6 7 8 9
B) 1 2 3 4 5 6 7 8 9 10
C) 1 2 3 4 5
D) 1 3 5 7 9 correct answers B) 1 2 3 4 5 6 7 8 9 10

What is the output of the following code?
1 num = 5
2 for i in range(num, 15):
3 num += i
4 print(num)

A) 10
B) 100
C) 99
D) 15 correct answers B) 100

What is the output of the following code?
1y=4
2 for i in range(y, 15):
3y=i
4 print (y)

A) 4
B) 14
C) 15
D) 13
E) Error, there is no output. correct answers B) 14

Consider the following code:
1 for i in range (1, 6):
2 print(i)
3 else:
4 print("The end.")

What does the code output?
A) 1
2
3
4
5

,The end.
B) 1
2
3
4
5
6
The end.
C) 1
2
3
4
5
D) The end. correct answers A) 1
2
3
4
5
The end.

Consider the following code:
1 for i in range(1, 6.0):
2 print(i)

Which of the following statements is true?
A) It runs fine and displays
1
2
3
4
5
B) There is an error because we cannot use 6.0 in the range.
C) It runs fine and displays
1
2
3
4
5
6 correct answers B) There is an error because we cannot use 6.0 in the range.

Consider the following code:
1i=0
2 while i < 3:
3 print("hi")
4i=i+1

, What's the output?
A) hi
hi
hi
B) hi
hi
C) hi
D) nothing correct answers A) hi
hi
hi

What's the output of the following code?
1 cnt = 0
2 while (cnt < 6):
3 cnt = cnt + 1
4 print(cnt, end="") correct answers 6

What's the output of the following code?
1 cnt = 0
2 while (cnt < 8):
3 cnt = cnt + 3
4 print(cnt, end="") correct answers 9

What is the output of the following code?
1 num = 0
2 sum = 0
3 while (num < 4):
4 sum = sum + num
5 num = num + 1
6 print(sum)

A) 0
B) 6
C) 2
D) 4 correct answers B) 6

What's the output from the following code segment when the input is
1
4
2
5
-2
3

1 cnt = 0
2t=0

Información del documento

Subido en
25 de marzo de 2025
Número de páginas
20
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$13.99

¿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.
SirAnton
3.7
(118)
Vendido
811
Seguidores
438
Artículos
40316
Última venta
1 semana 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