Interview preparation
PySpark practice questions: in-depth answers
Solve 86 free problems on Spark Playground and StrataScratch, then check 2 worked answers that explain the patterns. Tick each one off as you go.
86 free PySpark practice problems on Spark Playground and StrataScratch
Write and run real PySpark code against the platform's checks. These are the Spark Playground problems that are free, and the free StrataScratch questions that accept a PySpark answer (choose PySpark in the editor; a free account is needed to run code). Each link opens the platform in a new tab; tick a problem off here when you solve it. Stuck? The worked answers further down explain the patterns.
86 problems in 4 topics, from basic to advanced. 0 of 86 done.
Spark Playground: free PySpark problems0/15
- Load and Transform Data (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Handling Null Values (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Total Purchases by Customer (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Clean Support Ticket Tags (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Streaming Device Split (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Last Visit Checkouts (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Workout Span (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Top Support Agents (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Top Delivery Cities (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Monthly Hotel Ratings (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Running Payroll (opens Spark Playground in a new tab)MediumSpark Playground (opens in a new tab)
- Food and Beverage Sales (opens Spark Playground in a new tab)MediumSpark Playground (opens in a new tab)
- Word Count Program in PySpark (opens Spark Playground in a new tab)MediumSpark Playground (opens in a new tab)
- Parse Product Attributes JSON (opens Spark Playground in a new tab)MediumSpark Playground (opens in a new tab)
- Department Budget Utilization (opens Spark Playground in a new tab)HardSpark Playground (opens in a new tab)
StrataScratch: easy (solve in PySpark)0/30
- Find all posts which were reacted to with a heart (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Finding Updated Records (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Total Cost Of Orders (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Workers With The Highest Salaries (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Average Salaries (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Completion Rate by Title (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Calculate Samantha's and Lisa's total sales revenue (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Wine varieties tasted by 'Roger Voss' (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Hour Of Highest Gas Expense (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Find all Lyft rides which happened on rainy days before noon (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Lyft Driver Wages (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Artist Appearance Count (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Top Ranked Songs (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Olympics Events List By Age (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Find all athletes who were older than 40 years when they won either Bronze or Silver medals (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Order Details (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Departments With 5 Employees (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- April Admin Employees (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- First Names With Six Letters Ending in 'h' (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Find drafts which contains the word 'optimism' (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Number of violations (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Inspection For Glassell Coffee Shop (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Churro Activity Date (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Most Profitable Financial Company (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- MacBookPro User Event Count (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Contact Information Completeness (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Users Missing Phone Numbers (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- High Earners in Support Departments (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Number of Shipments Per Month (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Unique Users Per Client Per Month (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
StrataScratch: medium (solve in PySpark)0/36
- Users By Average Session Time (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Acceptance Rate By Date (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Finding User Purchases (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Risky Projects (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Busiest Restaurants in June 2025 (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Thumbs-Up Rate by Model Version (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- AI Feature Adoption Funnel (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Finding Purchases (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Ranking Most Active Guests (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Number Of Units Per Nationality (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Find the number of inspections for each risk category by inspection type (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Find the percentage of shippable orders (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Meta/Facebook Matching Users Pairs (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Matching Similar Hosts and Guests (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Income By Title and Gender (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Top Cool Votes (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Reviews of Categories (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Top Businesses With Most Reviews (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Find all possible varieties which occur in either of the winemag datasets (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Highest Target Under Manager (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Highest Salary In Department (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Employee and Manager Salaries (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Second Highest Salary (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Titanic Survivors and Non-Survivors (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Duplicate HR Department Employees (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Employees With the Same Salary (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Count Occurrences Of Words In Drafts (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Make the friends network symmetric (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Processed Ticket Rate By Type (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Top 10 Songs 2010 (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Customers with Large Orders (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Department Workforce Analysis (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Salary Less Than Twice The Average (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Flags per Video (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Maximum of Two Numbers (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Share of Active Users (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
StrataScratch: hard (solve in PySpark)0/5
- Consecutive Days (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
- Best Selling Item (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
- Rank Variance Per Country (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
- Monthly Percentage Difference (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
- Counting Instances in Text (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
Ticks are saved in this browser only and match the ticks on the interview pages.
How to use this page
This page collects 2 PySpark interview questions answered in depth (2 medium), ordered from the basics to the harder design and troubleshooting questions. They include “When should you avoid Python UDFs in PySpark” and “When would you use a broadcast join in Spark”.
Each answer opens with a short version you could say out loud in an interview, then explains why it works, shows a worked example, and lists the mistakes and follow-up questions interviewers use. For breadth first, read Top 50 PySpark and Spark Interview Questions and Answers, then come back here to go deep on the questions you are most likely to be asked. If a topic is new to you, learn it in the PySpark course first. Tick each question off as you practise; your progress is saved in this browser.
Question bank
Start with the question bank · 50 questions with answersTop 50 PySpark and Spark Interview Questions and AnswersAll PySpark questions
Showing 2 of 2 questions · 0 done
| # | Question | Difficulty | Type | Done |
|---|---|---|---|---|
| 1 | When should you avoid Python UDFs in PySpark? | Medium | conceptual, optimization | |
| 2 | When would you use a broadcast join in Spark? | Medium | conceptual, optimization |
Ticks are saved in this browser only. No account needed.
No questions match these filters
Clear a filter to see more questions.
Concept review
- LessonBeginnerPySpark Aggregations, Pivot and Temporary Views
- LessonBeginnerPySpark DataFrames, Columns and Schemas
- LessonIntermediatePySpark Joins and Join Strategy
- LessonIntermediateNested and Complex Types in PySpark: Structs, Arrays, Maps and explode
- LessonBeginnerPySpark Fundamentals for Data Engineers
- LessonIntermediateTop 50 PySpark and Spark Interview Questions and Answers
- LessonIntermediatePySpark vs pandas vs Polars: When to Use Each
- LessonBeginnerReading and Writing Data in PySpark: Parquet, CSV, JSON, ORC, Avro and JDBC
- LessonBeginnerPySpark Transformations vs Actions
- LessonIntermediatePySpark UDFs, pandas UDFs and the Pandas API on Spark
- LessonIntermediatePySpark Window Functions: Ranking, Lag and Running Totals
- LessonIntermediateWriting Efficient Output: File Sizes, Small Files and Partitioned Writes

