Download the latest PCEP-30-02 dumps pdf to pass your exam successfully    Exam : PCEP-30-02    Title  : Certified Entry-Level Python            Programmer    https://www.passcert.com/PCEP-30-02.html           1/7
Download the latest PCEP-30-02 dumps pdf to pass your exam successfully    1.What are the four fundamental elements that make a language?  A. An alphabet, phonetics, phonology, and semantics  B. An alphabet, a lexis, phonetics, and semantics  C. An alphabet, morphology, phonetics, and semantics  D. An alphabet, a lexis, a syntax, and semantics  Answer: D  Explanation:  Topics: language alphabet lexis syntax semantics  We can say that each language (machine or natural, it doesn't matter)  consists of the following elements:  An alphabet:  a set of symbols used to build words of a certain language (e.g., the Latin alphabet for English,  the Cyrillic alphabet for Russian, Kanji for Japanese, and so on)  A lexis:  (aka a dictionary) a set of words the language offers its users  (e.g., the word \"computer\" comes from the English language dictionary, while \"cmoptrue\" doesn't;  the word \"chat\" is present both in English and French dictionaries,  but their meanings are different)  A syntax:  a set of rules (formal or informal, written or felt intuitively)  used to determine if a certain string of words forms a valid sentence  (e.g., \"I am a python\" is a syntactically correct phrase, while \"I a python am\" isn't)  Semantics:  a set of rules determining if a certain phrase makes sense  (e.g., \"I ate a doughnut\" makes sense, but \"A doughnut ate me\" doesn't)    2.What will be the output of the following code snippet?  x=1  y=2  z=x  x=y  y=z  print (x, y)  A. 1 2  B. 2 1  C. 1 1  D. 2 2  Answer: B  Explanation:  Topic: copying an immutable object by assigning  Try it yourself:  x=1  y=2  z=x                                                                                   2/7
Download the latest PCEP-30-02 dumps pdf to pass your exam successfully    print(z) # 1  x=y  print(x) # 2  y=z  print(y) # 1  print(x, y) # 2 1  Integer is an immutable data type.  The values get copied from one variable to another.  In the end x and y changed their values.    3.Python is an example of:  A. a machine language  B. a high-level programming language  C. a natural language  Answer: B  Explanation:  Topic: high-level programming language  https://en.wikipedia.org/wiki/Python_(programming_language)    4.What will be the output of the following code snippet?  print(3 / 5)  A. 6/10  B. 0.6  C. 0  D. None of the above.  Answer: B  Explanation:  Topic: division operator  Try it yourself:  print(3 / 5) # 0.6  print(4 / 2) # 2.0  The division operator does its normal job.  And remember the division operator ALWAYS returns a float.    5.Strings in Python are delimited with:  A. backslashes (i.e., \\)  B. double quotes (i.e., \") or single quotes (i.e., ')  C. asterisks (i.e., *)  D. dollar symbol (i.e., $)  Answer: B  Explanation:  Topics: strings quotes  Try it yourself:  print(\"Hello\") # Hello                                                                                   3/7
Download the latest PCEP-30-02 dumps pdf to pass your exam successfully    print('World') # World  Unlike in other programming languages, in Python double quotes and single quotes are synonyms for  each other.  You can use either one or the other.  The result is the same.    6.What will happen when you attempt to run the following code?  print(Hello, World!)  A. The code will raise the SyntaxError exception.  B. The code will raise the TypeError exception.  C. The code will raise the ValueError exception.  D. The code will print Hello, World! to the console.  E. The code will raise the AttributeError exception.  Answer: A  Explanation:  Topics: print() SyntaxError  Try it yourself:  # print(Hello, World!)  # SyntaxError: invalid syntax  The exclamation mark makes it a syntax error.    7.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    8.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                                                                                   4/7
Download the latest PCEP-30-02 dumps pdf to pass your exam successfully    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.    9.What is the expected output of the following code?  def func(x):  return 1 if x % 2 != 0 else 2  print(func(func(1)))  A. The code is erroneous.  B. None  C. 2  D. 1  Answer: D  Explanation:  Topics: def conditional expression (if else) modulus operator  not equal to operator  Try it yourself:  def func(x):  return 1 if x % 2 != 0 else 2  print(func(func(1))) # 1  print(1 % 2) # 1  print(1 % 2 != 0) # True  This is a conditional expression.  1 % 2 is 1 and therefore not equal to 0  The condition is True and the inner func() function call returns 1 That 1 is passed to the outer function  which will also return 1    10.Take a look at the snippet, and choose the true statements: (Select two answers)  nums = [1, 2, 3]  vals = nums  del vals[1:2]  A. nums is longer than vals  B. nums and vals refer to the same list  C. vals is longer than nums  D. nums and vals are of the same length  Answer: B,D  Explanation:  Topics: list referencing list slicing del  Try it yourself:  nums = [1, 2, 3]  vals = nums                                                                                   5/7
Download the latest PCEP-30-02 dumps pdf to pass your exam successfully    del vals[1:2]  print(nums) # [1, 3]  print(vals) # [1, 3]  A list is a mutable data type.  Assigning a mutable data type creates a reference to the same object.  vals and nums will point to the same object in the memory  and when you change one you automatically change the other, too.    11.What is the output of the following code?  a=1  b=0  x = a or b  y = not(a and b)  print(x + y)  A. The program will cause an error  B. 1  C. The output cannot be predicted  D. 2  Answer: D  Explanation:  Topics: logical operators booleans addition operator  implicit type casting  Try it yourself:  a=1  b=0  x = a or b  print(x) # 1  print(1 or 0) # 1  y = not(a and b)  print(y) # True  print(1 and 0) # 0  print(not 0) # True  print(x + y) # 2  print(1 + True) # 2  If you calculate with a boolean True becomes the integer 1 and therefore 1 + True is 2    12.What is the output of the following snippet?  dct = {}  dct['1'] = (1, 2)  dct['2'] = (2, 1)  for x in dct.keys():  print(dct[x][1], end='')  A. 21  B. (2,1)                                                                                   6/7
Download the latest PCEP-30-02 dumps pdf to pass your exam successfully    C. (1,2)  D. 12  Answer: A  Explanation:  Topics: dictionary tuple indexing for dict.keys() print()  Try it yourself:  dct = {}  dct['1'] = (1, 2)  dct['2'] = (2, 1)  print(dct) # {'1': (1, 2), '2': (2, 1)}  for x in dct.keys():  print(dct[x][1], end='') # 21  print()  print(dct['1'][1]) # 2  print(dct['2'][1]) # 1  dct.keys() are the keys '1' and '2'  dct['1'][1] is 2 and  dct['2'][1] is 1    13.What would you insert instead of so that the program checks for even numbers?  if ???:  print('x is an even number')  A. x % x == 0  B. x % 1 == 2  C. x % 2 == 0  D. x % 'even' == True  E. x % 2 == 1  Answer: C  Explanation:  Topics: if modulus operator equal to operator  Try it yourself:  x=4  if x % 2 == 0:  print('x is an even number') # x is an even number  Every number that divided by two does not leave a rest is even.                                                                                   7/7
                                
                                
                                Search
                            
                            Read the Text Version
- 1 - 7
 
Pages: