AGENT VIEW · Mokabla · Question · set-bits-counter
AgentGate · request ag_20e8d7ad12bd

Who you are, as far as this app can tell

declared   ClaudeBot · Anthropic   · not verified

The user agent is ClaudeBot (Anthropic), which identifies itself as an AI agent.

Signals: Known agent user agent

This classification is final for the session. The human pages are not served to agents.

This page

page
question
human URL
https://www.mokabla.com/en/c/valeo/set-bits-counter

State

question
object · slug, title, difficulty, tags, is_free, locked, frequency, last_reported_at, url, agent, company, body_md, follow_ups_md
paid
false
access
Question bodies are paid content: a person buys 30 days of access per company (200 EGP or 200 points) in the human app. Agents get titles, tags and difficulty; bodies only for free questions.
{
  "question": {
    "slug": "set-bits-counter",
    "title": "Set Bits Counter",
    "difficulty": "easy",
    "tags": [
      "coding",
      "embedded",
      "oa",
      "intern"
    ],
    "is_free": true,
    "locked": false,
    "frequency": 1,
    "last_reported_at": "2026-08-06T20:55:05.914254Z",
    "url": "https://www.mokabla.com/en/c/valeo/set-bits-counter",
    "agent": {
      "page": "https://www.mokabla.com/agent/en/c/valeo/set-bits-counter",
      "question": "https://www.mokabla.com/agent/_call/get_question?company=valeo&question=set-bits-counter"
    },
    "company": {
      "slug": "valeo",
      "name_en": "Valeo"
    },
    "body_md": "## Problem\nThree small functions on an unsigned 32-bit value, no library calls, no lookup tables unless you build them yourself:\n\n1. `popcount(x)`, number of bits set to 1.\n2. `swapNibbles(b)`, for a byte, exchange the high and low 4 bits.\n3. `isPowerOfTwo(x)`, true if exactly one bit is set (`0` is not a power of two).\n\nThis is the first screen for embedded roles. I care less about the answer than about whether you reach for the bit tricks naturally.\n\n## Examples\n**Example 1**, `popcount(0b1011_0001) = 4`, `popcount(0) = 0`, `popcount(0xFFFFFFFF) = 32`.\n\n**Example 2**, `swapNibbles(0xAB) = 0xBA`, `swapNibbles(0x0F) = 0xF0`. `isPowerOfTwo(64) = true`, `isPowerOfTwo(96) = false`, `isPowerOfTwo(0) = false`.\n\n## Constraints\n- Inputs are unsigned 32-bit (or 8-bit for the nibble swap). In C, use `uint32_t` / `uint8_t` and mask results.\n- `popcount` should be `O(number of set bits)` per the classic `x &= x - 1` trick; the naive 32-iteration loop is accepted as a warm-up.\n- No `__builtin_popcount`; but tell me it exists and when you would use it.\n\n## What they look for\n`x & (x - 1)` clears the lowest set bit, which gives both `popcount` and `isPowerOfTwo` (`x && !(x & (x - 1))`). Shifts and masks for the nibble swap, with awareness of integer promotion in C (`(b << 4)` becomes an `int`, so mask with `0xFF`). Follow-ups go to reversing bits, counting trailing zeros, and the parallel-prefix popcount used by compilers.",
    "follow_ups_md": "- Reverse the bits of a 32-bit word in `O(log n)` operations.\n- Count trailing zeros without a loop.\n- Why does `(b << 4)` need a mask in C but not in Python?"
  },
  "paid": false,
  "access": "Question bodies are paid content: a person buys 30 days of access per company (200 EGP or 200 points) in the human app. Agents get titles, tags and difficulty; bodies only for free questions."
}

Actions you may take here

actioninputpermission
get_question
One question with its body. Bodies are paid content unless the question is free.
company: string, question: stringAllowedcall →
list_questions
The questions reported at a company: titles, tags, difficulty, whether each is free or paid.
company: string, page: number?Allowedcall →
buy_access
Buy 30 days of access to a company.
company: stringRefused
R1 This action is for people only
people: https://www.mokabla.com/en/pricing
post_comment
Comment on a question.
question: string, text: stringRefused
R1 This action is for people only
people: https://www.mokabla.com/en/companies

Allowed actions answer in JSON. Add ?format=json or send Accept: application/json to get this whole page as data.

Navigate (pre-filled links you can follow)

Notices

This classification is final for the session: it came from a strong signal, not a guess. The human pages are not served to agents.
Unverified agents are read-only. Signed requests (Web Bot Auth) are the path to write access.