Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions computer-science/general-concepts/answers/marianne.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
What is the difference between synchronous and asynchronous processing? What is a Promise in JS? How are promises handled in JS? How do other languages (go, python, etc) handle asynchronous function calls?
A. Synchronous code runs line by line - each step waits for the previous to finish. Asynchronous code can start a task and move on, handling the result later when it's ready. In JS, a Promise is an object representing a value that will exist in the future; you handle it with .then()/.catch() or async/await. Go uses goroutines (lightweight threads) and channels; Python uses asyncio with async/await syntax similar to JS.
What is recursion? When would you use it?
A. Recursion is when a function calls itself, breaking a problem into smaller versions of the same problem until it hits a base case. It's useful for tree traversal, nested structures, or problems naturally defined recursively (like factorial, Fibonacci, or searching through file directories).
What is the difference between parallel and concurrent processing?
A. Concurrent means multiple tasks are in progress at the same time, but not necessarily executing simultaneously - they might be interleaved (like one pauses while another runs). Parallel means multiple tasks are literally running at the same instant on different CPU cores. Concurrency is about structure; parallelism is about execution.
What is an anonymous or lambda function? Why would you ever use this?
A. A function without a name, defined inline. You use them for short, one-off operations - like a callback you'll only use once, or passing a quick transformation to .map() or .filter(). It keeps code concise when naming the function would add clutter without clarity.
Why would you choose one language over another? Can you give an example scenario and trade off two languages?
A. You choose based on the problem, ecosystem, performance needs, and team familiarity. Example: for a quick data analysis script, Python wins - tons of libraries (pandas, numpy), fast to write, readable. For a high-performance backend handling millions of requests, Go might be better - compiles to fast binaries, great concurrency model, but less mature data science ecosystem. Tradeoff is speed of development vs runtime performance.