Search Header Logo

Exploring Python Fundamentals

Authored by Mr. Gogoi

Computers

University

Used 2+ times

Exploring Python Fundamentals
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

42 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What are the basic data types in Python?

float, number, string, object

int, float, str, bool, list, tuple, set, dict

integer, decimal, text, map

char, byte, string, array

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you create a list in Python?

You create a list in Python using curly braces, e.g., my_list = {1, 2, 3}.

You create a list in Python by using the list() function, e.g., my_list = list(1, 2, 3).

You create a list in Python using square brackets, e.g., my_list = [1, 2, 3].

You create a list in Python using parentheses, e.g., my_list = (1, 2, 3).

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of an if statement in Python?

To execute code conditionally based on a boolean expression.

To repeat code multiple times.

To create a loop for iteration.

To define a function in Python.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Explain the use of for loops in Python.

For loops in Python are primarily used for error handling.

For loops can only iterate over numbers in Python.

For loops in Python are used to define functions.

For loops in Python allow iteration over sequences and execute a block of code for each item.

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is a function in Python and how is it defined?

A function in Python is defined using the 'func' keyword.

A function in Python is defined using the 'def' keyword, followed by the function name and parentheses.

A function in Python is defined by writing the function name followed by a colon.

Functions in Python are created with the 'create' keyword.

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How can you import a module in Python?

You can import a module by copying its code directly into your script.

Use the 'require' statement to load the module.

Modules can only be imported from the current directory.

Use the 'import' statement followed by the module name.

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of the open() function in file handling?

To open a file and return a file object for file handling operations.

To create a new file without opening it.

To delete a file from the system.

To read the contents of a file into memory.

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?

Discover more resources for Computers