500+ Python Questions Quiz
Quiz 8 python answers please
Q1. The ___________ method adds a new element onto the end of the array.
- append
Q2. A(n) ____________ is a variable that holds many pieces of data at the same time.
- array
Q3. A(n) ____________ is a piece of data stored in an array.
- element
Q4. Where does **append** add a new element?
- To the end of an array.
Q5. Consider the following code that works on an array of integers:
`for i in range(len(values)):
if (values[i] < 0):
values[i] = values [i] * -1`
What does it do?
- Changes all negative numbers to positives.
Q6. Which of the following is NOT a reason to use arrays?
- To do number calculations.
Q7. Consider the following:
`stuff = ["dog", "cat", "frog", "zebra", "bat", "pig", "mongoose"]`
"frog" is ____________.
- an element
Q8. _____________ is storing a specific value in the array.
- Assigning
Q9. Consider the following code:
`stuff = ["dog", "cat", "frog", "zebra", "bat", "pig", "mongoose"]
print(stuff[3])`
What is output?
- zebra
Q10. Consider the following code:
`tests = [78, 86, 83, 89, 92, 91, 94, 67, 72, 95]
sum = 0
for i in range(_____):
sum = sum + tests[i]
print("Class average: " + str((sum/_____)))`
What should go in the ____________ to make sure that the code correctly finds the average of the test scores?
- len(tests)More on reddit.com
Are there any good online Python quizzes that one can take to test one's Python skills?
SoloLearn has "challenges" which are a set of questions.
But I'd recommend coding challenges instead, since they are more technical and useful.
More on reddit.comA better subreddit to ask Python Questions?
Videos
Compiled 500+ Python questions into a quiz. I'm trying to improve my understanding of Python so this was helpful.
Quiz
I'll keep refining the questions to make sure it covers all the important topics in Python.
If you come across a question whose answer you doubt, please leave a comment and I'll check it again. Any recommendations or changes, please let me know.
So what's your score?
PS. This was built for Applyre users, who might want to use it for interview prep.