D522 Python for IT Automation - Set 3 - Part 2
Test your knowledge of technical writing concepts with these practice questions. Each question includes detailed explanations to help you understand the correct answers.
Question 21: How do you define a class in Python?
Question 22: What is the special method that initializes a new object?
Question 23: What does the self parameter refer to in a class method?
Question 24: How do you create an instance of a class named Server?
Question 25: What is a module in Python?
Question 26: How do you import only the sleep function from the time module?
Question 27: What is the purpose of the if __name__ == '__main__': block?
Question 28: What does a generator function use to produce values lazily?
Question 29: What is the main advantage of a generator over a list?
Question 30: What does the enumerate() function provide when looping?
Question 31: What does the zip() function do?
Question 32: What does the *args parameter allow a function to accept?
Question 33: What does the **kwargs parameter allow a function to accept?
Question 34: What is a default parameter value in a function definition?
Question 35: Which method returns all keys of a dictionary?
Question 36: Which method returns all values of a dictionary?
Question 37: Which method returns key-value pairs of a dictionary?
Question 38: Which dictionary method safely retrieves a value, returning a default if the key is missing?
Question 39: What does the in operator test for a list?
Question 40: What does the pass statement do?
Don't Want to Study?
Save Time on Studies, Spend More with Family & Friends! Pay-After-you-Pass!
Get Exam Support