FastPrepCredit and Debit Transaction Counts per User
Problems/Credit and Debit Transaction Counts per User

Credit and Debit Transaction Counts per User

Mastercard logoMastercard● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: A public recap of a Mastercard Senior Data Engineer interview asks candidates to count credit and debit transactions for each user. We chose the table layout and a fixed output. Our version is about 96% the same as the reported question.

For every user appearing in the transaction table, count Credit and Debit transactions separately.

Return user_id, credit_count, and debit_count, including zero for a missing type.

Table schema

MySQLPostgreSQLPandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

transactions

ColumnTypeNullableDescription
transaction_idPKIntegerNo—
user_idIntegerNo—
transaction_typeTextNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
user_idIntegerNo—
credit_countIntegerNo—
debit_countIntegerNo—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • transaction_type is exactly Credit or Debit.
  • Each transaction counts once.
  • Sort users by ID ascending.

More Mastercard Phone Screen questions

  • Top Three Accounts by Monthly Transaction AmountPHONE SCREEN · Seen Sep 2026
  • Deduplicate a List While Preserving OrderPHONE SCREEN · Seen Jul 2026
  • Employee With the Highest SalaryPHONE SCREEN · Seen Jul 2026
  • Group Names by DepartmentPHONE SCREEN · Seen Jul 2026
  • Users with Three Transactions in Sixty SecondsPHONE SCREEN · Seen Apr 2026
  • Container With Most WaterPHONE SCREEN · Seen Oct 2025
  • Employees with the Highest and Lowest SalaryPHONE SCREEN · Seen Apr 2025
  • Inactive Customers with Prior ActivityPHONE SCREEN · Seen Nov 2024
  • Merchant Category Transaction SummaryPHONE SCREEN · Seen Nov 2024
  • Top Customers by Six-Month Transaction AmountPHONE SCREEN · Seen Nov 2024

Similar questions at other companies

  • Second Highest SalaryPaytm · PHONE SCREENPaytm interview questions
  • Employees Who Earn More Than Their ManagersNykaa · PHONE SCREENNykaa interview questions
  • Employees Who Joined More Than a Week AgoNewgen Software · PHONE SCREEN
  • Departments Without EmployeesDell Technologies · PHONE SCREENDell Technologies interview questions
  • Second-Highest Distinct SalaryChubb · PHONE SCREENChubb interview questions
  • Swap Two Gender ValuesInfosys · PHONE SCREENInfosys interview questions
  • Find Rows Common to Two TablesSalesforce · PHONE SCREENSalesforce interview questions
  • Count Records Present in A but Not BCapital One · PHONE SCREENCapital One interview questions
  • Customer Order Count Distribution by CountryApple · PHONE SCREENApple interview questions
  • Employees Earning More Than Their ManagerMygate · PHONE SCREENMygate interview questions

Mastercard interview experiences

  • Mastercard Data Science Intern Interviews: 10 Experiences
All Mastercard interview questionsSee Mastercard hiring insights