Python Senior

1 / 11

Why do floating-point calculations seem inaccurate in Python?

Select the correct answer

1

Floating-point calculations seem inaccurate due to incorrect math operations.

2

Floating-point calculations seem inaccurate due to binary representation limitations.

3

Floating-point calculations seem inaccurate due to outdated Python versions.

4

Floating-point calculations seem inaccurate due to Python's internal bugs.

When Python program exits, why isn’t all the memory de-allocated?

Select the correct answer

1

Memory is de-allocated only in Python 3.

2

Memory is not de-allocated due to Python's memory leak.

3

All memory is de-allocated when a Python program exits.

4

Not all memory is de-allocated because of cyclic references and the garbage collector's limitations.

What is the difference between .py and .pyc files?

Select the correct answer

1

.py files contain the source code, while .pyc files contain the compiled bytecode.

2

.py files are compiled files, while .pyc files are source files.

3

.py files are used for documentation, while .pyc files are used for execution.

4

.py files are for testing, while .pyc files are for production.

How Python is interpreted?

Select the correct answer

1

Python is interpreted, meaning code is executed line by line.

2

Python is compiled, meaning code is converted to machine code.

3

Python is a hybrid language.

4

Python uses both compilation and interpretation simultaneously.

What is the process of compilation and linking in python?

Select the correct answer

1

Python code is compiled into bytecode, which is then interpreted.

2

Python code is compiled into machine code, which is then executed directly.

3

Python code is linked directly to the OS.

4

Python code is not compiled, it is interpreted line by line.

How is multithreading achieved in Python?

Select the correct answer

1

Multithreading in Python is not supported.

2

Multithreading in Python is achieved using the concurrent module.

3

Multithreading in Python is achieved using the multiprocessing module.

4

Multithreading in Python is achieved using the threading module.

What are function annotations in Python?

Select the correct answer

1

Function annotations in Python are used for exception handling.

2

Function annotations in Python are a form of comments.

3

Function annotations in Python are used to create abstract methods.

4

Function annotations in Python are a way of associating metadata with function arguments and return values.

What is monkey patching in Python?

Select the correct answer

1

Monkey patching is a way to document code.

2

Monkey patching is a method of testing code.

3

Monkey patching is dynamically modifying a class or module at runtime.

4

Monkey patching is creating multiple versions of a class.

What are generators in Python?

Select the correct answer

1

Generators in Python are used to create threads.

2

Generators in Python are a way to create iterators using yield statements.

3

Generators in Python are a way to create dictionaries using yield statements.

4

Generators in Python are functions that run indefinitely.

What are Eggs and Wheels in Python?

Select the correct answer

1

Eggs and Wheels are packaging formats used for distributing Python projects.

2

Eggs and Wheels are Python debugging tools.

3

Eggs and Wheels are Python IDEs.

4

Eggs and Wheels are tools for Python testing.

Describe memory management in Python.

Select the correct answer

1

Memory management in Python is only for built-in types.

2

Memory management in Python is handled by the Python memory manager and includes garbage collection.

3

Memory management in Python is handled by the operating system.

4

Memory management in Python is handled manually by the programmer.