PCEP-30-01 Dumps PCEP-30-01 Braindumps PCEP-30-01 Real Questions PCEP-30-01 Practice Test PCEP-30-01 Actual Questions AICPA PCEP-30-01 Certified Entry-Level Python Programmer https://killexams.com/pass4sure/exam-detail/PCEP-30-01 Question: 34 A function definition starts with the keyword: A. def B. function C. fun Answer: A Explanation: Topic: def Try it yourself: def my_first_function(): print(‘Hello’) my_first_function() # Hello https://www.w3schools.com/python/python_functions.asp Question: 35 Consider the following code snippet: w = bool(23) x = bool(”) y = bool(‘ ‘) z = bool([False]) Which of the variables will contain False? A. z B. x C. y D. w Answer: B Explanation: Topic: type casting with bool() Try it yourself: print(bool(23)) # True print(bool(”)) # False print(bool(‘ ‘)) # True print(bool([False])) # True The list with the value False is not empty and therefore it becomes True The string with the space also contain one character and therefore it also becomes True The values that become False in Python are the following: print(bool(”)) # False print(bool(0)) # False print(bool(0.0)) # False print(bool(0j)) # False print(bool(None)) # False print(bool([])) # False print(bool(())) # False print(bool({})) # False print(bool(set())) # False print(bool(range(0))) # False Question: 36 Assuming that the tuple is a correctly created tuple, the fact that tuples are immutable means that the following instruction: my_tuple[1] = my_tuple[1] + my_tuple[0] A. can be executed if and only if the tuple contains at least two elements B. is illegal C. may be illegal if the tuple contains strings D. is fully correct Answer: B Explanation: Topics: dictionary Try it yourself: my_tuple = (1, 2, 3) my_tuple[1] = my_tuple[1] + my_tuple[0] # TypeError: ‘tuple’ object does not support item assignment A tuple is immutable and therefore you cannot assign a new value to one of its indexes. Question: 37 You develop a Python application for your company. You have the following code. def main(a, b, c, d): value = a + b * c – d return value Which of the following expressions is equivalent to the expression in the function? A. (a + b) * (c – d) B. a + ((b * c) – d) C. None of the above. D. (a + (b * c)) – d Answer: D Explanation: Topics: addition operator multiplication operator subtraction operator operator precedence Try it yourself: def main(a, b, c, d): value = a + b * c – d # 3 # value = (a + (b * c)) – d # 3 # value = (a + b) * (c – d) # -3 # value = a + ((b * c) – d) # 3 return value print(main(1, 2, 3, 4)) # 3 This question is about operator precedence The multiplication operator has the highest precedence and is therefore executed first. That leaves the addition operator and the subtraction operator They both are from the same group and therefore have the same precedence. That group has a left-to-right associativity. The addition operator is on the left and is therefore executed next. And the last one to be executed is the subtraction operator Question: 38 Which of the following variable names are illegal? (Select two answers) A. TRUE B. True C. true D. and Answer: B, D Explanation: Topics: variable names keywords True and Try it yourself: TRUE = 23 true = 42 # True = 7 # SyntaxError: cannot assign to True # and = 7 # SyntaxError: invalid syntax You cannot use keywords as variable names. Question: 39 Which of the following for loops would output the below number pattern? 11111 22222 33333 44444 55555 A. for i in range(0, 5): print(str(i) * 5) B. for i in range(1, 6): print(str(i) * 5) C. for i in range(1, 6): print(i, i, i, i, i) D. for i in range(1, 5): print(str(i) * 5) Answer: B Explanation: Topics: for range() str() multiply operator string concatenation Try it yourself: for i in range(1, 6): print(str(i) * 5) """ 11111 22222 33333 44444 55555 """ print(‘———-‘) for i in range(0, 5): print(str(i) * 5) """ 00000 11111 22222 33333 44444 """ print(‘———-‘) for i in range(1, 6): print(i, i, i, i, i) """ 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 """ print(‘———-‘) for i in range(1, 5): print(str(i) * 5) """ 11111 22222 33333 44444 """ You need range (1, 6) because the start value 1 is inclusive and the end value 6 is exclusive. To get the same numbers next to each other (without a space between them) you need to make a string and then use the multiply operator string concatenation The standard separator of the print() function is one space. print(i, i, i, i, i) gives you one space between each number. It would work with print(i, i, i, i, i, sep=”) but that answer is not offered here. Question: 40 The digraph written as #! is used to: A. tell a Unix or Unix-like OS how to execute the contents of a Python file. B. create a docstring. C. make a particular module entity a private one. D. tell an MS Windows OS how to execute the contents of a Python file. Answer: A Explanation: Topics: #! shebang This is a general UNIX topic. Best read about it here: https://en.wikipedia.org/wiki/Shebang_(Unix) 6$03/( 48(67,216 7KHVH TXHVWLRQV DUH IRU GHPR SXUSRVH RQO\ )XOO YHUVLRQ LV XS WR GDWH DQG FRQWDLQV DFWXDO TXHVWLRQV DQG DQVZHUV .LOOH[DPV FRP LV DQ RQOLQH SODWIRUP WKDW RIIHUV D ZLGH UDQJH RI VHUYLFHV UHODWHG WR FHUWLILFDWLRQ H[DP SUHSDUDWLRQ 7KH SODWIRUP SURYLGHV DFWXDO TXHVWLRQV H[DP GXPSV DQG SUDFWLFH WHVWV WR KHOS LQGLYLGXDOV SUHSDUH IRU YDULRXV FHUWLILFDWLRQ H[DPV ZLWK FRQILGHQFH +HUH DUH VRPH NH\ IHDWXUHV DQG VHUYLFHV RIIHUHG E\ .LOOH[DPV FRP $FWXDO ([DP 4XHVWLRQV .LOOH[DPV FRP SURYLGHV DFWXDO H[DP TXHVWLRQV WKDW DUH H[SHULHQFHG LQ WHVW FHQWHUV 7KHVH TXHVWLRQV DUH XSGDWHG UHJXODUO\ WR HQVXUH WKH\ DUH XS WR GDWH DQG UHOHYDQW WR WKH ODWHVW H[DP V\OODEXV %\ VWXG\LQJ WKHVH DFWXDO TXHVWLRQV FDQGLGDWHV FDQ IDPLOLDUL]H WKHPVHOYHV ZLWK WKH FRQWHQW DQG IRUPDW RI WKH UHDO H[DP ([DP 'XPSV .LOOH[DPV FRP RIIHUV H[DP GXPSV LQ 3') IRUPDW 7KHVH GXPSV FRQWDLQ D FRPSUHKHQVLYH FROOHFWLRQ RI TXHVWLRQV DQG DQVZHUV WKDW FRYHU WKH H[DP WRSLFV %\ XVLQJ WKHVH GXPSV FDQGLGDWHV FDQ HQKDQFH WKHLU NQRZOHGJH DQG LPSURYH WKHLU FKDQFHV RI VXFFHVV LQ WKH FHUWLILFDWLRQ H[DP 3UDFWLFH 7HVWV .LOOH[DPV FRP SURYLGHV SUDFWLFH WHVWV WKURXJK WKHLU GHVNWRS 9&( H[DP VLPXODWRU DQG RQOLQH WHVW HQJLQH 7KHVH SUDFWLFH WHVWV VLPXODWH WKH UHDO H[DP HQYLURQPHQW DQG KHOS FDQGLGDWHV DVVHVV WKHLU UHDGLQHVV IRU WKH DFWXDO H[DP 7KH SUDFWLFH WHVWV FRYHU D ZLGH UDQJH RI TXHVWLRQV DQG HQDEOH FDQGLGDWHV WR LGHQWLI\ WKHLU VWUHQJWKV DQG ZHDNQHVVHV *XDUDQWHHG 6XFFHVV .LOOH[DPV FRP RIIHUV D VXFFHVV JXDUDQWHH ZLWK WKHLU H[DP GXPSV 7KH\ FODLP WKDW E\ XVLQJ WKHLU PDWHULDOV FDQGLGDWHV ZLOO SDVV WKHLU H[DPV RQ WKH ILUVW DWWHPSW RU WKH\ ZLOO UHIXQG WKH SXUFKDVH SULFH 7KLV JXDUDQWHH SURYLGHV DVVXUDQFH DQG FRQILGHQFH WR LQGLYLGXDOV SUHSDULQJ IRU FHUWLILFDWLRQ H[DPV 8SGDWHG &RQWHQW .LOOH[DPV FRP UHJXODUO\ XSGDWHV LWV TXHVWLRQ EDQN DQG H[DP GXPSV WR HQVXUH WKDW WKH\ DUH FXUUHQW DQG UHIOHFW WKH ODWHVW FKDQJHV LQ WKH H[DP V\OODEXV 7KLV KHOSV FDQGLGDWHV VWD\ XS WR GDWH ZLWK WKH H[DP FRQWHQW DQG LQFUHDVHV WKHLU FKDQFHV RI VXFFHVV 7HFKQLFDO 6XSSRUW .LOOH[DPV FRP SURYLGHV IUHH [ WHFKQLFDO VXSSRUW WR DVVLVW FDQGLGDWHV ZLWK DQ\ TXHULHV RU LVVXHV WKH\ PD\ HQFRXQWHU ZKLOH XVLQJ WKHLU VHUYLFHV 7KHLU FHUWLILHG H[SHUWV DUH DYDLODEOH WR SURYLGH JXLGDQFH DQG KHOS FDQGLGDWHV WKURXJKRXW WKHLU H[DP SUHSDUDWLRQ MRXUQH\ 'PS .PSF FYBNT WJTJU IUUQT LJMMFYBNT DPN WFOEPST FYBN MJTU .LOO \RXU H[DP DW )LUVW $WWHPSW *XDUDQWHHG