Courseiva
Modules and PackagesmediumMultiple SelectObjective-mapped

PCAP Modules and Packages Practice Question

Which TWO of the following are valid ways to import a module named 'math' and give it an alias 'm'?

⚠ Common exam trap

Python Institute often tests the distinction between `import module as alias` and `from module import name as alias`, and the trap here is that candidates may confuse the alias syntax for modules with the alias syntax for specific names, or incorrectly assume that `alias` is a valid keyword.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

import math as m

Only B. Option B uses the correct syntax `import math as m` to import the entire math module with alias m. Option A is invalid because the asterisk (*) cannot be combined with an alias in a `from ... import` statement. Option C is missing the `as` keyword. Option D uses `alias` which is not a valid keyword; the correct keyword is `as`. Option E imports a specific function (sin) from math, not the module itself; therefore it does not satisfy the requirement to import the module and give it an alias.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • from math import * as m

    Why it's wrong here

    Invalid because the asterisk (*) cannot be combined with an alias in a `from ... import` statement.

  • import math as m

    Why this is correct

    Correct syntax: `import math as m` imports the full math module with alias m.

  • import math m

    Why it's wrong here

    Invalid because it is missing the `as` keyword; correct syntax is `import math as m`.

  • import math alias m

    Why it's wrong here

    Invalid because `alias` is not a valid keyword; the correct keyword is `as`.

  • from math import sin as m

    Why it's wrong here

    Imports only the sin function from math and aliases it as m, but it does not import the math module itself; thus it is not a valid way to import the module with an alias.

About these practice questions

Courseiva writes every PCAP question from scratch — 169 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCAP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCAP exam.