Search Header Logo

Python Concepts

Authored by Sakthivel Duraisamy

Computers

12th Grade

Used 8+ times

Python Concepts
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

19 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the different data types available in Python?

array

double

char

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

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the if-else control structure in Python with an example.

Example: x = 5 if x > 5: print('x is greater than 5') else: print('x is less than or equal to 5')

Example: x = 10 if x > 5: print('x is greater than 5')

Example: x = 10 if x < 5: print('x is less than 5') else: print('x is greater than or equal to 5')

Example: x = 10 if x > 5: print('x is greater than 5') else: print('x is less than or equal to 5')

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define a function in Python?

Use the 'function' keyword followed by the function name and parentheses containing parameters, then write the function body.

Use the 'func' keyword followed by the function name and parentheses containing parameters, then write the function body.

Use the 'define' keyword followed by the function name and parentheses containing parameters, then write the function body.

Use the 'def' keyword followed by the function name and parentheses containing parameters, then write the function body.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a module in Python? Provide an example.

A module in Python is a programming language.

A module in Python is a built-in function.

A module in Python is a type of data structure.

A module in Python is a file containing Python code. It can define functions, classes, and variables. Modules are used to organize code into reusable units. An example of a module in Python is the 'math' module, which provides mathematical functions.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you read data from a file in Python?

Use 'write' function to read the content

Execute 'open' function without specifying the file path

Open the file using 'open' function and read the content using appropriate methods like 'read', 'readline', or 'readlines'.

Access the file directly without using any functions

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a list and a tuple in Python?

Lists are immutable, tuples are mutable.

Lists and tuples have the same methods available for manipulation.

Lists are mutable, tuples are immutable.

Lists and tuples cannot store different data types.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Describe the for loop in Python.

A for loop in Python is used to iterate over a sequence in reverse order

A for loop in Python is used to iterate over a sequence (list, tuple, string, etc.) or other iterable objects. It consists of an initialization, condition, and increment/decrement expression. The loop continues until the condition is false.

A for loop in Python can only iterate over integers

A for loop in Python is only used for mathematical calculations

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?