



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




WGU D522 Python for IT Automation OBJECTIVE ASSESSMENT 2026 || Python for IT Automation (WGU D522) What are the traits of Imperative/procedural programming? - ANSWER Focuses on describing a sequence of steps to perform a task What are the traits of Object-Oriented Programming (OOP)? - ANSWER Organize code around objects, which encapsulate data and behavior. What are the traits of Functional Programming? - ANSWER emphasizes the use of functions and immutable data for computation. What are the traits of Declarative Programming? - ANSWER describes what the program should accomplish without specifying how to achieve it. What are the traits of Event-Driven Programming? - ANSWER Reacts to events and user actions, triggering corresponding functions. What are the traits of Logic Programming? - ANSWER defines a set of logical conditions and lets the system deduce solutions. What does Python syntax refer to? - ANSWER The set of rules that dictate the combinations of symbols and keywords that form valid Python programs What is the purpose of indentation in Python? - ANSWER To define blocks of code Why might a programmer use comments for 'Preventing Execution'? - ANSWER To temporarily disable lines or blocks of code What is the primary use of whitespace in Python? - ANSWER 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? - ANSWER Indentation What is the purpose of the input() function in Python? - ANSWER To capture user input and store it as a string What does the format() method do in Python? - ANSWER It enhances output formatting by embedding variables in strings. (although 'f' strings are easier to read) What is the purpose of the Code Editor in a Python IDE? - ANSWER To provide a text editor designed for Python, offering features like syntax highlighting, code completion, and indentation.
What does this built in Python function do?: print() - ANSWER outputs text or variables to the console What does this built in Python function do?: input() - ANSWER reads user input from the console What does this built in Python function do?: len() - ANSWER determines the length of a sequence (string, list, tuple) What does this built in Python function do?: type() - ANSWER returns the type of an object What does this built in Python function do?: int(), float(), str() - ANSWER converts values to integers, floats, or strings; respectively What does this built in Python function do?: max(), min() - ANSWER returns the maximum or minimum value from a sequence What does this built in Python function do?: sum() - ANSWER calculates the sum of elements in a sequence What does this built in Python function do?: abs() - ANSWER returns the absolute value of a number What does this built in Python function do?: range() - ANSWER generates a sequence of numbers What does this built in Python function do?: sorted() - ANSWER returns a sorted list from an iterable What does this built in Python function do?: any(), all() - ANSWER checks if any or all elements in an iterable are true What does this built in Python function do?: map(), filter() - ANSWER applies a function to elements or filters elements based on a function What does this built in Python function do?: open(), read(), write() - ANSWER handles file I/O operations What does this built in Python function do?: dir() - ANSWER lists the names in the current scope or attributes of an object What does this built in Python function do?: help() - ANSWER provides help information about an object or Python What is the primary characteristic of Python variables? - ANSWER Variables are created as soon as a value is assigned to them.
What are the 3 sequence types in Python? what do they represent/look like? - ANSWER list: Ordered, mutable sequence; [1,23] tuple: Ordered, immutable sequence; (1,2,3) range: represents a range of values; e.g. range(5) What are the characteristics of a set? - ANSWER Unordered, mutable collection of unique elements. {1,2,3} what is a dictionary mapping type? - ANSWER an unordered collection of key- value pairs. my_dict = {'key':'value', 'name':'John'} What happens when an operation is performed that involves both an int and a float in Python? - ANSWER the result is automatically promoted to a 'float' What does the 'round(x, n) function do in Python? - ANSWER it rounds 'x' to 'n' decimal places What are the two main escape characters? - ANSWER \n : new line \t : for a tab What are the 3 components of a string slice? - ANSWER string [start:stop:step] · Start: the index from which the slicing begins (inclusive) · Stop: the index at which the slicing ends (exclusive) · Step (optional): The step or stride between characters. What does the string slicing operation 'text {::-1] do where text = "Hello, Python!"? - ANSWER It reverses the string. The 'step' portion of the slice is negative, indicating the stride between characters is reversed. What does the 'strip()' method do in Python? - ANSWER It removes leading and trailing whitespaces from a string
what does the += operator do in Python string manipulation? - ANSWER It is used as a shorthand for concatenation and assignment What are truthy and falsy values in Python? - ANSWER 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? - ANSWER 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 modulus operation '%' in Python? - ANSWER It returns the remainder of the division of two numbers. What does the arithmatic operator **= do? - ANSWER 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? - ANSWER ['red', 'yellow', 'blue', 'green'] when using the .insert(), it doesn't replace the value in that position, it inserts into that place. When would I use extend() vs append()? - ANSWER 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) my_list = [1, 2, 3] my_list.append([4, 5]) # Appending a list as a single element print(my_list) # Output: [1, 2, 3, [4, 5]]