Skip to content

Data Engineer Professional · Domain 6: Ensuring Data Security and Compliance · 8% of the exam

Task 6.3: Apply anonymization and pseudonymization methods — such as hashing, tokenization, suppression, and generalization — to confidential data (e.g., using column masks and related Unity Catalog features).

Salted and keyed hashing, token tables, encryption functions with secrets, masking, generalizing values, and which methods can be reversed.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.

Question 1 · choose 1

Several silver tables must replace email with a pseudonymous key so that analysts can still join them, on Databricks Runtime 19. Analysts must not be able to recover emails, including by hashing a list of known emails and comparing. The key must be the same for an email in every table and load. Which expression meets these requirements?

  1. Asha2(email, 256), applied identically in every table and every load
  2. Bmask(email), the built-in masking function
  3. Cuuid(), generated for each row at load time
  4. Dhex(hmac(secret key, email)) with a key from a secret scope
Show the answer and why
  • Asha2(email, 256), applied identically in every table and every load

    Incorrect

    An unkeyed hash is consistent, but anyone can hash known emails and match the results.

  • Bmask(email), the built-in masking function

    Incorrect

    Masking replaces letters and digits with placeholders, so different emails collide and the value no longer works as a join key.

  • Cuuid(), generated for each row at load time

    Incorrect

    A random value per load changes between loads and tables, so joins break.

  • Dhex(hmac(secret key, email)) with a key from a secret scope

    Correct

    A keyed hash gives the same value for the same email, and without the secret key nobody can recompute it from candidate emails.

hmac computes a keyed hash with a secret key, so values are consistent but cannot be reproduced without the key. sha2 alone is unkeyed, mask replaces characters, and random values are not stable across loads.

Question 2 · choose 1

Analysts may see a customer's age band but not the exact birth date. Only the medical team may see full dates. Which anonymization method fits the analysts' view?

  1. AGeneralization, with a column mask that returns only the year
  2. BSuppression, with a column mask that returns NULL for analysts
  3. CTokenization, replacing each date with a random token per row
  4. DEncryption of the date with aes_encrypt for the analysts
Show the answer and why
  • AGeneralization, with a column mask that returns only the year

    Correct

    Generalization replaces a value with a coarser one, and a column mask can return it based on group membership.

  • BSuppression, with a column mask that returns NULL for analysts

    Incorrect

    Suppression hides the value entirely, losing the age band.

  • CTokenization, replacing each date with a random token per row

    Incorrect

    A token hides the value but keeps no age information.

  • DEncryption of the date with aes_encrypt for the analysts

    Incorrect

    Ciphertext keeps no usable age information for analysts.

Column masks are SQL UDFs that return a value per row based on the querying user. Returning a coarser value, such as the year, generalizes the data for some groups while others see the full value.

Question 3 · choose 1

The ssn column must be hidden completely from everyone outside the payroll group, with no partial digits shown. Which mask body fits?

  1. ACASE WHEN is_account_group_member('payroll') THEN ssn ELSE mask(ssn) END
  2. Bsha2(ssn, 256) for everyone
  3. CCASE WHEN current_user() = 'payroll' THEN ssn ELSE NULL END
  4. DCASE WHEN is_account_group_member('payroll') THEN ssn ELSE NULL END
Show the answer and why
  • ACASE WHEN is_account_group_member('payroll') THEN ssn ELSE mask(ssn) END

    Incorrect

    A partly masked string still exposes the shape of the value.

  • Bsha2(ssn, 256) for everyone

    Incorrect

    Payroll would lose the real value, and hashes can be matched.

  • CCASE WHEN current_user() = 'payroll' THEN ssn ELSE NULL END

    Incorrect

    current_user() returns a user, not a group name.

  • DCASE WHEN is_account_group_member('payroll') THEN ssn ELSE NULL END

    Correct

    Returning NULL for others suppresses the value entirely.

A column mask function receives the column value and returns what each user sees. Checking group membership with is_account_group_member and returning NULL otherwise suppresses the value.

Question 4 · choose 1

What does mask('Ab-12') return with the default arguments?

  1. A'XX-XX'
  2. B'Xx-nn'
  3. C'*****'
  4. DNULL
Show the answer and why
  • A'XX-XX'

    Incorrect

    Each class has its own default replacement character.

  • B'Xx-nn'

    Correct

    Upper case becomes X, lower case x and digits n; other characters stay as they are by default.

  • C'*****'

    Incorrect

    The default does not use asterisks or mask the separator.

  • DNULL

    Incorrect

    mask returns a masked string, not NULL.

mask(str) replaces upper-case letters with X, lower-case letters with x and digits with n. Other characters are left unmasked unless otherChar is given.

Databricks documentation

Question 5 · choose 1

Account numbers must be stored so that most users see an unreadable value, but the fraud team must be able to recover the original numbers when needed. Which approach allows this?

  1. Asha2(account_number, 512), with the hash stored instead of the number
  2. Bmask(account_number), with the masked value stored instead
  3. Caes_encrypt with a secret-scope key; the fraud team uses aes_decrypt
  4. DA column mask that returns NULL on every read
Show the answer and why
  • Asha2(account_number, 512), with the hash stored instead of the number

    Incorrect

    A hash cannot be reversed to the original number.

  • Bmask(account_number), with the masked value stored instead

    Incorrect

    Masking discards the original digits.

  • Caes_encrypt with a secret-scope key; the fraud team uses aes_decrypt

    Correct

    AES encryption is reversible for whoever holds the key.

  • DA column mask that returns NULL on every read

    Incorrect

    NULL keeps no recoverable value.

Encryption with aes_encrypt is reversible with aes_decrypt and the same key, which should be kept in a secret scope. Hashing and masking are one way.

Practice domain 6 →Practice all domains →