Coding interview preparation
5.8K subscribers
368 photos
52 files
163 links
Download Telegram
a = "10" → Variable a is assigned the string "10".

b = a → Variable b also holds the string "10" (but it's not used afterward).

a = a * 2 → Since a is a string, multiplying it by an integer results in string repetition.

"10" * 2 results in "1010"

print(a) → prints the new value of a, which is "1010".


Correct answer: D. 1010
Let’s analyze the Python code snippet from the image:

python
Copy
Edit
def add_n(a, b):
return (a + b)

a = 5
b = 5

print(add_n(4, 3))
Step-by-step explanation:
A function add_n(a, b) is defined to return the sum of a and b.

The variables a = 5 and b = 5 are declared but not used inside the function call — they are irrelevant in this context.

The function is called with explicit arguments: add_n(4, 3), so:

python
Copy
Edit
return 4 + 3 # = 7

Correct answer: C. 7
2👍1
Tkinter
1
WHY USE STREAMLIT
1
Remove Background with Python
Javascript Variables
1
Time Complexity of Sorting Algorithms
5
API Architecture
3
AI USE CASES
2
35 OOPS Interview Questions
3
12 MPC Servers you can use in 2025
2
Job Interview Cheat Sheet
1👍1
GIT CHEAT SHEET
1
Must-know Pandas Functions for Data Analysis
2
How to Learn Cloud computing
2
Rest vs GraphQL
3
7 Phases of Database Design
3