Search Header Logo

Module in Python

Authored by Chi Quang

Computers

University

Used 2+ times

Module in Python
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main purpose of using modules in Python?

To avoid using classes
To write programs in Java
To organize reusable code in separate files
To increase the speed of the Python interpreter

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code output? import math print(math.pi

3.14159…
math.pi
Error
PI

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following imports only the sqrt function from the math module?

import math.sqrt
from math import sqrt
import sqrt from math
import sqrt

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the effect of using an alias when importing a module in Python?

It hides the module
It speeds up execution
It gives the module a shorter name
It disables built-in functions

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why is “from math import *” discouraged in large programs?

It increases performance
It increases typing
It can cause name conflicts
It hides the source of code

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you try to import a module that doesn’t exist?

The program continues silently
A warning is shown
An ImportError is raised
A file is created

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these commands installs the virtualenv tool using pip?

pip load virtualenv
pip get virtualenv
pip install virtualenv
install virtualenv pip

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?