Quiz de Programação em Python
Quiz
•
Computers
•
Professional Development
•
Hard
Cezar Augusto Trevisan
FREE Resource
Enhance your content
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
15 mins • 10 pts
`def quadrado(x): return x^2`
`def quadrado(x): return x**2`
`function quadrado(x): return x*x`
`def quadrado(x) { return x*x }`
Answer explanation
A função correta para retornar o quadrado de x em Python é `def quadrado(x): return x**2`, pois `**` é o operador de exponenciação. As outras opções estão incorretas por usar operadores ou sintaxes inválidas.
2.
MULTIPLE CHOICE QUESTION
15 mins • 10 pts
Qual é o valor de 3 * (2 + 4) // 5
em Python?
1.2
3
2
0
Answer explanation
Para calcular o valor de 3 * (2 + 4) // 5, primeiro resolvemos a expressão dentro dos parênteses: 2 + 4 = 6. Depois, multiplicamos: 3 * 6 = 18. Por fim, aplicamos a divisão inteira: 18 // 5 = 3. Portanto, a resposta correta é 2.
3.
MULTIPLE CHOICE QUESTION
15 mins • 10 pts
Qual destas é uma lista em Python?
`{1, 2, 3, 4}`
`[1, 2, 3, 4]`
`(1, 2, 3, 4)`
`<1, 2, 3, 4>`
Answer explanation
A lista em Python é definida por colchetes. Portanto, a opção `[1, 2, 3, 4]` é a única lista válida. As outras opções representam um conjunto (`{}`), uma tupla (`()`) e uma sintaxe inválida (`<>`).
4.
MULTIPLE CHOICE QUESTION
15 mins • 10 pts
Qual comando importa o módulo math em Python?
`import math`
`include math`
`using math`
`require math`
Answer explanation
O comando correto para importar o módulo math em Python é `import math`. As outras opções, como `include`, `using` e `require`, não são válidas na sintaxe do Python.
5.
MULTIPLE CHOICE QUESTION
15 mins • 10 pts
O que será impresso pelo código abaixo? ```python x = [1, 2, 3] print(x[-1]) ```
`IndexError`
Answer explanation
O código acessa o último elemento da lista 'x' usando o índice -1, que se refere ao último item. Portanto, 'x[-1]' retorna 3, que é o valor correto a ser impresso.
6.
MULTIPLE CHOICE QUESTION
15 mins • 10 pts
Como abrir o arquivo "dados.txt" para leitura em Python?
`open("dados.txt", "r")`
`open("dados.txt", "w")`
`open("dados.txt", "a")`
`open("dados.txt", "x")`
Answer explanation
A opção correta para abrir o arquivo 'dados.txt' para leitura em Python é `open("dados.txt", "r")`. As outras opções servem para escrita, anexação ou criação de arquivos, não para leitura.
7.
MULTIPLE CHOICE QUESTION
15 mins • 10 pts
Qual será a saída deste código Python? ```python for i in range(2, 7, 2): print(i, end=" ") ```
2 3 4 5 6
2 4 6
2 4
2 3 4 5
Answer explanation
O loop for com range(2, 7, 2) gera números começando em 2 até 6, com passo 2. Assim, os valores impressos são 2 e 4. Portanto, a saída correta é '2 4'.
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple

Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
14 questions
CC111_CollaborativeQuiz
Quiz
•
Professional Development
10 questions
04 - Python - Lists
Quiz
•
University - Professi...
14 questions
Input, output and storage de
Quiz
•
8th Grade - Professio...
13 questions
GRAND OPENING INTERNSHIP EXERCISE 2024
Quiz
•
Professional Development
10 questions
Quiz Day - Mesa de ayuda - Puestos de Pago
Quiz
•
Professional Development
10 questions
AWS ACF Módulo 1 - Visão geral dos conceitos de nuvem
Quiz
•
Professional Development
10 questions
SQL 3 LOWER()
Quiz
•
Professional Development
10 questions
Test 04 - FUnd y DIseño de Redes 2023
Quiz
•
Professional Development
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade