wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Programming Quiz

Total questions: 120

Worksheet time: 3600secs

Name
Class
Date
1.

Which built-in Python module provides support for regular expressions?

a)

search

b)

regexp

c)

pattern

d)

regex

e)

re

2.

What does the command plt.plot([1, 2, 3, 4], [1, 4, 2, 3]) do in Matplotlib?

a)

Forms a pie chart

b)

Plots a heatmap

c)

Plots a line chart

d)

Displays a histogram

e)

Creates a bar chart

3.

What does inheritance do in the example 'class Dog(Animal):'?

a)

Dog receives all methods and attributes of Animal

b)

Dog turns Animal into an abstract class

c)

Dog is no longer an object

d)

Dog deletes Animal's methods

e)

Dog cannot add its own methods

4.

Which Python string method removes whitespace from both ends of a string?

a)

replace()

b)

split()

c)

join()

d)

strip()

e)

lower()

5.

What is the general message from the lecture: "Using GPU is not magic"?

a)

It is an experimental approach not recommended for use

b)

It is an outdated technology

c)

It is a natural step in data analysis evolution when data volumes become too large for CPU processing

d)

It is a marketing slogan with no practical value

e)

GPU is only suitable for gaming, not for analytics

6.

Which command creates a 3×3 identity matrix in NumPy?

a)

np.identity()

b)

np.matrix(3)

c)

np.ones(3,3)

d)

np.zeros(3,3)

e)

np.eye(3)

7.

How to correctly create an object of the Dog class with the name "Bobby" and age 5?

a)

Dog.dog("Bobby", 5)

b)

Dog["Bobby", 5]

c)

dog = Dog.name("Bobby", 5)

d)

dog = Dog("Bobby", 5)

e)

new Dog("Bobby", 5)

8.

What is a decorator in Python?

a)

A function that takes another function and extends its behavior without modifying the original code

b)

A tool for compiling Python into machine code

c)

A method for sorting lists

d)

A class for creating graphical interfaces

e)

A way to declare global variables

9.

What are Series and DataFrame objects used for in Pandas?

a)

Series --- analogous to Python lists, DataFrame --- analogous to tuples

b)

Series --- one-dimensional data with indices, DataFrame --- two-dimensional tables with column and row names

c)

Both are used exclusively for visualization

d)

Series --- a service data type for NumPy

e)

Series --- only for string data, DataFrame --- only for numeric data

10.

What is object-oriented programming (OOP)?

a)

A programming language alternative to Python

b)

A set of standard libraries for working with files

c)

A way to write programs using only functions without data

d)

A method for optimizing code execution speed on the processor

e)

A paradigm where the program is built around objects that combine data and behavior

11.

Which pytest flag enables verbose output of test results?

a)

-k (keyword filter)

b)

-s (capture off)

c)

-v (verbose)

d)

-x (exit on first failure)

e)

-q (quiet)

12.

Which class name corresponds to Python conventions (PEP 8)?

a)

UserProfile

b)

userprofile

c)

USER_PROFILE

d)

user_profile

e)

user-Profile

13.

What is an object (instance of a class)?

a)

A description of a class without creating it

b)

A specific instance created from a class

c)

The name of the program file

d)

Any Python module

e)

Only an integer or string

14.

Which Python library is primarily used to fetch (download) HTML pages from web servers?

a)

json

b)

requests

c)

nltk

d)

pymorphy2

e)

BeautifulSoup

15.

Which library is the foundation of numerical computing in Python?

a)

NumPy

b)

Requests

c)

Matplotlib

d)

TensorFlow

e)

Pandas

16.

What does MRO (Method Resolution Order) determine in Python?

a)

The priority between abstract and concrete methods

b)

The order of calling constructors in composition

c)

The order in which Python searches for methods in the class hierarchy during inheritance

d)

The priority when calling 'super()' in single inheritance

e)

The sequence in which modules are imported

17.

Which library is responsible for plotting density plots?

a)

Seaborn (sns.kdeplot(data))

b)

Tkinter

c)

NumPy

d)

Plotly

e)

Pandas

18.

When is the @pytest.mark.xfail marker used?

a)

When a test requires an internet connection

b)

When a test uses deprecated functions

c)

When a test needs to be executed first

d)

When a test works only on Windows

e)

When a test is expected to fail due to a known bug

19.

How to access the class attribute Dog.species from the object my_dog?

a)

my_dog["species"]

b)

my_dog.species

c)

species.my_dog

d)

getattr("my_dog", "species") without passing the object itself

e)

Dog[my_dog].species

20.

In the example 'class Duck(Flyer, Swimmer):', what methods will be available to a 'duck' object?

a)

Only 'quack()' and methods from Flyer

b)

Only methods that were called via 'super()'

c)

Only methods from the first parent (Flyer)

d)

Only methods that were overridden in 'Duck'

e)

fly(), swim(), and Duck's own methods (e.g., quack())

21.

Besides using parent's methods, what else can a child class do?

a)

Add new methods and attributes, and override existing methods

b)

Force the use of only the parent's implementation

c)

Change the parent's MRO (Method Resolution Order)

d)

Use only composition

e)

Completely ignore the parent's init

22.

What is a fixture in the context of testing?

a)

A decorator for skipping tests

b)

A pytest configuration file

c)

Prepared data or objects that are passed into tests

d)

A code debugging tool

e)

A report on test results

23.

How does a class attribute differ from an instance attribute?

a)

A class attribute exists only at runtime, an instance attribute only at compile time

b)

A class attribute can be modified, while an instance attribute can only be read

c)

A class attribute is common to all objects of that class, an instance attribute is unique to each object

d)

A class attribute is stored in a file, while an instance attribute is only in memory

e)

There is no difference; these are two names for the same thing

24.

Which statement best describes the difference between a class and an object?

a)

A class is used only for built-in types, an object only for custom types

b)

An object describes structure, and a class stores data

c)

A class describes structure and behavior, an object is a specific representative with that behavior and data

d)

A class exists only at runtime, and an object only at compile time

e)

A class and an object are the same thing

25.

Which Matplotlib backend is most commonly used for the Tkinter graphical interface?

a)

GTK3Agg

b)

Agg

c)

Qt5Agg

d)

WXAgg

e)

TkAgg

26.

How is a private attribute conventionally denoted in Python?

a)

The name starts with one underscore: _balance

b)

The name is written in UPPERCASE: BALANCE

c)

The name is placed in quotes: "balance"

d)

The name ends with the word private: balance_private

e)

The name starts with two underscores: __balance

27.

Which code creates a pie chart in Matplotlib?

a)

plt.piechart([20, 30, 50])

b)

plt.bar([20, 30, 50])

c)

plt.pie([20, 30, 50], labels=['A', 'B', 'C'], autopct='%1.1f%%')

d)

plt.circle([20, 30, 50])

e)

plt.plot(['A', 'B', 'C'], [20, 30, 50])

28.

Why are the attributes '__username' and '__password' made private in the 'UserAccount' class?

a)

To prevent instances from being created

b)

To protect data and control access through methods

c)

So that Python automatically encrypts the strings

d)

To make them inaccessible inside the class

e)

To make the class abstract

29.

How does the list [Firewall(), Antivirus(), IDS()] demonstrate polymorphism if each object has a 'protect()' method?

a)

Each object implements 'protect()' in its own way, and the loop calls them uniformly

b)

The loop works only with descendants of Firewall

c)

The loop forbids different implementations

d)

The loop changes the class of objects on the fly

e)

The loop calls methods by variable name

30.

Which NLTK function tokenizes text into individual words?

a)

tokenize()

b)

split()

c)

word_tokenize()

d)

sent_tokenize()

e)

words()

31.

What is the main drawback of GPU computing, as mentioned in the lecture?

a)

GPU does not support NumPy libraries

b)

Conda cannot be used for GPU

c)

The need to reinstall Python

d)

Transferring data between CPU and GPU creates a bottleneck and requires more time

e)

GPU does not work with large files

32.

Which library is the GPU analog of the Pandas DataFrame?

a)

cuDF

b)

torchdata

c)

CuPy

d)

numba

e)

cuML

33.

Why check the uniqueness of identifiers in data?

a)

To add indexes to the database

b)

To detect duplicate records or errors in identifier assignment

c)

To speed up data sorting

d)

To reduce file size

e)

To convert data to JSON

34.

What does checking the range of values in data mean?

a)

That the data is sorted in ascending order

b)

That the file does not exceed a certain size

c)

That values fall within acceptable limits (e.g., age from 18 to 120)

d)

That all values are the same

e)

That a column contains only text

35.

What is the @property decorator used for?

a)

So that the method is executed only once in the entire program

b)

So that the method becomes a top-level function

c)

So that the method becomes private and inaccessible from outside

d)

So that a method can be accessed like an attribute (without parentheses)

e)

So that the method automatically saves data to a file

36.

What does data validation for missing values check?

a)

That the data is encrypted

b)

That strings are sorted alphabetically

c)

That all numbers are positive

d)

That the file has a .csv extension

e)

That there are no empty values (NaN, None) in the specified columns

37.

What is the main goal of automated data testing?

a)

To speed up loading data into memory

b)

To detect errors and anomalies in data before using it in analysis

c)

To create data visualization

d)

To convert data into another format

e)

To reduce the dataset size

38.

Which construct is used to check the Method Resolution Order (MRO) for a class D?

a)

dir(D)

b)

type(D).mro

c)

D.mro()

d)

print(D.resolution_order)

e)

D.mro

39.

Which regular expression pattern is commonly used to match email addresses?

a)

[a-zA-Z0-9_.−]+@[a-zA-Z0-9.−]+.[a-z]{2}

b)

\w+@\w+

c)

email:\d+$+@\S+

d)

[a-z]+@[a-z]+.[a-z]{2,}

e)

A[a-z]+@[a-z]+$

40.

Which regex method removes HTML tags by replacing them with empty strings?

a)

text.strip()

b)

re.sub(r'<[^>]+>', '', text)

c)

text.replace('<', '')

d)

re.findall('', text)

e)

BeautifulSoup.get_text()

41.

What is the main purpose of using virtual environments in Python?

a)

Project File Management

b)

Speeding up code execution

c)

Automatic code formatting

d)

Isolation of libraries for different projects

42.

How many times will the print(count) instruction be executed?

a)

5

b)

4

c)

0

d)

1

e)

3

43.

What is the difference between for and while loops in Python?

a)

for can be interrupted using break, but while cannot

b)

while is always executed at least once, and for may not be executed even once

c)

for requires explicit counter indication, while does not

d)

for is always used to iterate through the sequence, and while is used to execute code while the condition is true

44.

Which tool is most often used to install third-party Python libraries?

a)

pip

b)

gem

c)

npm

d)

apt-get

45.

What result will be displayed in the console (check_number(5))?

a)

Odd

b)

Mistake

c)

Even and less than or equal to 10

d)

Even and greater than 10

46.

What do Python code blocks mean (instead of curly braces)?

a)

Two dots at the beginning of the block without indentation

b)

In quotation marks

c)

Indentation (intervals/tabs)

d)

With special characters #BEGIN/#END

47.

What will be the result of executing the code with a = 0 and for loop?

a)

0

b)

1

c)

2

d)

3

48.

In the try-except-finally block, which block of code is guaranteed to be executed?

a)

finally

b)

Only except (if an error has occurred)

c)

Only try

d)

None of them

49.

When refactoring code into a modular structure, which actions are MANDATORY?

a)

Rename all variables according to the same standard

b)

Ensuring weak connectivity between the created modules

c)

Separation of logically related functions into separate modules (.py files)

d)

Defining clear interfaces (which functions and with which parameters the module exports)

50.

What will be displayed in the console (10 / 2 with try-except-finally)?

a)

Division by zero!

b)

The operation was successful

c)

Operation successful

d)

Completion

51.

Which situations are valid indicators that the code requires refactoring?

a)

The calculate_total function is very large

b)

To correct an error, changes are needed in three different files

c)

The same input verification is repeated in five functions

d)

Adding a new feature causes unexpected errors in other modules

e)

The code has been working fine for 2 years

52.

Specify ALL the advantages of the SRP principle:

a)

A function has one responsibility

b)

No comments needed in the code

c)

The code is easier to test

d)

Debugging is simplified

e)

The program execution speed is reduced

53.

What happens when executing: my_tuple = (1, [2, 3], 4); my_tuple.append(5)?

a)

Mistake: 'tuple' object does not support item assignment

b)

(1, [2, 3], 4)

c)

(1, [2, 3, 5], 4)

54.

What is NOT the purpose of modularity?

a)

Error localization

b)

Code reuse

c)

Complete exclusion of errors from the program

d)

Simplify development by splitting it into parts

55.

Which are the advantages of modularity in software development?

a)

Reuse of module code

b)

Information hiding (Encapsulation)

c)

Localization of errors

d)

Automatic correction of all errors

e)

Simplify development

56.

Which statement about the result is INCORRECT?

a)

Key 1 contains the list

b)

Key 3 contains the list

c)

The setdefault() function creates a new list if there is no key

d)

Key 2 contains the list [2, 4] (the order is guaranteed)

57.

What is the Pandas library used for?

a)

For working with structured data: tables, time series, statistics

b)

For working with binary files

c)

For solving differential equations

d)

For creating low-level plots

e)

For managing system processes

58.

What does the json.load() function do?

a)

Saves JSON data to a file

b)

Reads a CSV file

c)

Loads JSON data from a file object

d)

Extracts text from HTML

e)

Converts a string to JSON

59.

What is a class in Python?

a)

A template (blueprint) for creating objects

b)

A string variable describing an object

c)

A separate function not related to data

d)

A special type of comment in the source code

e)

A specific object in memory

60.

What is tokenization in text processing?

a)

Finding patterns using regular expressions

b)

Cleaning text from HTML tags

c)

Converting words to their base forms

d)

Splitting text into individual meaningful units (tokens)

e)

Removing stop words from text

61.

Which file on a website specifies rules for web crawlers about which pages can be accessed?

a)

config.json

b)

robots.txt

c)

terms.txt

d)

sitemap.xml

e)

index.html

62.

Which OOP property allows working with objects of different classes through a unified interface?

a)

Inheritance

b)

Encapsulation

c)

Abstraction

d)

Composition

e)

Polymorphism

63.

What is a library in Python?

a)

A collection of pre-written code (functions, classes, objects) designed to solve specific tasks.

b)

A graphical interface for data visualization.

c)

A storage location for all variables in a project.

d)

A special interpreter module that stores calculation results.

e)

A folder with Python installation files.

64.

What does the @pytest.mark.skip marker mean?

a)

The test will be executed twice

b)

The test will be skipped and not executed

c)

The test will run with higher priority

d)

The test will save the result to a file

e)

The test will run only in debug mode

65.

What are object methods?

a)

Functions defined inside a class that describe the behavior of an object

b)

Any functions declared in a module

c)

Only built-in Python functions (print, len, etc.)

d)

Special variables storing project settings

e)

Operating system constructors

66.

When is the init method called?

a)

When the object is deleted by the garbage collector

b)

When the program finishes

c)

Every time any method of the object is called

d)

When creating a new object of the class

e)

Only when importing the module where the class is declared

67.

What advantage of OOP is illustrated by the example with 10,000 characters in a city simulator?

a)

Speeding up the program 10 times without changing algorithms

b)

Reducing duplicate code by using one Person class instead of thousands of similar variables and functions

c)

Automatic creation of a graphical interface

d)

Ability to run the program only on a server

e)

Complete absence of runtime errors

68.

In BeautifulSoup, which method finds ALL elements with a specified tag?

a)

find()

b)

find_all()

c)

get_text()

d)

select_one()

e)

extract()

69.

What happens when trying to create an instance of the abstract class 'Shape(ABC)'?

a)

A 'TypeError' occurs because an instance of an abstract class cannot be created.

b)

The 'pass' implementation is used.

c)

The 'init' from 'object' is called.

d)

The 'area()' method is called by default.

e)

Python automatically creates an implementation for all abstract methods.

70.

Which relationship describes Composition ('Has-a'), as opposed to Inheritance ('Is-a')?

a)

An object of one class is another class.

b)

Both relationships are identical in nature.

c)

An object of one class replaces another class.

d)

An object of one class contains an instance of another class.

e)

An object of one class calls a method of another class.

71.

Why is the 'Cipher' class declared as abstract with 'abstractmethod encrypt/decrypt'?

a)

To be able to create instances of 'Cipher()'.

b)

To force child classes to implement both methods.

c)

To hide the methods from the interpreter.

d)

To automatically log operations.

e)

To prohibit inheritance.

72.

What is the primary function of calling 'super().method_name()' in a child class method?

a)

To disable encapsulation for that method.

b)

To force a call to 'init' from the 'object' class.

c)

To call the corresponding method from the nearest parent class according to MRO.

d)

To define a new abstract method.

73.

How to group data in Pandas by the 'group' column and calculate the mean?

a)

df.group('group').avg()

b)

pd.mean(df['group'])

c)

df.sort('group').avg()

d)

df.aggregate('group', 'mean')

e)

df.groupby('group').mean()

74.

In a typical text processing pipeline, which stage usually follows tokenization?

a)

Text vectorization

b)

Removing stop words

c)

Parsing from web sources

d)

Sentiment analysis

e)

Normalization (stemming/lemmatization)

75.

Why is 'super().init(...,...)' called in 'Ransomware.init(...)'?

a)

To bypass type checking.

b)

To hide the parent's attributes.

c)

To create a new 'Malware' object.

d)

To initialize fields of the parent class 'Malware', such as 'name'.

e)

To override the 'attack' method.

76.

Which Python library is specifically designed for lemmatizing Russian words?

a)

nltk

b)

pymorphy2

c)

requests

d)

re

e)

BeautifulSoup

77.

Why is referential integrity data validation needed?

a)

To encrypt data

b)

To ensure that related records exist in the corresponding tables

c)

To remove all duplicates

d)

To convert data types

e)

To create a backup

78.

In which case is it better to use Composition instead of Inheritance?

a)

When polymorphism through a common hierarchy is required.

b)

When it is necessary to forcefully override a method.

c)

When a class is a specialization of another class (e.g., 'Ransomware' is 'Malware').

d)

When using multiple inheritance.

e)

When an object has another functionality but is not (e.g., a Car has an Engine).

79.

What are object attributes?

a)

Files where the class source code is saved

b)

Comments describing the code

c)

Data (state) stored inside an object

d)

Only methods that the object can execute

e)

Imported modules used by the program

80.

What is the pytest module used for?

a)

For data visualization

b)

For asynchronous programming

c)

For writing and running automated tests

d)

For working with databases

e)

For creating web applications

81.

Which regular expression pattern is commonly used to match email addresses? (Alternative version)

a)

email:\s*\S+@\S+

b)

\w+@\w+

c)

A[a-z]+@[a-z]+

d)

[a-zA-Z0-9._%+−]+@[a-zA-Z0-9.−]+.[a-zA-Z]{2,}

e)

[a-z]+@[a-z]+

82.

Which regex method removes HTML tags by replacing them with empty strings? (Alternative version)

a)

re.sub(r'<[^>]+>', '', text) or re.sub(r'<.*?>', '', text)

b)

BeautifulSoup.get_text()

c)

text.strip()

d)

re.findall(r'<.?>', text)

e)

text.replace('<', '')

83.

What is the main difference between for and while loops in Python?

a)

for requires explicit counter indication, while does not.

b)

for can be interrupted using break, but while cannot.

c)

while is always executed at least once, and for may not be executed even once.

d)

for is always used to iterate through the sequence, and while is used to execute code while the condition is true.

84.

What function in Python should be used to determine the data type of a variable?

a)

get_type()

b)

type()

c)

typeof()

d)

datatype()

85.

How many times will the print(count) instruction be executed in the following code?

a)

3

b)

4

c)

infinite

d)

5

86.

What will be displayed in the console?

a)

5

b)

15

c)

3

d)

10

e)

0

87.

What code should I insert instead of ??? to find the symmetric difference of the sets?

a)

union

b)

symmetric_difference

c)

differenc

d)

intersection

88.

What are the advantages of a modular project structure (choose ALL the right ones)?

a)

Renaming of all functions can be used.

b)

A mistake in one module won't break the whole project.

c)

Different people can work on different modules.

d)

The code becomes definitely shorter.

e)

Reuse of modules in other projects.

89.

Which of these properties is not a typical problem of the 'spaghetti code'?

a)

Excessive modularity

b)

Unreusability

c)

Testing difficulty

d)

Unintelligibility

e)

Unmaintainability

90.

Which of the statements about hash functions are CORRECT?

a)

The hash function should be calculated quickly.

b)

The hash function ensures that there are no collisions for any data.

c)

A small change in the input data should cause a significant change in the hash.

d)

In Python, hash((1, 2)) will be equal to hash([1, 2]).

91.

Which of the following variable names is invalid in Python?

a)

1st_number

b)

totalSum

c)

def

d)

!data

e)

_count

92.

Which version of the Python code sets the condition block correctly?

a)

if (x > 0) then print('positive')

b)

if x > 0 { print('positive') }

c)

if x > 0 print('positive')

d)

if x > 0: print('positive') # in one line

93.

What will be the result of executing the following code?

a)

2

b)

1

c)

0

d)

3

94.

When refactoring the 'spaghetti code' into a modular structure, which of the listed actions are MANDATORY? Select all the correct ones.

a)

Defining clear interfaces (which functions and with which parameters the module exports).

b)

Separation of logically related functions into separate modules (.py files).

c)

Ensuring weak connectivity between the created modules.

d)

Rename all variables according to the same naming convention.

95.

What is the main purpose of using virtual environments in Python?

a)

Isolation of libraries for different projects

b)

Speeding up code execution

c)

Automatic code formatting

d)

Project File Management

96.

What command is used to create a new virtual environment named venv?

a)

new-env venv

b)

python -m venv venv

c)

make-virtual-env venv

d)

create venv

97.

Why is this code causing an error?

a)

Incorrect syntax for creating a dictionary

b)

The tuple (1, 2) cannot be a dictionary key

c)

You can't mix different types of data in dictionary keys.

d)

The list [3, 4] cannot be a dictionary key, as it is mutable and non-hashed.

98.

Which of the following cases violates the DRY principle?

a)

The calculate_total function has become so large that it takes up 4 screens to scroll.

b)

Adding a new feature (for example, sending SMS) causes unexpected errors in the report generation module.

c)

The code has been working fine and requires no changes for 2 years now.

d)

The same sequence of actions for verifying user input is repeated in five different functions in main.py.

99.

What is NOT the purpose of modularity?

a)

Error localization

b)

Code reuse

c)

Simplify development by splitting it into parts

d)

Complete exclusion of errors from the program

100.

Which tool is most often used to install third-party Python libraries?

a)

npm

b)

apt-get

c)

gem

d)

pip

101.

What happens when executing this code?

a)

An empty Counter will be created for 'user3' and 0 will be returned for the 'view' key.

b)

None will return

c)

The KeyError error is because there is no 'user3' key.

102.

What result will the expression return, provided that the string is passed in the original case?

a)

['hello']

b)

['Привет', 'hello', '123', 'мир']

c)

[]

d)

['Hello', 'hello', 'world']

103.

Which of the following operations with Counter are CORRECT?

a)

c1 / c2 - division of counters

b)

c1 | c2 - union (maxima)

c)

c1 & c2 - intersection (minima)

d)

c1 - c2 - counter subtraction (positive results only)

e)

c1 + c2 - adding counters

104.

What is meant by a 'large ecosystem of libraries' in the context of Python?

a)

Only built-in libraries from Python developers

b)

Availability of packages for scientific computing and AI development

c)

A set of third-party packages for different fields (web, science, AI, automation) available through package managers

d)

A small number of standard modules in the distribution

105.

Specify ALL the advantages of the SRP principle:

a)

Debugging is simplified

b)

The program execution speed is reduced

c)

No comments needed in the code

d)

A function has one responsibility

106.

Which of these situations are valid indicators that the code requires refactoring and applying modularity principles?

a)

Adding a new feature (for example, sending SMS) causes unexpected errors in the report generation module

b)

The code has been working fine and requires no changes for 2 years now.

c)

To correct an error in the discount calculation algorithm, you have to make changes in the code of three different modules.

d)

The calculate_total function has become so large that it takes up 4 screens to scroll.

107.

Specify ALL the advantages of the SRP (Single Responsibility Principle):

a)

No comments needed in the code

b)

The program execution speed is reduced

c)

Debugging is simplified

d)

A function has one responsibility

e)

The code is easier to test

108.

Which of the following statements describe the advantages of using functions in Python? (Select all appropriate options)

a)

Functions allow you to split the code into named, self-contained fragments.

b)

Functions allow you to use input parameters and return values.

c)

The functions contribute to compliance with the principle of single responsibility (SRP).

d)

Functions make debugging more difficult because the code is broken into parts.

e)

The functions help to reduce code duplication by following the DRY principle.

109.

What happens when executing this code?

a)

(1, [2, 3], 4, 5)

b)

(1, [2, 3, 5], 4)

c)

Mistake: 'tuple' object does not support item assignment

d)

(1, [2, 3], 4)

110.

When starting main.py error occurs: ModuleNotFoundError: No module named 'student_management'. What is the MOST LIKELY cause of the error?

a)

In the file student_management.py there is no add_student function.

b)

Incorrect import syntax. To import correctly from a subfolder, use from student_system.student_management import add_student.

c)

The DRY principle has not been applied.

d)

The SRP principle is violated in the student_management module.

111.

Which of the following operations with tuples are CORRECT?

a)

a, b, 'test' = (1, 2, 3, 4, 5)

b)

x, y = (10, 20)

c)

new_tuple = old_tuple + (6, 7)

d)

my_tuple = 100 (changing a tuple element)

e)

coordinates = (lat, lon) = (43.22, 76.85)

112.

Which of the following operations with Counter are CORRECT?

a)

c1 - c2 → counter subtraction (positive results only)

b)

c1 / c2 → division of counters

c)

c1 + c2 → adding counters

d)

c1 & c2 → intersection (minima)

e)

c1 | c2 → union (maxima)

113.

The code is given. Which of the statements about the result is INCORRECT?

a)

The setdefault() function creates a new list if there is no key

b)

Key 1 contains the list

c)

Key 3 contains the list

d)

Key 2 contains the list [2, 4] (the order is guaranteed)

114.

Which of the above are the advantages of modularity in software development? (Select all the appropriate options)

a)

Information hiding (Encapsulation)

b)

Simplify development (the ability for different teams to work on different modules)

c)

Improving the execution speed of the entire application

d)

Localization of errors (an error in one module is less likely to break the entire system)

e)

Reuse of module code in other projects

115.

What do Python code blocks mean (instead of curly braces)?

a)

Two dots at the beginning of the block without indentation

b)

In quotation marks

c)

Indentation (intervals/tabs)

d)

With special characters #BEGIN/#END

116.

Which of the following cases violates the DRY (Don't Repeat Yourself) principle?

a)

One function calculates the discount, the other applies the tax

b)

Three different functions for working with different types of products

c)

The discount calculation code is repeated in three places of the program

117.

Which of the following are the advantages of modularity in software development? (Select all appropriate options)

a)

Simplify development (the ability for different teams to work on different modules)

b)

Automatic correction of all errors in the project

c)

Information hiding (Encapsulation)

d)

Localization of errors (an error in one module is less likely to break the entire system)

e)

Reuse of module code in other projects

118.

Which of the following operations with tuples are CORRECT?

a)

my_tuple = 100 (changing a tuple element)

b)

coordinates = (lat, lon) = (43.22, 76.85)

c)

*a, b, rest = (1, 2, 3, 4, 5)

d)

new_tuple = old_tuple + (6, 7)

e)

x, y = (10, 20)

119.

Which of the following statements describe the advantages of using functions in Python? (Select all appropriate options)

a)

The functions contribute to compliance with the principle of single responsibility (SRP)

b)

Functions always speed up program execution by compiling.

c)

The functions help to reduce code duplication by following the DRY principle.

d)

Functions make debugging more difficult because the code is broken into parts.

e)

Functions allow you to use input parameters and return values.

120.

When starting main.py error occurs. The project structure looks like this. Error in the import line in main.py: from student_management import add_student. What is the MOST LIKELY cause of the error?

a)

In the file student_management.py there is no add_student function.

b)

Incorrect import syntax. To import correctly from a subfolder, use from student_system.student_management import add_student.

c)

The DRY principle has not been applied.

d)

The SRP principle is violated in the student_management module.