PYTHON Viva-Voce Questions

PYTHON Viva-Voce Questions

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

Anusree CSE

FREE Resource

Student preview

quiz-placeholder

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 mins • 1 pt

Which of the following best describes the difference between a list and an array in Python?

Lists can store elements of different data types, while arrays require all elements to be of the same data type.

Lists are immutable, while arrays are mutable.

Arrays can store elements of different data types, while lists require all elements to be of the same data type.

Lists are used only for mathematical operations, while arrays are used for general data storage.

2.

MULTIPLE CHOICE QUESTION

20 mins • 1 pt

Functions are used because:

They help organize code and make it reusable.

They make the code run slower.

They increase the complexity of the code unnecessarily.

They are required for every program to run.

3.

MULTIPLE CHOICE QUESTION

20 mins • 1 pt

Which of the following methods can be used to add, remove, and modify elements in a list in Python?

append(), remove(), and indexing assignment

print(), input(), and len()

sort(), reverse(), and max()

open(), close(), and read()

4.

MULTIPLE CHOICE QUESTION

20 mins • 1 pt

A set in Python is different from a list because:

A set is an unordered collection of unique elements, while a list is an ordered collection that can have duplicates.

A set is an ordered collection that allows duplicates, while a list is unordered and only allows unique elements.

A set and a list are both ordered collections that allow duplicates.

A set is a mutable collection, while a list is immutable.

5.

MULTIPLE CHOICE QUESTION

20 mins • 1 pt

The difference between union(), intersection(), and difference() methods in sets is:

union() returns all unique elements from both sets, intersection() returns only common elements, and difference() returns elements present in the first set but not in the second.

union() returns only common elements, intersection() returns all unique elements, and difference() returns elements present in both sets.

union() returns elements present in the first set but not in the second, intersection() returns all unique elements, and difference() returns only common elements.

union() returns duplicate elements, intersection() returns all elements, and difference() returns only unique elements.

6.

MULTIPLE CHOICE QUESTION

20 mins • 1 pt

A tuple is different from a list in which of the following ways?

A tuple is immutable, while a list is mutable.

A tuple can only store numbers, while a list can store any data type.

A tuple is always longer than a list.

A tuple is used only for mathematical operations, while a list is used for general purposes.

7.

MULTIPLE CHOICE QUESTION

20 mins • 1 pt

Which of the following statements correctly differentiates between mutable and immutable sequence datatypes in Python?

Mutable sequences can be changed after creation, while immutable sequences cannot be changed after creation.

Immutable sequences can be changed after creation, while mutable sequences cannot be changed after creation.

Both mutable and immutable sequences can be changed after creation.

Neither mutable nor immutable sequences can be changed after creation.

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?