Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
 

Python Institute PCAP-31-03 Exam Actual Questions

The questions for PCAP-31-03 were last updated on Nov. 1, 2024.
  • Viewing page 1 out of 17 pages.
  • Viewing questions 1-4 out of 67 questions

Topic 1 - Exam A

Question #1 Topic 1

What is true about Python packages? (Choose two.)

  • A. a code designed to initialize a package’s state should be placed inside a file named init.py
  • B. a package’s contents can be stored and distributed as an mp3 file
  • C. __pycache__ is a folder that stores semi-compiled Python modules
  • D. the sys.path variable is a list of strings
Reveal Solution Hide Solution   Discussion   6

Correct Answer: AC 🗳️

Question #2 Topic 1

What is the expected output of the following code?
import sys
import math
b1 = type(dir(math)) is list
b2 = type(sys.path) is list
print(b1 and b2)

  • A. None
  • B. True
  • C. 0
  • D. False
Reveal Solution Hide Solution   Discussion   6

Correct Answer: B 🗳️

Question #3 Topic 1

A Python package named pypack includes a module named pymod.py which contains a function named pyfun().
Which of the following snippets will let you invoke the function? (Choose two.)

  • A. from pypack.pymod import pyfun
    pyfun()
  • B. import pypack
    pymod.pyfun()
  • C. from pypack import *
    pyfun()
  • D. import pypack
    import pypack.pymod
    pypack.pymod.pyfun()
Reveal Solution Hide Solution   Discussion   2

Correct Answer: AD 🗳️

Question #4 Topic 1

Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Choose two.) import random v1 = random.random() v2 = random.random()

  • A. len(random.sample([1,2,3],1)) > 2
  • B. v1 == v2
  • C. random.choice([1,2,3]) > 0
  • D. v1>1
Reveal Solution Hide Solution   Discussion   4

Correct Answer: BC 🗳️

Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...