Average Marks per Class
Updated
Problem statement
The students table has one row per student: a unique student_id, the student_name, the class_id of the student's class, and the student's marks.
For each class, find the average of its students' marks. Round the average to 4 decimal places.
Return the columns class_id and average_marks, with one row per class that has at least one student. Sort the rows by class_id from smallest to largest. If the table is empty, return no rows.
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.
students
One row per student.
| Column | Type | Nullable | Description |
|---|---|---|---|
| student_idPK | Integer | No | — |
| student_name | Text | No | — |
| class_id | Integer | No | — |
| marks | Integer | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| class_id | Integer | No | — |
| average_marks | Decimal | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- The
studentstable has from0to1000rows. student_idis unique and1 <= student_id <= 10^6.1 <= class_id <= 10000 <= marks <= 100, and marks are whole numbers.- Each class has from 1 to 30 students.
student_nameis one uppercase English letter followed by 0 to 19 lowercase English letters.- No value is
NULL.
More Expedia Online Assessment questions
- Balanced NumbersOA · Seen Aug 2026
- REST API: Discounted PriceOA · Seen Aug 2026
- Maximum Team SizeOA · Seen Mar 2026
- Per-Domain Request LimiterOA · Seen Oct 2025
- Count Equal-Frequency SubsequencesOA · Seen Mar 2025
- Count Increasing Stock PeriodsOA · Seen Mar 2025
- Get Minimum StepsOA · Seen Oct 2024
- Rank Songs by PopularityOA · Seen Oct 2024
- Calculate the SumOA · Seen Oct 2024
- Get Maximum EfficiencyOA · Seen Oct 2024
Similar questions at other companies
- Students Scoring Above AverageCapstone Investment Advisors · OA
- Bond Interest Summary Above 3%Wells Fargo · OAWells Fargo interview questions
- Employee Promotion OpportunitiesIntuit · OAIntuit interview questions
- Students and Their SubjectsBirla Pivot · OA
- Companies with Average Salary Above 40000AT&T · OAAT&T interview questions
- Build Taxi Driver Performance FeaturesBoston Consulting Group · OABoston Consulting Group interview questions
- Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
- Companies Above a Salary ThresholdVerisk · OA
- Customer Resource Usage AnalysisIBM · OAIBM interview questions
- Customers Who Never OrderedAccenture · OAAccenture interview questions
Interview reports that mention this question
Expedia interview experiences
- Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
- Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
- Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
- Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
- Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)