exam questions

Exam PCAP-31-03 All Questions

View all questions & answers for the PCAP-31-03 exam

Exam PCAP-31-03 topic 1 question 117 discussion

Actual exam question from Python Institute's PCAP-31-03
Question #: 117
Topic #: 1
[All PCAP-31-03 Questions]

A Python module named pymod.py contains a variable named pyvar. Which of the following snippets will let you access this variable? (Choose two.)

  • A. from pymod import pyvar
    pyvar ()
  • B. import pymod
    pymod.pyvar = 1
  • C. import pyvar from pymod
    pyvar = 1
  • D. from pymod import*
    pyvar = 1
Show Suggested Answer Hide Answer
Suggested Answer: AD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
devlabstrainer
3 weeks, 6 days ago
Selected Answer: BD
import pymod imports the entire module. You can access or modify its variable using pymod.pyvar. from pymod import * imports all public variables from pymod, including pyvar. Then you can access or modify pyvar directly.
upvoted 1 times
...
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 ...