Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 2 fuera de 12 páginas
Examen

CMN 152V POST-MIDTERM EXAM QUESTIONS WITH CORRECT ANSWERS LATEST UPDATE 2026

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

CMN 152V POST-MIDTERM EXAM QUESTIONS WITH CORRECT ANSWERS LATEST UPDATE 2026 loopcond1 — try it For ages below, which version of over21 will run without producing an error? ages = [ 18, 24, 22, 17, 20, 21, 19, 18, 20, 25 ] over21_1 = [ (age 21) for age in ages ] over21_2 = [ age for age in ages if (age 21)] over21_1 over21_2 Both Neither - Answers both loopcond2 — try it For ages below, which version of over21 will produce a list of numbers? ages = [ 18, 24, 22, 17, 20, 21, 19, 18, 20, 25 ] over21_1 = [ (age 21) for age in ages ] over21_2 = [ age for age in ages if (age 21)] over21_1 over21_2 Both Neither - Answers over21_2 loopcond3 — try it For ages below, which version of over21 will produce a list as long as ages? ages = [ 18, 24, 22, 17, 20, 21, 19, 18, 20, 25 ] over21_1 = [ (age 21) for age in ages ] over21_2 = [ age for age in ages if (age 21)] over21_1 over21_2 Both Neither - Answers over21_1 loopcond4 — try it Select the option that will produce a list equal to outlist from list inlist inlist = [ 'pinch', 'punch', 'paunch', 'inch', 'cinch', 'wrench' ] outlist = [ 'pinch', 'inch', 'cinch'] 1 [ aword[-5:] == 'inch' for aword in inlist ] 2 [ aword[-4:] == 'inch' for aword in inlist ] 3 [ inchword for inchword in inlist if inchword[-5:] == 'inch' ] 4 [ inchword for inchword in inlist if inchword[-4:] == 'inch' ] 5 [ inch[-5:] for inch in inlist if inch[-5:] == 'nch' ] 6 [ inch[-4:] for inch in inlist if inch[-4:] == 'nch' ] 7 None of the above - Answers 4 loopcond5 — try it Select the option that will not produce a list equal to outlist from list inlist inlist = [ 'pinch', 'punch', 'paunch', 'inch', 'cinch', 'wrench' ] outlist = [ 'pinch', 'punch', 'paunch', 'inch', 'cinch', 'wrench' ] 1 [ element for element in inlist if element[-5:-1] == 'inch' ] 2 [ words for words in inlist ] 3 [ val[:] for val in inlist ] - Answers 1 loopcond6 — try it Select the option that will produce a list equal to outlist from list inlist inlist = [ 'aardvark', 'apogee', 'ape', 'open', 'oar', 'ocean' ] outlist = [ 'aardvark', 'oar' ] 1 [ item[2] == 'a' for item in inlist] 2 [ item for item in inlist if item[0] == 'a' ] 3 [ item for item in inlist if item[1] == 'a' ] 4 [ item for item in inlist if item[2] == 'a' ] 5 None of the above - Answers 3 loopcond7 — try it Select the option that shows the value of list cantvote ages = [ 5, 16, 18, 22, 26, 22, 19, 30, 17, 13, 20, 10 ] cantvote = [ age for age in ages if age 18 ] candrivecantvote = [ age for age in ages if age = 16 ] print( candrivecantvote ) 1 [ 5, 16, 18, 22, 26, 22, 19, 30, 17, 13, 20, 10 ] 2 [ 5, 16, 18, 19, 17, 13, 10 ] 3 [ 5, 16, 18, 17, 13, 10 ] 4 None of the above - Answers 4 loopcond8 — try it Select the option that shows the value of list candrivecantvote ages = [ 5, 16, 18, 22, 26, 22, 19, 30, 17, 13, 20, 10 ]

Vista previa del contenido

CMN 152V POST-MIDTERM EXAM QUESTIONS WITH CORRECT ANSWERS LATEST UPDATE 2026

loopcond1 — try it
For ages below, which version of over21 will run without producing an error?
ages = [ 18, 24, 22, 17, 20, 21, 19, 18, 20, 25 ]
over21_1 = [ (age > 21) for age in ages ]
over21_2 = [ age for age in ages if (age > 21)]

over21_1
over21_2
Both
Neither - Answers both
loopcond2 — try it
For ages below, which version of over21 will produce a list of numbers?
ages = [ 18, 24, 22, 17, 20, 21, 19, 18, 20, 25 ]
over21_1 = [ (age > 21) for age in ages ]
over21_2 = [ age for age in ages if (age > 21)]

over21_1
over21_2
Both
Neither - Answers over21_2
loopcond3 — try it
For ages below, which version of over21 will produce a list as long as ages?
ages = [ 18, 24, 22, 17, 20, 21, 19, 18, 20, 25 ]
over21_1 = [ (age > 21) for age in ages ]
over21_2 = [ age for age in ages if (age > 21)]

over21_1
over21_2
Both
Neither - Answers over21_1
loopcond4 — try it
Select the option that will produce a list equal to outlist from list inlist
inlist = [ 'pinch', 'punch', 'paunch', 'inch', 'cinch', 'wrench' ]
outlist = [ 'pinch', 'inch', 'cinch']

1 [ aword[-5:] == 'inch' for aword in inlist ]
2 [ aword[-4:] == 'inch' for aword in inlist ]
3 [ inchword for inchword in inlist if inchword[-5:] == 'inch' ]
4 [ inchword for inchword in inlist if inchword[-4:] == 'inch' ]
5 [ inch[-5:] for inch in inlist if inch[-5:] == 'nch' ]
6 [ inch[-4:] for inch in inlist if inch[-4:] == 'nch' ]
7 None of the above - Answers 4
loopcond5 — try it
Select the option that will not produce a list equal to outlist from list inlist
inlist = [ 'pinch', 'punch', 'paunch', 'inch', 'cinch', 'wrench' ]
outlist = [ 'pinch', 'punch', 'paunch', 'inch', 'cinch', 'wrench' ]

1 [ element for element in inlist if element[-5:-1] == 'inch' ]
2 [ words for words in inlist ]
3 [ val[:] for val in inlist ] - Answers 1
loopcond6 — try it
Select the option that will produce a list equal to outlist from list inlist
inlist = [ 'aardvark', 'apogee', 'ape', 'open', 'oar', 'ocean' ]
outlist = [ 'aardvark', 'oar' ]

, 1 [ item[2] == 'a' for item in inlist]
2 [ item for item in inlist if item[0] == 'a' ]
3 [ item for item in inlist if item[1] == 'a' ]
4 [ item for item in inlist if item[2] == 'a' ]
5 None of the above - Answers 3
loopcond7 — try it
Select the option that shows the value of list cantvote
ages = [ 5, 16, 18, 22, 26, 22, 19, 30, 17, 13, 20, 10 ]
cantvote = [ age for age in ages if age < 18 ]
candrivecantvote = [ age for age in ages if age >= 16 ]
print( candrivecantvote )

1 [ 5, 16, 18, 22, 26, 22, 19, 30, 17, 13, 20, 10 ]
2 [ 5, 16, 18, 19, 17, 13, 10 ]
3 [ 5, 16, 18, 17, 13, 10 ]
4 None of the above - Answers 4
loopcond8 — try it
Select the option that shows the value of list candrivecantvote
ages = [ 5, 16, 18, 22, 26, 22, 19, 30, 17, 13, 20, 10 ]
cantvote = [ age for age in ages if age < 18 ]
candrivecantvote = [ age for age in ages if age >= 16 ]
print( candrivecantvote )

[ 5, 16, 18, 22, 26, 22, 19, 30, 17, 13, 20, 10 ]
[ 5, 16, 18, 19, 17, 13, 10 ]
[ 5, 16, 18, 17, 13, 10 ]
[ 16, 17, 13 ]
[ 16, 17 ]
[ 16 ]
None of the above - Answers none of the above
iflong1 — try it
Select the option that shows the number of lines of printed output that will be produced by the code
below.
weather = 'sunny'
if weather != 'sunny':
print( 'Might need raincoat' )

1
2
3
4
5
0
Error - Answers 0
iflong2 — try it
Select the option that shows the number of lines of printed output that will be produced by the code
below.
if True
print( 'This gets printed' )

1
2
3
4
5
0
Error - Answers error

Información del documento

Subido en
2 de febrero de 2026
Número de páginas
12
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$11.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.
joshuawesonga22
3.4
(12)
Vendido
114
Seguidores
2
Artículos
15009
Ú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