ch 4

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

3. When three single quotation marks are used on the next line directly after defining a function, what does this indicate? a. Multi-line text b. A docstring c. A string value including double or single quotation marks d. None of the above

3. B. A docstring is text that describes the purpose and use of a Python function, and it is located on the very next line after the function definition. The docstring can be viewed with the help() function in Python.

4. What are key components of object-oriented programming in Python? (Choose two.) a. Functions that can be performed on a data structure b. Attributes that are stored in an object c. Configuration templates d. YAML files

4. A, B. The key components of object-oriented programming in Python are functions that can be performed on a data structure and attributes that are stored in an object.

10. Which module is a testing framework for Cisco infrastructure? a. pyATS b. pyang c. devnetats d. ncclient

10. A. Cisco built pyATS and released it to open source for testing Cisco infrastructure software.

2. Which of the following is a valid Python function name? a. 1function b. __init__ c. True d. Funct1on

2. D. Python has specific rules for variable names. A variable cannot be named using reserved keywords, such True, and must start with a letter or an underscore but not a number.

5. Which of the following are benefits of OOP? (Choose all that apply.) a. Reusable code b. Easy to follow c. Low coupling/high cohesion d. Complex integration

5. A, B, C. The benefits of OOP are reusable code, easy-to-follow code, and low coupling/high cohesion between application components.

6. Which of the following are used to define a class in Python? (Choose two.) a. class classname(parent): b. class classname: c. def class classname(arg): d. None of the above

6. A, B. A Python class can be defined using the keyword class, a name for the class, and optionally a parent class to inherit attributes and functions from.

7. What is a method? a. A variable applied to a class b. Syntax notation c. A function within a class or an object d. Something that is not used in a class

7. C. A method is a function that you can perform on an object. Methods are often defined in classes. They can also make use of externally defined functions as well.

8. Which of the following describes inheritance? a. A hierarchy for functions in Python b. Class attributes and methods used as the starting point for another class c. A function only applied to methods being used in another class d. None of the above

8. B. Inheritance allows you to define a base class and then define another class using the previous class as a parent. The subsequent class includes all the capabilities of the parent class and can add to or override any attribute or method that needs to be different.

9. Which module provides access to the file system and directory structure? a. filesystem b. open c. system d. os

9. D. The os module allows you to interact with the file system and directory structure of the operating system.

1. Which of the following is the correct syntax for a Python function? a. define function (arg): b. function function(arg); c. def function(arg): d. func function(arg):

1. C. A function in Python uses the def keyword followed by a function name and parentheses with an optional argument inside.


Set pelajaran terkait

NCLEX musculoskeletal and immune

View Set

Chapter 2 - The US Economy: A Global View

View Set

Pearson Test: Darwin's Theory of Evolution

View Set

The Professional Scrum Master™ level I (PSM I) Assessment: Set 2

View Set