FastPrepSwap Two Gender Values
Problems/Swap Two Gender Values

Swap Two Gender Values

Infosys logoInfosys● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: Reported in an Infosys full-time phone screen. A reported technical-interview SQL task about swapping male and female values backs this exercise. We chose the table name, the identifier column, the exact values, a fixed order, and the limits. Our version is about 78% the same as the reported question.

The people table contains one row per person with person_id and a gender value that is either male or female.

Return every row after swapping male to female and female to male. Return the columns person_id and gender, ordered by person_id ascending.

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.

people

ColumnTypeNullableDescription
person_idIntegerNo—
genderTextNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
person_idIntegerNo—
genderTextNo—

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

Constraints

  • 0 <= people row count <= 100000.
  • person_id is a unique non-null integer.
  • gender is non-null and equals either male or female.

Source note: The source image is a source-neutral excerpt of the author-reported prompt.

More Infosys interview questions

  • Second-Highest Distinct SalaryPHONE SCREEN · Seen Sep 2026
  • At Most K Jumps with Quadratic Transition CostOA · Seen Nov 2026
  • Hiking Club Fastest PaceOA · Seen Nov 2026
  • Lowest Common Ancestor with a Changing RootOA · Seen Nov 2026
  • Minimum Coins for a TargetONSITE INTERVIEW · Seen Nov 2026
  • Minimum Leaf Path Sum over All RootsOA · Seen Nov 2026
  • Split Array to Minimize the Largest SumOA · Seen Nov 2026
  • Cherry PickupOA · Seen Nov 2026
  • Delete Duplicate Employee RecordsONSITE INTERVIEW · Seen Nov 2026
  • Find Duplicate Employee RecordsONSITE INTERVIEW · Seen Nov 2026

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
  • 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
  • Classify Tree Nodes with SQLOracle · PHONE SCREENOracle interview questions
All Infosys interview questionsSee Infosys hiring insights