PCAP Practice Test

PCAP Practice Test practice questions, page 5 of 6, with answer review and explanations.

Question 21

Can a module run like regular code?

  1. yes, and it can differentiate its behavior between the regular launch and import
  2. it depends on the Python version
  3. yes, but in cannot differentiate its behavior between the regular launch and import
  4. no, it is not possible; a module can be imported, not run

Question 22

Select the valid fun () invocations: (Choose two.)

  1. fun (b=1)
  2. fun (a=0)
  3. fun (b=1, 0)
  4. fun (1)

Question 23

A file name like this one below says that: (Choose three.) services, cpython 36.pyc

  1. the interpreter used to generate the file is version 3.6
  2. it has been produced by CPython
  3. it is the 36 version of the file
  4. the file comes from the services.py source file

Question 24

What is the expected behavior of the following snippet? It will:

  1. cause a runtime exception
  2. print 1
  3. print 0, [1]
  4. print [1]

Question 25

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