PCAP-31-03 Dumps

PCAP-31-03 Braindumps PCAP-31-03 Real Questions PCAP-31-03 Practice Test PCAP-31-03 Actual Questions


AICPA


PCAP-31-03


Certified Associate in Python Programming - 2023


https://killexams.com/pass4sure/exam-detail/PCAP-31-03


Question: 38


What is the expected output of the following code?



  1. 3

  2. 5

  3. 4

  4. an exception is raised


Answer: A


Question: 39


What is the expected output of the following code? def foo(x,y,z):

return x(y) – x(z)


print{f00(lambda x: x % 2, 2, 1) )

  1. 1

  2. 0

  3. -1

  4. an exception is raised


Answer: C


Question: 40


Assuming that the following code has been executed successfully, selected the expression which evaluate to True (Select two answers)


  1. a ( ) == 4

  2. a is not None C. b ( ) == 4

D. a ! = b


Answer: A,B


Question: 41


What can you do if you don’t like a long package path like this one?



  1. you can make an alias for the name using the alias keyword

  2. nothing, you need to come to terms with it

  3. you can shorten it to alpha. zeta and Python will find the proper connection

  4. you can make an alias for the name using the as keyword


Answer: D Explanation:

Reference: https://stackoverflow.com/questions/706595/can-you-define-aliases-for-imported-modules-in-python


Question: 42


Which of the following expression evaluate to True? (Select two answers) A. len(”•) == 1

  1. len("""

    """) == o

  2. chr(ordCA’) + 1) == ‘B’

  3. ord("Z") – ord("z") — ord("0")


Answer: B

The bases property contains:

  1. base class locations (addr)

  2. base class objects (class)

  3. base class names (str)

  4. base class ids (int)


Answer: C


Question: 44


What is the expected output of the following snippet?



  1. 3

  2. 1

  3. 2

  4. the code is erroneous


Answer: A


Question: 45


A variable stored separately in every object is called:

  1. there are no such variables, all variables are shared among objects

  2. a class variable

  3. an object variable

  4. an instance variable


Answer: D Explanation:

Reference: https://dev.to/ogwurujohnson/distinguishing-instance-variables-from-class-variables-in-python-81

What is the expected behavior of the following code?



  1. it outputs 2

  2. the code is erroneous and it will not execute

  3. it outputs 1

  4. it outputs 3


Answer: A


Question: 47


Assuming that the code below has been executed successfully, which of the following expressions evaluate to True? (Select two answers)


  1. ‘var’ in Object. dict

  2. ‘prop’ in Class. dict

  3. len(Object. diet ) == 1

  4. ‘var1 in Class, dict


Answer: A,C


Question: 48


The following expression 1+-2

is:

  1. equal to 1

  2. invalid

  3. equal to 2

  4. equal to -1


Answer: D


Question: 49


If you need to serve two different exceptions called Ex1 and Ex2 in one except branch, you can write:

  1. except Ex1 Ex2:

  2. except (ex1, Ex2):

  3. except Ex1, Ex2:

  4. except Ex1+Ex2:


Answer: D


Question: 50


With regards to the directory structure below, select the proper forms of the directives in order to import module_a. (Select two answers)



  1. import pypack.module_a

  2. import module_a from pypack

  3. import module_a

  4. from pypack import module_a


Answer: A,D