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

Python Exam 1 Questions Correctly Answered.

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

Python Exam 1 Questions Correctly Answered. What is the output of: 11.0//2 - CORRECT ANSWER 5.0 Floor division to the nearest whole number Returns a float What is the output of: 11//2 - CORRECT ANSWER 5 Return an int What is the output of: 11/2 - CORRECT ANSWER 5.5 Returns a float What is the output of: 11/2.0 - CORRECT ANSWER 5.0 What is the output of: 20%2 - CORRECT ANSWER 0 What is the output of: 21%2 - CORRECT ANSWER 1 What is the output of: 11%3 - CORRECT ANSWER 2 x = 'Texas A&M University' x [-3] = ? - CORRECT ANSWER i x = 'Texas A&M University' x [3] = ? - CORRECT ANSWER a x = 'Texas A&M University' len(x) = ? - CORRECT ANSWER 20 x = 'Texas A&M University' x [0:5:2] = ? - CORRECT ANSWER Txs It starts at 0 and ends at 5, incremented by 2 x = 'Texas A&M University' x [4:] = ? - CORRECT ANSWER s A&M University x = 'Texas A&M University' x [:4] = ? - CORRECT ANSWER Texa x = 'Texas A&M University' 'A' in x = ? - CORRECT ANSWER True Acts as a Boolean, determines if it is in the string x = 'Texas A&M University' 't' in x = ? - CORRECT ANSWER True x = 'Texas A&M University' 'A&M' in x = ? - CORRECT ANSWER True x = 'Texas A&M University' ' ' in x = ? - CORRECT ANSWER True x = 'Texas A&M University' ' ' in x = ? - CORRECT ANSWER False 2**1+1 - CORRECT ANSWER 3 3* 1**3 - CORRECT ANSWER 3 2*(3+1) - CORRECT ANSWER 4 6+4/2 - CORRECT ANSWER 8.0 Returns a float due to the division len('Hello world') = ? - CORRECT ANSWER 11 Be sure to count the spaces as values int(-2.3) = ? - CORRECT ANSWER -2 float(32) = ? - CORRECT ANSWER 32.0 str(3.14159) = ? - CORRECT ANSWER 3.14159 [0] * 4 = ? - CORRECT ANSWER [0, 0, 0, 0] [1, 2, 3] * 3 = ? - CORRECT ANSWER [ 1, 2, 3, 1, 2, 3, 1, 2, 3] x = 1 y = 0 x = 2 and (x/y) 2 = ? - CORRECT ANSWER False x = 6 y = 2 x = 2 and (x/y) 2 = ? - CORRECT ANSWER True x = 1 y = 0 x = 2 and y != 0 and (x/y) 2 = ? - CORRECT ANSWER False What is the purpose of the "def" keyword in Python? - CORRECT ANSWER It indicates that start of a function It indicates that the follow indented section of code id to be stored for later What will the following Python program print out? def fred(): - print ("Zap") def jane(): - print ("ABC") jane() fred() jane() - CORRECT ANSWER ABC Zap ABC What will the following Python program print out? count = 0 for number in [3, 41, 12, 9, 74, 15]: - count = count + 1 print('Count: ', count) - CORRECT ANSWER Count: 6 What will the following Python program print out? total = 0 for number in [3, 41, 12, 9, 74, 15]: - total = total + number print('Total: ', total) - CORRECT ANSWER 154 It will add all of the numbers together What will the following Python program print out? cheeses = ['Cheddar', 'Edam', 'Gouda'] 'Edam' in cheeses - CORRECT ANSWER True What will the following Python program print out? count = 0

Vista previa del contenido

Python Exam 1 Questions Correctly
Answered.

What is the output of: 11.0//2 - CORRECT ANSWER 5.0

Floor division to the nearest whole number

Returns a float



What is the output of: 11//2 - CORRECT ANSWER 5

Return an int



What is the output of: 11/2 - CORRECT ANSWER 5.5

Returns a float



What is the output of: 11/2.0 - CORRECT ANSWER 5.0



What is the output of: 20%2 - CORRECT ANSWER 0



What is the output of: 21%2 - CORRECT ANSWER 1



What is the output of: 11%3 - CORRECT ANSWER 2



x = 'Texas A&M University'

x [-3] = ? - CORRECT ANSWER i



x = 'Texas A&M University'

x [3] = ? - CORRECT ANSWER a

,x = 'Texas A&M University'

len(x) = ? - CORRECT ANSWER 20



x = 'Texas A&M University'

x [0:5:2] = ? - CORRECT ANSWER Txs

It starts at 0 and ends at 5, incremented by 2



x = 'Texas A&M University'

x [4:] = ? - CORRECT ANSWER s A&M University



x = 'Texas A&M University'

x [:4] = ? - CORRECT ANSWER Texa



x = 'Texas A&M University'

'A' in x = ? - CORRECT ANSWER True

Acts as a Boolean, determines if it is in the string



x = 'Texas A&M University'

't' in x = ? - CORRECT ANSWER True



x = 'Texas A&M University'

'A&M' in x = ? - CORRECT ANSWER True



x = 'Texas A&M University'

' ' in x = ? - CORRECT ANSWER True



x = 'Texas A&M University'

' ' in x = ? - CORRECT ANSWER False

, 2**1+1 - CORRECT ANSWER 3



3* 1**3 - CORRECT ANSWER 3



2*(3+1) - CORRECT ANSWER 4



6+4/2 - CORRECT ANSWER 8.0

Returns a float due to the division



len('Hello world') = ? - CORRECT ANSWER 11

Be sure to count the spaces as values



int(-2.3) = ? - CORRECT ANSWER -2



float(32) = ? - CORRECT ANSWER 32.0



str(3.14159) = ? - CORRECT ANSWER 3.14159



[0] * 4 = ? - CORRECT ANSWER [0, 0, 0, 0]



[1, 2, 3] * 3 = ? - CORRECT ANSWER [ 1, 2, 3, 1, 2, 3, 1, 2, 3]



x=1

y=0

x >= 2 and (x/y) >2 = ? - CORRECT ANSWER False



x=6

y=2

x >= 2 and (x/y) >2 = ? - CORRECT ANSWER True

Información del documento

Subido en
6 de abril de 2025
Número de páginas
22
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$13.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.
ROSEGRADES
3.4
(35)
Vendido
236
Seguidores
87
Artículos
12121
Última venta
4 semanas 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