Mastering Python Programming

Mastering Python Programming

University

20 Qs

quiz-placeholder

Similar activities

Mobile application test no 1

Mobile application test no 1

University

16 Qs

Python_2R

Python_2R

KG - Professional Development

20 Qs

Tech Triad Quiz

Tech Triad Quiz

University

20 Qs

Code-101

Code-101

University

20 Qs

CSE 102 Exam 2 Practice

CSE 102 Exam 2 Practice

University

15 Qs

Python-Basic

Python-Basic

3rd Grade - University

15 Qs

Python Programming Intermediate-1

Python Programming Intermediate-1

University

15 Qs

PYTHON REVISION

PYTHON REVISION

University

20 Qs

Mastering Python Programming

Mastering Python Programming

Assessment

Quiz

Computers

University

Easy

Created by

Lokesh Malviya

Used 4+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the basic data types in Python?

char, list, tuple, dict

int, float, array, set

string, number, boolean, object

int, float, str, bool

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create a list in Python?

You create a list in Python using curly braces, e.g., my_list = {item1, item2, item3}.

You create a list in Python using square brackets, e.g., my_list = [item1, item2, item3].

You create a list in Python by using parentheses, e.g., my_list = (item1, item2, item3).

You create a list in Python with the list() function, e.g., my_list = list(item1, item2, item3).

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'if' statement in Python?

To define a function in Python.

To execute code conditionally based on a boolean expression.

To create a loop that iterates over a list.

To import modules and libraries in Python.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the use of 'for' loops in Python.

'for' loops in Python are used to iterate over sequences or iterables, executing a block of code for each element.

'for' loops can only iterate over numbers in Python.

'for' loops are used to create classes in Python.

'for' loops are used to define functions in Python.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

A function is a built-in data type in Python.

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

A function is defined using the 'function' keyword.

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

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you import a module in Python?

You can import a module by typing 'include module_name'

Import modules using 'load module_name'

Use the 'import' statement, e.g., 'import module_name'.

Use the 'require' statement, e.g., 'require(module_name)'

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'with' statement in file handling?

To read the contents of a file line by line without closing it.

To create a new file if it does not exist during the operation.

To append data to an existing file without any restrictions.

To ensure proper management of file resources by automatically closing the file after its block of code is executed.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?