CS31: nail every assessment, not just read the notes
Your complete guide to University of California, Los Angeles's introduction to computer science i course. See where the marks are, work real practice questions, and study with an AI tutor that knows CS31.
Sia generates CS31 practice questions, walks through introduction and control flow step by step, and quizzes you on the material the heaviest assessments weight most heavily.
Find what is wrong
What does this C++ fragment print?
int a[3] = {10, 20, 30};
int* p = a;
p++;
*p = *p + 5;
cout << a[1] << ' ' << *(p + 1);
p starts at a[0]; p++ moves it to a[1].
*(p + 1) is a[2], which is 30.
Output: 25 30. Option B forgets the write through the pointer; option C adds to the wrong element.
The trap: Thinking p++ changes the array's value rather than which element the pointer refers to. classic slip!
One exam decides 35% of your grade. A score below 40 may fail the course. This whole page is built around that.
Overview
What CS31 is, and where it sits
CS 31 Introduction to Computer Science I is UCLA's first programming course in C++ and the gateway to the computer science and engineering majors. The offering documented here is Fall 2025, taught in two lecture sections by David Smallberg with six discussion-section teaching assistants; the Fall 2026 site was not yet published when this guide was written, but the course site shows the same three-exam structure with midterms on 28 October and 17 November 2026 and a final on 5 December 2026.
Ten weeks move from the basics of the language through control flow, functions and program development, arrays and strings, then pointers, structs and classes, constructors and function overloading. Lectures expand on the interactive zyBook; Friday discussion sections with a TA and a learning assistant work problems collaboratively.
The grade is 33% programming projects, 6% zyBook activities, 1% responsibility assignments, 9% Midterm 1, 16% Midterm 2 and 35% final. The total assignment score is capped at 30 points above the mean exam score, and a final below 40 may fail the course regardless of total.
Always treat your own course outline and the exam timetable as authoritative.
Difficulty & time commitment
Is CS31 hard, and how much time does it take?
CS31 is manageable if you keep a weekly rhythm and treat the back half as the main event. The pattern is consistent: it starts gently and steepens, and the heaviest assessment is the part that separates grades.
The difficulty curve and the assessment weighting point the same way: the back half is harder and worth more. Front-loading effort there is the highest-return decision in the course.
Is this course for you
Who tends to do well, and who tends to struggle
You will likely do well if
- You have already written a program with arrays and your own functions.
- You start projects the day they are posted; the late penalty is hourly.
- You test your code on both required compilers before submitting.
- You can sit evening exams in weeks 5 and 8 without conflicts.
You may struggle if
- You are learning to program from zero; take CS 30 first.
- You rely on projects to carry weak exams; the cap and the 40-point final rule prevent it.
- You submit a project that compiles on one compiler only.
- You skip discussion; the collaborative problems are exam practice.
- Trace pointer and array code by hand on paper before running it.
- Rewrite each project's hardest function from memory a week later.
- Treat Midterm 2 (16%) as the exam that predicts the final; the material from week 6 on is where grades separate.
- Use the learning-assistant workshops for problem solving, not just debugging.
Syllabus
The 9 topics, week block by week block
The exam-weight marker on each topic shows where the marks concentrate. The amber topics carry the highest exam weight.
T1 · Introduction and basics
Weeks 1-2Computer history, variables, types, input and output, expressions.
T2 · Control flow
Week 3if, switch, loops, boolean logic.
T3 · Functions and program development
Week 4Parameters, return values, scope, incremental development.
T4 · Arrays
Week 5Fixed arrays, indexing, passing arrays to functions.
T6 · Pointers
Weeks 6-7, 9Addresses, dereferencing, pointer arithmetic, arrays and pointers.
T7 · Structs and classes
Weeks 7-8Members, encapsulation, member functions.
T8 · Constructors and function overloading
Weeks 9-10Object initialisation, overloaded functions and operators.
T9 · Review
Week 10Integrating the course for the cumulative final.
How it's assessed
Assessment structure
| Component | Weight | Format & timing |
|---|---|---|
| Programming projects (seven, excluding zyBook assignments) | 33% | Seven C++ programming projects graded on correctness by automated testing; must compile on two specified compilers. Roughly weekly, due 11pm. 12.5% per hour late; worthless after 7am next day. |
| zyBook interactive assignments | 6% | Interactive activities in the required zyBook. Through the quarter. Online. |
| Responsibility assignments (brief online forms) | 1% | Brief online forms completed on time. Occasional. Small credit for completion. |
| Midterm 1 (about one hour, evening of week 5) | 9% | About one hour, evening sitting, lecture material to date. Tuesday of week 5, 6-7:30pm window. Mandatory; no conflicts allowed. |
| Midterm 2 (about one hour, evening of week 8) | 16% | About one hour, evening sitting, lecture material to date. Tuesday of week 8, 6-7:30pm window. Mandatory. |
| Final exam (3 hours, Saturday end of week 10) | 35% | Three-hour cumulative final. Saturday at the end of week 10, 11:30am-2:30pm. A score below 40 may fail the course. |
- The six components sum to 100. Two hurdles apply: a final exam score below 40 may fail the course regardless of total, and the combined assignment score (scaled to 100) is capped at 30 points above the mean of the three exam scores. Regrade requests must be made within one week.
- Two mandatory evening midterms of about one hour in weeks 5 and 8 on lecture material to date, and a three-hour cumulative final on the Saturday ending week 10. Exam dates are fixed before enrolment and conflicts are not accommodated.
This is a coursework course. Coursework carries 65% of the grade and the final exam (3 hours, saturday end of week 10) is the single heaviest piece at 35%, so steady work across the semester decides your result more than any one sitting. A score below 40 may fail the course.
Final exam timing: During the examination period. Confirm the exact date and venue on your exam timetable.
How to actually pass it
A weekly rhythm, two checklists, and the traps to avoid
The course rewards consistency over cramming, and practice over re-reading. Here is the loop that works, then what to have nailed before each exam.
The weekly loop
Before the mid-semester checklist
- Predict the output of loops with nested conditions.
- Write a function with reference and value parameters correctly.
- Manipulate arrays passed to functions.
- Handle string comparison and indexing edge cases.
Before the final heaviest topics
- Trace pointer arithmetic and dereferencing without running code.
- Write a class with private data, constructors and member functions.
- Explain when a copy is made and when a reference is used.
- Debug a short program by reading it.
The mistakes that cost marks
Off-by-one array access. Reading past the end of an array is undefined behaviour and a favourite exam question.
Ignoring the second compiler. Code that only compiles on one of the two required compilers is not accepted.
Cramming the final. It is 35% and cumulative; a score below 40 can fail the course.
Teaching team
Who teaches CS31
The bios below are factual. We do not rate lecturers; any star ratings are submitted by students who have taken CS31.
Teaching team as listed in the course materials reviewed. AskSia does not rate lecturers; star ratings are submitted by students who have taken CS31.
Formula & concept sheet
The vocabulary and formulas you must own
- Variable
- A named storage location with a type.
- Reference parameter
- A parameter that aliases the caller's variable.
- Array
- A fixed-size sequence of same-type elements.
- Pointer
- A variable holding a memory address.
- Dereference
- Accessing the value a pointer points to.
- Struct
- A compound type grouping named members.
- Class
- A struct with member functions and access control.
- Constructor
- The function that initialises a new object.
- Function overloading
- Several functions with one name and different parameter lists.
Set texts
The prescribed reading
The syllabus references map straight onto these.
CS 31 zyBook
.
Where it fits
Prerequisites, related courses & why it matters
Prior programming experience with arrays and user-written functions; otherwise CS 30 first. 4 units; lecture 4 hours, discussion 2 hours, outside study 6 hours per week.
Your CS31 study toolkit
Study the course with Sia, not just read about it
Each tool already knows CS31: your syllabus, your texts, and where the marks are. Grouped by how you study, from first contact to exam week.
FAQ
Frequently asked questions
Is CS 31 hard?
Moderate on the six-factor rubric, but with real fail risk: a final below 40 can fail you and the course site says more than half of students without prior programming experience do not finish with a C or better.
What is the assessment breakdown?
Projects 33%, zyBook assignments 6%, responsibility assignments 1%, Midterm 1 9%, Midterm 2 16%, final 35%, per the Fall 2025 syllabus.
Who teaches it?
David Smallberg taught both Fall 2025 lecture sections, with teaching assistants Jui-Nan Yen, Parshan Teimouri, Auguste Hirth, Alex Hung, Bronson Jeong and Yunqi Hong.
Should I take CS 30 first?
If you have never written a program using an array and a function you wrote with parameters, the course site says yes.
How strict is the late policy?
Projects lose 12.5% per hour after the 11pm deadline and are worth nothing after 7am the next morning.
What is the 30-point cap?
Your assignment average cannot exceed the mean of your exam scores by more than 30 points; strong projects with weak exams are scaled down.
Study CS31 with Sia
Work through introduction, control flow, functions and the rest of the course with a tutor that knows it and quizzes you on the topics the assessments weight most heavily.
Start studying with Sia