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

Exam PCAP All Questions

View all questions & answers for the PCAP exam

Exam PCAP topic 1 question 78 discussion

Actual exam question from Python Institute's PCAP
Question #: 78
Topic #: 1
[All PCAP Questions]

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

  • A. import pymod pymod.pyfun()
  • B. from pymod import pyfun pyfun()
  • C. from pymod import * pymod.pyfun()
  • D. import pyfun from pymod pyfun()
Show Suggested Answer Hide Answer
Suggested Answer: AB 🗳️
Reference:
https://www.tutorialsteacher.com/python/python-module

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
macxsz
2 years, 6 months ago
Selected Answer: AB
A. import pymod pymod.pyfun() B. from pymod import pyfun pyfun()
upvoted 1 times
...
Norasit
2 years, 7 months ago
There is no any correct answer if each statement write in a single line.
upvoted 1 times
...
rocky48
2 years, 8 months ago
pymod.py file contains => pyvar = 1 def pyfun(): print(pyvar) python3 => >>> import pymod >>> pymod.pyfun() 1 >>> from pymod import pyfun >>> pyfun() 1 >>> from pymod import * >>> pymod.pyfun() 1 >>> import pyfun from pymod File "<stdin>", line 1 import pyfun from pymod ^ SyntaxError: invalid syntax A,B, C are all correct. But B is better than C. Best answer : A & B
upvoted 2 times
zantrz
10 months ago
for C we would require 3 lines, therefore I think is incorrect: import pymod from pymod import * pymod.pyfun()
upvoted 1 times
...
...
DTL001
2 years, 11 months ago
Yes, it's AB
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 ...