Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Bit Matching With Wildcards
00:00
5 left

Bit Matching With Wildcards

EasyPython

Problem

A General Atomics MQ-9 telemetry packet contains two unsigned bytes, A and B. Their eight-bit representations follow these layouts:

  • A: 0101X110
  • B: 1Y011001

The digits 0 and 1 are arbitrary bit values supplied by the packet. Bit X is the fifth bit from the left in A, and bit Y is the second bit from the left in B. Return True when X and Y have the same value, otherwise return False.

Use bitwise operations rather than converting the bytes to strings. The function must work for every valid pair of bytes, regardless of the other bit values.

Formal Specification

Implement compare_telemetry_bits(A, B), where A and B are integers representing unsigned eight-bit values. Return a Boolean. Since bit positions are counted from the least significant bit at index 0, X is bit 3 of A, and Y is bit 6 of B.

Constraints

  • 0 <= A <= 255
  • 0 <= B <= 255
  • Both inputs represent exactly one unsigned byte
  • Only bit 3 of A and bit 6 of B affect the result

Function Signature

def compare_telemetry_bits(A, B):
Interviewer

Your question is Bit Matching With Wildcards. Start with the requirements in the Question tab.

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.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.