Docsity

WGU D522 | Python for IT Automation | OBJECTIVE ASSESSMENT 2026 || Python for IT Automatio, Exams of Biology

Partial preview of the text

Download WGU D522 | Python for IT Automation | OBJECTIVE ASSESSMENT 2026 || Python for IT Automatio and more Exams Biology in PDF only on Docsity!

W6U D522 Python for IT Automation OBJECTIVE ASSESSMENT 2026 || Python for IT Automation (WGU D522) Questions and answers What are the traits of Imperative/procedural programming? Focuses on describing a sequence | of steps to perform a task What are the traits of Object- Oriented Programming (OOP)? Organize code around objects, : which encapsulate data and { behavior. What are the traits of Functional Programming? emphasizes the use of functions { and immutable data for ! computation. Programming? __ | describes what the program What are the traits of Declarative | . . : should accomplish without ! specifying how to achieve it. What are the traits of Event- Driven Programming? ‘ Reacts to events and user actions, triggering corresponding : functions. What are the traits of Logic Programming? defines a set of logical conditions and lets the system deduce solutions. The set of rules that dictate the H binati f bols and What does Python syntax refer to? ! combinations oF symbo's an keywords that form valid Python programs What is the purpose of indentation in Python? ‘ To define blocks of code Why might a programmer use comments for ‘Preventing Execution’? To temporarily disable lines or blocks of code What is the primary use of whitespace in Python? To define the structure and | hierarchy of the code What does Python use to define the scope of control flow statements and structures like functions and classes? : Indentation What is the purpose of the input() function in Python? | To capture user input and store it as a string What does this built in Python function do?: range() : generates a sequence of numbers What does this built in Python function do?: sorted() returns a sorted list from an ! iterable What does this built in Python function do?: any(), all() : checks if any or all elements in an iterable are true What does this built in Python function do?: map(), filter() applies a function to elements or filters elements based on a ‘ function What does this built in Python function do?: open(), read(), write() handles file |/O operations What does this built in Python function do?: dir() lists the names in the current : scope or attributes of an object What does this built in Python function do?: help() provides help information about + an object or Python What is the primary characteristic of Python variables? ; Variables are created as soon as a : value is assigned to them. What are the 5 Variable name rules in Python? 1. can only contain letters, numbers, or an underscore. | 2. MUST start with either a letter ! or underscore 3. Cannot start with a number : 4. Cannot contain special ' characters. 5. Cannot be a Python keyword (such as: and, as, def, else, etc) What are the 3 common naming conventions used in Python, and what is their format? : Camel case: each word, except for | the first word, starts with a capital ! letter | Pascal case: each word starts with ‘ a capital letter ! Snake case: each word in the : variable is separated by an underscore. What happens if the number of variables is not equal to the number of values in a Python assignment statement? { An error will occur What does unpacking involve in Python? Extracting elements from iterable : objects and assigning them to | individual variables What is the result of using the '+' operator to output multiple Python variables of different types? : A Python error occurs. (must use : variables of the same type) How can multiple Python variables of different types be By separating each variable with a output using the print() function? comma What is the scope of a variable that is defined inside a function in : Local Scope Python? What are the two main escape characters? : \n: new line \t : for a tab What are the 3 components of a string slice? string [start:stop:step] - Start: the index from which the } slicing begins (inclusive) 1 - Stop: the index at which the slicing ends (exclusive) - Step (optional): The step or stride between characters. What does the string slicing = "Hello, Python!"? | It reverses the string. operation ‘text {:-1] do where text The ‘step’ portion of the slice is } negative, indicating the stride : between characters is reversed. What does the 'strip()' method do in Python? : It removes leading and trailing : whitespaces from a string what does the += operator do in Python string manipulation? It is used as a shorthand for ! concatenation and assignment What are truthy and falsy values in Python? ' Truthy values are non-zero | numbers and non-empty strings. Falsy values are zero, None, and ! empty strings What is the purpose of the // operator in Python? t It performs floor division { operation; { performs division and rounds down to the nearest whole number and discards the decimal part What is the purpose of the It returns the remainder of the modulus operation '%' in Python? } division of two numbers. What does the arithmatic operator **= do? It take the exponent of the value : applied to it. Consider the following Python code: colors = ['red’, ‘blue’, ‘green’] colors.insert(1, ‘'yellow’) What will be the value of colors after executing this code? ['red’, ‘yellow’, ‘blue’, 'green’] when using the .insert(), it doesn't replace the value in that position, : it inserts into that place. When would | use extend() vs append()? extend() is used for adding ; multiple values from an iterable append() is used for adding a ! single element to the end (even if ' it's a list) i my_list = [1, 2, 3] my_listappend([4, 5]) # Appending a list as a single element print(my_list) # Output: [1, 2, 3, [4, 5] What does the pop() method do? : It removes an item at the specified { index position. ; example: