Docsity

WGU Python D522 Exam Guide With Complete Solution 2026/2026, Exams of Information Technology

Partial preview of the text

Download WGU Python D522 Exam Guide With Complete Solution 2026/2026 and more Exams Information Technology in PDF only on Docsity!

1, print(10 > 9) print(10 == 9) print (10 <9); Boolean 2. print(bool("Hello")) print(bool("15")) print(bool(x)): Boolean examples of True 3. print(bool(False)) print( ) pin) GB SATA 4, print(isinstance(x, int)): determine ifan object is of a certain data type -int{ casts an integer from an integer litera, float literal, or string Titeral w a - Moat): casts a float from an integer Titeral, a float Iiteral, or a string literal 7. str) casts a string from strings, integer literals, or afloat literals oe . print(‘text"); oltputs text to the console 9. print text’, end=""Yprint('more text’): sill end with a space and continue on the same line ("text more 10. print(' Wage", wage): comma will print both items with a space between them 11. print(variable): prints the value of the variable 12. print("1\n2\n3"): print using newline characters 13. print( }: print a blank Tine 14, python file.py: run a script file 15, random function: there is no random function, but there is a random module(import random) 16. for xin "bananas*print(x): sifings are artays, 60 this will loop through the characters in "bananas! 17, variableinput{ ): assign text entered by the user to a variable; input is always a string 18. variable = int(input): convert user input into an integer 19. hourly_wage = int{input("Enter hourly wage: "): display text prompt (Enter hourly stage) to request 20. print(a.upper( )): display a in console in upper case 21. print{a.lowert }): display a in console as lower ease 22. print(a.strip( )): remove whitespace at beginning and end 31. What built-in data type is used when you assign a sequence to your variable?: list w N < > a > ra a e 3 $ a 8 & o O° 8 $ 2 a bad a oy ao 2 ~ 33. What built-in data type is used when you assign a mapping to your variable?: dict 34, What built-in data type is used when you assign a set to your variable?: Set 35. What built-in data type is used when you assign a boolean to your variable? 36. What built-in data type is used when you assign binary to your variable?: 37. What built-in data type is used when you assign the value none to your variable?; nonetype 40. What is a Value Error?: invalid value is used (¢.g,, int(three)) 52, How do you determine how many items are in a list?: print(len(yourlist)) 53, What are some characteristics of a list?: ordered; changeable; allows duplicate values; new 54, What are some characteristics of a tuple?: ordered; unchangeable; allows duplicate values 56. What are some characteristics of a dictationary?: ordered; changeable; no duplicates 57. How do you verify the type of an object?: print(type(myobject)) 58. What is an integer?: positive or negative whole number of unlimited length $9, Whats Moat poste or negative number with a decal can alo bea sclentific number with an 60. Whats s complex nuiber: inainbeF Wt a gina pa ep a} 61. Can you convert a complex number into another number type? no 62, Can you convert a number into a complex number?: yes 63. Can you generate random numbers in Python?: no random function, but there is a 64, What are the arithmetic operators in Python?: 4 what is x -= 68. ifx=5 what is x *: 69. ifx=5 what is x /= 3; 1.6666 80. What are the bitwise operators?; & 81. print(6 & 3): 82. print(6 | 3): 2 8 8 3 c=. a 2 a bitwise operator NOR 24, prin(~ 3): bis apSROFNOT 85. print(3 << 2): 96, prin > 2): NGG igi FGHERTA 87. What is operator precedence?: parentheses ss, Whats an Fssingallows yout forma selected parts of tring replaced format specie by 97. Which modifiers are used to show a value's positive or negative sign?: := shows 98. What is the modifier to show the value in binary format?: b 99. What is the modifier to show the value in the corresponding Unicode character?: fe 100. What is the modifier to show the value in decimal format?: a 101. What is the modifier to show the value in scientific format? € 102. What is the modifier to show the value in fix point number format?: if number 103. What is the modifier to show the value in general format?: g 104, What is the modifier to show the value in octal format?: o 105. What is the modifier to show the value in hex format?: x lowercase 106. What is the modifier to show the value in number format?: in 107. What is the modifier to show the value in percentage format?: If number not 108. What characters are allowed in an identifier or name? letters, underscore, and digits 109, What characters are allowed at the beginning of an identifier or name?: must 110, What are reserved svords’: words that already have & predefined meaning, such as False, None, 111. What does an interpreter do with objects?: creates and manipulates objects as needed to 112, What is garbage collection’: the automatic process of deleting unused objects to keep memory 113. What is name binding?: associating names with interpreter objects 114, What are the three properties each object has?: value, type, and identity 124, What isa sequence type? collection of objects ordered from Teft to right the first object is 0; each 125. What is another term for an object's position in a collection’: its index 126, What is an implicitly defined range’: if code eliminates a range of values, the range that 127. Fastest way to isolate and remove the last digit of an integer: % 10 128. How to print theater tickets (row numbers, column letters 129, How to transform int(input()) into corresponding alpha: num_cols = int(input()) 130. How to print an * rectangle: num_rows = int(input()) 131, What is a break statement’: Causes loop to exit immediately; else statement does not execute 132, What is continue statement?: Causes a loop to immediately jump back to the while o for 133. Sort odd and even numbers: iffresult % 2) != Gis true, odd number 134, What is enumerate( Ji: retrieves the index and value ofan element in alist 135, What is unpacking?: performs multiple assignments at once, binding comma-separated names to 145. What is a hierarchical or nested function call?: a function call residing in a function 146, What isa void function? functions can output and/or return a value; fit only outputs and does not 147, What does if__name__ == "__main__": do?: It separates a section of code from the rest of 148, What is polymorphism? the behavior of an operator will depend on the type of operands; for 169, What dynamic sypgtthe intrprater dermis the typeof abject as the program exeuts 150, What is static typing?: programmer must define the type of every variable and every function 151. What is modular development: dividing a program into separate modules that can be devel 152, function stubs: function definitions whose statements haven't been written yet atleast one statement 153, Easy way to print the contents of list (separated by spaces, no brackets): 154. To iterate each element of a list: for num in numbers: 155, What is pass-by-assignment®: arguments to functions are passed by object reference 156. Calling a variable without using f-string: color = input("Enter a color: ") 157, If you get an “invalid syntax error,” what should you check?: that you have not forgotten ;