Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Pointers in Assembly

HardPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Pointers in Assembly. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

How are pointers represented and implemented in Assembly language?

Asked in the Technical Round stage. Follow-up discussion drilling into low-level pointer mechanics.

Implement simulate_pointer_ops(memory, operations), where a pointer is represented by an integer memory address. Support MOV, LEA, ADD, LOAD, STORE, and RETURN instructions. Return the final memory and values collected by RETURN.

Input and Output

memory is a list of integer cells. Each operation is a list of strings and integers. Registers are identified by names such as R1. LOAD dereferences an address stored in a register, while STORE writes through it.

Constraints

  • 1 <= len(memory) <= 10^4
  • 1 <= len(operations) <= 10^4
  • All addresses used for dereferencing are valid indices in memory
  • Registers are uppercase strings such as R1
  • Each instruction follows the specified operand format

Function Signature

def simulate_pointer_ops(memory, operations):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output