Free PCAP-31-03 Exam Braindumps

What is the expected output of the following snippet'' a = 2
if a > 0: a += 1 else: a -= 1 print(a)

  1. 3
  2. 1
  3. 2
  4. the code is erroneous

Answer(s): A



Python strings can be “glued” together using the operator:

  1. .
  2. &
  3. _
  4. +

Answer(s): D


Reference:

https://docs.python.org/3/tutorial/introduction.html



Which of the following words can be used as a variable name? (Select two valid names)

  1. for
  2. True
  3. true
  4. For

Answer(s): A,B


Reference:

https://www.pluralsight.com/guides/python-basics-variables-assignment



Python’s built in function named open () tries to open a file and returns:

  1. an integer value identifying an opened file
  2. an error code (0 means success)
  3. a stream object
  4. always None

Answer(s): A


Reference:

https://www.programiz.com/python-programming/file-operation



The following class hierarchy is given. What is the expected out of the code?

  1. BB
  2. CC
  3. AA
  4. BC

Answer(s): D