What is Big O notation?
Answer:
For example, O(n) grows linearly, O(n²) - quadratically, O(1) - does not depend on the size of the input.
Big O does not give exact figures, but allows you to compare algorithms in terms of their scalability.
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
❤8
What is
__slots__?Answer:
There is one restriction: it is not possible to add an attribute that is notslotsts__. To retain the ability to dynamically create fields, you can dictct__ to the list of slots.
tags:
Please open Telegram to view this post
VIEW IN TELEGRAM
❤6👎1
❗️LISA HELPS EVERYONE EARN MONEY!$29,000 HE'S GIVING AWAY TODAY!
Everyone can join his channel and make money! He gives away from $200 to $5.000 every day in his channel
https://news.1rj.ru/str/+YDWOxSLvMfQ2MGNi
⚡️FREE ONLY FOR THE FIRST 500 SUBSCRIBERS! FURTHER ENTRY IS PAID! 👆👇
https://news.1rj.ru/str/+YDWOxSLvMfQ2MGNi
Everyone can join his channel and make money! He gives away from $200 to $5.000 every day in his channel
https://news.1rj.ru/str/+YDWOxSLvMfQ2MGNi
⚡️FREE ONLY FOR THE FIRST 500 SUBSCRIBERS! FURTHER ENTRY IS PAID! 👆👇
https://news.1rj.ru/str/+YDWOxSLvMfQ2MGNi
❤3
What is a message broker and which ones are typically used with Python?
Answer:
In Python projects, RabbitMQ, Apache Kafka, and Redis are often used as simple broker solutions (for example, in combination with Celery). The choice depends on the tasks: Kafka for stream processing, RabbitMQ for flexible routing, and Redis for simple queues.
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
❤5
What is an S3 storage and what is it used for?
Answer:
It is scalable, reliable, and provides access to files via URLs. Unlike traditional file systems, S3 does not have a folder hierarchy — everything is stored as objects in "buckets" (containers), and access can be controlled through policies and permissions.
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
❤6
Why don't you need to store a session when using JWT?
Answer:
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
❤3
What is NoneType?
NoneType — is a type to which the object None belongs, which is used to indicate an absent or undefined value. In Python, it is unique — there is only one instance of this type, that is, the None itself
@DataScienceQ💚
@DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
❤3👍1
I need to calculate 100 equations — is it worth using threads for this?
Answer:
For such tasks, it's better to use processes (multiprocessing, ProcessPoolExecutor) or move the calculations to native code (NumPy, C/C++ libraries). If the calculations are not large in size, parallelization may not pay off at all — then it's more reasonable to calculate sequentially.
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
❤3
Forwarded from Machine Learning with Python
This channels is for Programmers, Coders, Software Engineers.
0️⃣ Python
1️⃣ Data Science
2️⃣ Machine Learning
3️⃣ Data Visualization
4️⃣ Artificial Intelligence
5️⃣ Data Analysis
6️⃣ Statistics
7️⃣ Deep Learning
8️⃣ programming Languages
✅ https://news.1rj.ru/str/addlist/8_rRW2scgfRhOTc0
✅ https://news.1rj.ru/str/Codeprogrammer
Please open Telegram to view this post
VIEW IN TELEGRAM
❤2
Generated columns in PostgreSQL: speeding up filters without unnecessary calculations!
When the same expression is constantly calculated in
Create a table with a materialized expression:
Now
Filtering becomes easier and faster:
Add an index:
Check:
🔥 There should be a
🚪 @DataScienceQ
When the same expression is constantly calculated in
WHERE, queries slow down. In PostgreSQL, this is solved with GENERATED ALWAYS AS … STORED — the expression is calculated once and stored as a regular field.Create a table with a materialized expression:
CREATE TABLE events (
id BIGSERIAL PRIMARY KEY,
payload JSONB NOT NULL,
event_type TEXT GENERATED ALWAYS AS (payload->>'type') STORED
);
Now
event_type is no longer calculated on the fly — the value is directly in the row.Filtering becomes easier and faster:
SELECT id
FROM events
WHERE event_type = 'purchase';
Add an index:
CREATE INDEX idx_events_event_type
ON events(event_type);
Check:
EXPLAIN ANALYZE
SELECT id
FROM events
WHERE event_type = 'purchase';
Index Scan, without heavy operations on JSONB. Generated columns are great for repetitive calculations:Please open Telegram to view this post
VIEW IN TELEGRAM
❤5👏1
1. What data type is the variable
A. Integer
B. Float
C. String
D. Boolean
Correct answer: B.
2. What does the
A. Integer
B. Float
C. Boolean
D. String
Correct answer: D.
3. Which symbol is used to define a comment in Python?
A. //
B. /* */
C. #
D. --
Correct answer: C.
4. What does
A. First character
B. Last character
C. Second character
D. Entire string
Correct answer: B.
5. What is the result type of the
A. Integer
B. Float
C. Boolean
D. String
Correct answer: B.
6. Which operator is used for exponentiation?
A. ^
B. *
C. **
D. //
Correct answer: C.
7. Which logical operator in Python negates a condition?
A. and
B. or
C. not
D. !=
Correct answer: C.
8. What does
A. 1, 2, 3, 4
B. 1, 3
C. 2, 4
D. 0, 2, 4
Correct answer: B.
9. Which list method removes the last item?
A. remove()
B. delete()
C. pop()
D. clear()
Correct answer: C.
10. What is a tuple best described as?
A. A mutable list
B. A read-only list
C. A key/value store
D. A function container
Correct answer: B.
11. Which dictionary method safely returns a default value if a key is missing?
A. index()
B. find()
C. get()
D. pop()
Correct answer: C.
12. What is returned by a function that has no
A. 0
B. False
C. Empty string
D. None
Correct answer: D.
13. Which exception is raised when dividing by zero?
A. ValueError
B. TypeError
C. ZeroDivisionError
D. IndexError
Correct answer: C.
14. What is the purpose of the
A. To delete objects
B. To initialize objects
C. To inherit methods
D. To define modules
Correct answer: B.
15. Which command installs a package from PyPI?
A. python install openpyxl
B. install pip openpyxl
C. pip add openpyxl
D. pip install openpyxl
Correct answer: D.
rating = 4.9?A. Integer
B. Float
C. String
D. Boolean
Correct answer: B.
2. What does the
input() function always return?A. Integer
B. Float
C. Boolean
D. String
Correct answer: D.
3. Which symbol is used to define a comment in Python?
A. //
B. /* */
C. #
D. --
Correct answer: C.
4. What does
course[-1] return for a non-empty string?A. First character
B. Last character
C. Second character
D. Entire string
Correct answer: B.
5. What is the result type of the
/ operator in Python?A. Integer
B. Float
C. Boolean
D. String
Correct answer: B.
6. Which operator is used for exponentiation?
A. ^
B. *
C. **
D. //
Correct answer: C.
7. Which logical operator in Python negates a condition?
A. and
B. or
C. not
D. !=
Correct answer: C.
8. What does
range(1, 5, 2) generate?A. 1, 2, 3, 4
B. 1, 3
C. 2, 4
D. 0, 2, 4
Correct answer: B.
9. Which list method removes the last item?
A. remove()
B. delete()
C. pop()
D. clear()
Correct answer: C.
10. What is a tuple best described as?
A. A mutable list
B. A read-only list
C. A key/value store
D. A function container
Correct answer: B.
11. Which dictionary method safely returns a default value if a key is missing?
A. index()
B. find()
C. get()
D. pop()
Correct answer: C.
12. What is returned by a function that has no
return statement?A. 0
B. False
C. Empty string
D. None
Correct answer: D.
13. Which exception is raised when dividing by zero?
A. ValueError
B. TypeError
C. ZeroDivisionError
D. IndexError
Correct answer: C.
14. What is the purpose of the
__init__ method in a class?A. To delete objects
B. To initialize objects
C. To inherit methods
D. To define modules
Correct answer: B.
15. Which command installs a package from PyPI?
A. python install openpyxl
B. install pip openpyxl
C. pip add openpyxl
D. pip install openpyxl
Correct answer: D.
❤2👍2
PyData Careers
Photo
1. What will be the output of the following code?
A. [1] then [2]
B. [1] then [1, 2]
C. Error due to mutable default
D. [] then []
Correct answer: B.
2. What is the result of this expression?
A. a = [1,2,3], b = [1,2,3]
B. a = [1,2,3,4], b = [1,2,3]
C. a = [1,2,3,4], b = [1,2,3,4]
D. Raises TypeError
Correct answer: C.
3. What does this code print?
A. True True True
B. False False False
C. False True False
D. True False True
Correct answer: B.
4. What is the output?
A. 10
B. 20
C. 25
D. UnboundLocalError
Correct answer: C.
5. What happens when this code is executed?
A. 1
B. 2
C. AttributeError
D. KeyError
Correct answer: B.
6. What is printed?
A. True
B. False
C. SyntaxError
D. Depends on Python version
Correct answer: B.
7. What does this code output?
A. [0, 1, 2]
B. [1, 2, 3]
C. range(0, 3)
D. Error
Correct answer: A.
8. What is the result?
A. Error: tuple is immutable
B. (1, 2, [3, 4])
C. (1, 2, [3, 4, 5])
D. (1, 2, 5)
Correct answer: C.
9. What does this print?
A. {0, 1, 4}
B. {0: 0, 1: 1, 2: 4}
C. [(0,0),(1,1),(2,4)]
D. Error
Correct answer: B.
10. What is the output?
A. <class 'function'>
B. <class 'lambda'>
C. <class 'callable'>
D. <class 'object'>
Correct answer: A.
11. What happens here?
A. Nothing is printed
B. ZeroDivisionError only
C. Prints "done" then raises ZeroDivisionError
D. Prints "done" only
Correct answer: C.
12. What is printed?
A. True
B. False
C. Error
D. Depends on interpreter
Correct answer: B.
13. What does this code demonstrate?
A. Duck typing
B. Multiple inheritance
C. Polymorphism
D. Inheritance
Correct answer: D.
14. What is the output?
A. True True
B. False True
C. True False
D. False False
Correct answer: B.
15. What will this print?
A. 5
B. 3
C. UnboundLocalError
D. NameError
Correct answer: C.
16. What is the result?
A. False
B. True
C. TypeError
D. Order dependent
Correct answer: B.
17. What does this output?
A. <class 'list'>
B. <class 'tuple'>
C. <class 'generator'>
D. <class 'iterator'>
Correct answer: C.
18. What is printed?
A. [1,2,3,4]
B. [4]
C. [1,2,3]
D. Error
Correct answer: C.
19. What does this evaluate to?
A. False False
B. True True
C. True False
D. False True
Correct answer: B.
20. What is the output?
A. 1
B. 2
C. None
D. RuntimeError
Correct answer: B.
def f(x, l=[]):
l.append(x)
return l
print(f(1))
print(f(2))
A. [1] then [2]
B. [1] then [1, 2]
C. Error due to mutable default
D. [] then []
Correct answer: B.
2. What is the result of this expression?
a = [1, 2, 3]
b = a
a += [4]
A. a = [1,2,3], b = [1,2,3]
B. a = [1,2,3,4], b = [1,2,3]
C. a = [1,2,3,4], b = [1,2,3,4]
D. Raises TypeError
Correct answer: C.
3. What does this code print?
print(bool([]), bool({}), bool(()))A. True True True
B. False False False
C. False True False
D. True False True
Correct answer: B.
4. What is the output?
x = 10
def outer():
x = 20
def inner():
nonlocal x
x += 5
inner()
return x
print(outer())
A. 10
B. 20
C. 25
D. UnboundLocalError
Correct answer: C.
5. What happens when this code is executed?
class A:
def __init__(self):
self.x = 1
a = A()
a.__dict__['x'] = 2
print(a.x)
A. 1
B. 2
C. AttributeError
D. KeyError
Correct answer: B.
6. What is printed?
print([i for i in range(3)] is [i for i in range(3)])
A. True
B. False
C. SyntaxError
D. Depends on Python version
Correct answer: B.
7. What does this code output?
def gen():
yield from range(3)
print(list(gen()))
A. [0, 1, 2]
B. [1, 2, 3]
C. range(0, 3)
D. Error
Correct answer: A.
8. What is the result?
a = (1, 2, [3, 4])
a[2].append(5)
print(a)
A. Error: tuple is immutable
B. (1, 2, [3, 4])
C. (1, 2, [3, 4, 5])
D. (1, 2, 5)
Correct answer: C.
9. What does this print?
print({i: i*i for i in range(3)})A. {0, 1, 4}
B. {0: 0, 1: 1, 2: 4}
C. [(0,0),(1,1),(2,4)]
D. Error
Correct answer: B.
10. What is the output?
print(type(lambda x: x))
A. <class 'function'>
B. <class 'lambda'>
C. <class 'callable'>
D. <class 'object'>
Correct answer: A.
11. What happens here?
try:
1 / 0
finally:
print("done")
A. Nothing is printed
B. ZeroDivisionError only
C. Prints "done" then raises ZeroDivisionError
D. Prints "done" only
Correct answer: C.
12. What is printed?
x = [1, 2, 3]
print(x[::-1] is x)
A. True
B. False
C. Error
D. Depends on interpreter
Correct answer: B.
13. What does this code demonstrate?
class A: pass
class B(A): pass
print(issubclass(B, A))
A. Duck typing
B. Multiple inheritance
C. Polymorphism
D. Inheritance
Correct answer: D.
14. What is the output?
print(all([0, 1, 2]), any([0, 1, 2]))
A. True True
B. False True
C. True False
D. False False
Correct answer: B.
15. What will this print?
x = 5
def f():
print(x)
x = 3
f()
A. 5
B. 3
C. UnboundLocalError
D. NameError
Correct answer: C.
16. What is the result?
a = {1, 2, 3}
b = {3, 2, 1}
print(a == b)A. False
B. True
C. TypeError
D. Order dependent
Correct answer: B.
17. What does this output?
print(type((i for i in range(3))))
A. <class 'list'>
B. <class 'tuple'>
C. <class 'generator'>
D. <class 'iterator'>
Correct answer: C.
18. What is printed?
x = [1, 2, 3]
y = x.copy()
x.append(4)
print(y)
A. [1,2,3,4]
B. [4]
C. [1,2,3]
D. Error
Correct answer: C.
19. What does this evaluate to?
print(1 == True, 0 == False)
A. False False
B. True True
C. True False
D. False True
Correct answer: B.
20. What is the output?
def f():
try:
return 1
finally:
return 2
print(f())
A. 1
B. 2
C. None
D. RuntimeError
Correct answer: B.
❤6
What are lambdas and what are their features?
Answer:
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
❤2