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

Python 2 exam questions and answers

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

Python 2 exam questions and answers When a program needs to save data for later use, it writes the data in a(n) _______________. - ANSWERS-file A(n) _______________ is an object that holds multiple unique items of data in an unordered manner. - ANSWERS-set The built-in function _______________ returns the length of a sequence. - ANSWERS-len() A(n) _______________ is a span of items that are taken from a sequence. - ANSWERS-slice The third number in string slicing brackets or in the range() function represents the _______________ value. - ANSWERS-step or increment Assume namesList contains a list of names (as strings). Write a for-loop that walks over the list and prints out all the names. - ANSWERS-for n in namesList: print(n) What are the valid indexes for the string 'New York'? a. 0 through 7 b. 0 through 8 c. -1 through -8 d. -1 through 6 - ANSWERS-0 through 7

Vista previa del contenido

Python 2 exam questions and
answers5

When a program needs to save data for later use, it writes the data in a(n) _______________. -
ANSWERS-file



A(n) _______________ is an object that holds multiple unique items of data in an unordered

manner. - ANSWERS-set



The built-in function _______________ returns the length of a sequence. - ANSWERS-len()



A(n) _______________ is a span of items that are taken from a sequence. - ANSWERS-slice



The third number in string slicing brackets or in the range() function represents the

_______________ value. - ANSWERS-step or increment



Assume namesList contains a list of names (as strings). Write a for-loop that walks over the list

and prints out all the names. - ANSWERS-for n in namesList:

print(n)



What are the valid indexes for the string 'New York'?

a. 0 through 7

b. 0 through 8

c. -1 through -8

d. -1 through 6 - ANSWERS-0 through 7

, What statement can be used to handle some of the run-time errors in a program?

a. exception statement

b. try statement

c. try/except statement

d. exception handler statement - ANSWERS-try/except statement



Which method would you use to returns all the elements in the dictionary as a list of tuples?

a. list

b. items

c. pop

d. keys - ANSWERS-items



Which step creates a connection between a file and a program?

a. Open the file.

b. Read the file.

c. Process the file.

d. Close the file. - ANSWERS-open the file



What will be assigned to s_string after the execution of the following code?

special = '1337 Country Ln.'

s_string = special[ :4]

a. '1357'

b. 'Country Ln.'

c. ' Country Ln.'

d. Invalid code - ANSWERS-'1357'

Información del documento

Subido en
15 de noviembre de 2025
Número de páginas
5
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$10.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.
Bensuda
3.7
(168)
Vendido
919
Seguidores
445
Artículos
23117
Ú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