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

python control strucures questions with correct answers.

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

python control structures

Vista previa del contenido

Python Control Structures Quiz

1. What is the last thing printed by the following program?

start = 30 stop = 10 for I in range(start, stop - 1, -5): if I % 2 == 0: print(I *

2) else: print(I): 20

2. We want to simulate constantly flipping a coin until we get 3 heads in a

row. What kind of loop should we use?: While Loop

3. How many times will the following program print "hello"?: This code will loop

infinitely

4. The following code continually asks the user for a password until they

guess the correct password, then ends. But there is one problem.: Add a break; statement

after line 6 so that the program doesn't loop infinitely

5. What will the following program print when

run? for j in range(2): for I in range(6, 4, -1):

print (): 6

5

6

1/
6

, 5

6. What is the value of the Boolean variable can_ vote at the end of this

program?



age = 17 is _citizen = True can _vote = age >= 18 and is citizen: False

7. What will be the output of this program?




number = 5 greater_ than _zero = number > 0 if greater_ than _zero:

print(number): 5

8. What will be the output of this program?




number = 5 greater than zero = number > 0 if greater than zero: if number >

5: print(number): Nothing will print

9. What is printed by the following program?




Is raining = False is _cloudy = False is_ sunny = not is _raining and not is_ cloudy

is _summer = False is_ warm = is _sunny or is _summer print("Is it warm: " +
2/
6

Información del documento

Subido en
25 de marzo de 2026
Número de páginas
6
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$12.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

Seller avatar
smartthinker1
4.0
(2)
Vendido
4
Seguidores
3
Artículos
967
Última venta
1 año 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