Tredence Interview Questions
Structured data has a fixed schema stored in tabular format — rows and columns with predefined data types. Examples: relational database tables (MySQL,...
Explain the types of data you've worked with (structured vs semi-structured).
Structured data has a fixed schema stored in tabular format — rows and columns with predefined data types. Examples: relational database tables (MySQL, PostgreSQL), CSV files, data warehouse tables in Redshift or BigQuery. Semi structured data has flexible schema with self describing tags/keys. Examples: JSON (REST API responses, Kafka events), XML (legacy systems), Avro (schema embedded), Parquet/ORC (columnar with embedded schema). Unstructured data has no schema: raw logs, images, PDFs, free
Describe the data flow from ingestion to storage in your recent pipeline.
A typical modern data pipeline follows this flow: 1. Ingestion layer Source systems (transactional DBs, APIs, IoT devices, Kafka streams) emit data For batch: Airflow triggers ingestion jobs on a schedule For streaming: Kafka producers push events; Spark Structured Streaming or Flink consumes them 2. Raw/Bronze layer (landing zone) Data is written as is to cloud storage (S3/ADLS/GCS) in Parquet or Avro format No transformations — this is the source of truth for replays Partitioned by ingestion d
What tech stack did you use and what were the key challenges?
Typical data engineering stack: Layer Technologies Ingestion Kafka, Debezium (CDC), REST APIs, Airbyte Processing Apache Spark (PySpark), dbt, Pandas Orchestration Apache Airflow, Prefect Storage S3/ADLS/GCS (raw), Delta Lake/Iceberg (processed), Snowflake/Redshift/BigQuery (warehouse) CI/CD GitHub Actions, Terraform, Docker Monitoring Great Expectations, Monte Carlo, CloudWatch Common key challenges: 1. Data skew — Uneven partition sizes causing Spark executor OOM. Solved with salting or broadc
Describe the size and scale of datasets you've handled.
Scale benchmarks give context for architecture decisions: Small scale (< 1 GB / < 1M rows): Processed with Pandas or standard SQL No distributed computing needed Example: daily config sync tables, dimension tables Medium scale (1 GB – 1 TB / millions of rows): PySpark on a small cluster (4 8 nodes) or Databricks serverless Partitioning by date is critical for query performance Example: daily transaction logs for a mid size e commerce platform Large scale (1 TB – 100 TB / billions of rows): PySpa
Implement a string compression algorithm. Example: Input "AAABBBCCCDDDDAAA" → Output "A3B3C3D4A3"
This is run length encoding (RLE) — compress consecutive repeating characters. Complexity: O(n) time, O(k) space where k is the number of distinct runs. Edge cases to handle: Empty string → return empty string Single character → "A" → "A1" No consecutive repeats → each char gets count 1 Follow up variation: Only compress if result is shorter than original: This is used in image compression (BMP), network protocols, and genomics sequence encoding.
Write a query to find the 5th highest salary from the employee table.
Method 1: Using DENSE RANK() (recommended) DENSE RANK handles ties correctly — if two employees share the 4th highest salary, the 5th distinct salary is still returned correctly. Method 2: Using LIMIT/OFFSET Method 3: Subquery (works in older SQL) Generalizing to Nth highest: Important: If there are fewer than 5 distinct salaries, all methods return no rows — handle this with COALESCE or a default value in application code.
Find the number of employees earning more than their manager.
Use a self join to compare each employee's salary with their manager's salary: To list the employees (not just count): Schema assumed: where manager id references employee id in the same table (self referential FK). Edge cases: Employees with manager id IS NULL (top level executives) are excluded from the join — correct behavior If an employee's manager doesn't exist in the table, INNER JOIN excludes them; use LEFT JOIN ... WHERE e.salary COALESCE(m.salary, 0) to include orphaned records Result
Replicate the above SQL logic using PySpark.
Key PySpark concepts used: alias() — creates named references for self join disambiguation col("e.salary") — references columns from specific alias how="inner" — excludes top level managers with no manager id match