Programming: Programming Practice

This page lists resources to help you practice your programming skills. The quizzes on this site run entirely in your browser and are stored only on your computer – nothing is sent to a server or tracked.

1. Take the tracing quiz

The quiz is at the bottom of this page.

  1. Click Take Quiz.
  2. Choose Java or Python.
  3. Read each short program.
  4. Choose what it does.

Work on your own.

2. Practice these sample problems

There are so many wonderful websites that can help you practice your skills! Here are some good ones (feel free to practice Python or Java – it doesn’t matter), with specific problems that map to the ideas in this project.

CodingBat (Java · Python)

CodingBat problems are short methods. They are great for loops, arrays/lists, and maps. They do not practice designing your own classes (see OOP below for that).

Python only mirrors some of the Java problems (mostly under List-2). Map and AP problems are Java-only on CodingBat.

Problem Java Python What it evaluates
has22 Java Python Scan a list/array and detect a specific adjacent pair
countEvens Java Python Loop + filtering: count elements that meet a condition
bigDiff Java Python Track running min and max while scanning
twoTwo Java — Enforce a pairing rule: every occurrence of a value must have a matching neighbor
either24 Java — Check for one kind of adjacent pair while excluding another
countClumps Java — Count contiguous runs of equal values
maxSpan Java — Nested index comparison: largest distance between equal values
wordCount Java — Build a frequency map (String → count) while iterating
wordMultiple Java — Build a map of values to a boolean (“appears at least twice?”)
firstChar Java — Group strings by a key derived from each string (first character)
wordsWithoutList Java — Filter an ArrayList and return a new list of matching elements
scoresClump Java — Check whether any three consecutive values fall within a fixed range

Suggested order: has22 → countEvens → either24 (Java) → maxSpan (Java) → wordCount (Java) → wordMultiple (Java) → wordsWithoutList (Java).

Lists / collections (Java ArrayList · Python lists)

Focus Java Python What it evaluates
Iteration Ex 2 – Iterating Elements Ex 1–2 – Basic list ops Multiple ways to traverse a list
Search Ex 7 – Search for an Element Ex 14 – Check if list contains an item Membership testing and writing a manual search
Remove duplicates (with set) Ex 23 – With Set Ex 20 – Remove duplicates Using a set to recognize / eliminate repeats efficiently
Remove duplicates (nested loops) Ex 24 – Without Set Ex 11 – Removing duplicates Nested-loop duplicate removal and its higher time cost
Frequency counting Ex 26 – Frequency Counter Ex 17 – Count occurrences Building counts of how often each element appears

Suggested order: iteration → search → duplicates with set → frequency → duplicates without set.

OOP practice (Java OOP · Python OOP)

CodingBat will not ask you to invent classes. Use these for constructors, encapsulation, and inheritance.

Focus Java Python What it evaluates
Encapsulation Ex 1 – Book Repository Ex 2 – Vehicle with attributes Fields + controlled access to stored data
Object state + validation Ex 3 – Secure Bank Account Ex 6 – Bank Account Rules on updates (deposit / withdraw)
Methods on instance data Ex 5 – Student Grading Ex 4 – Student average grade Instance methods that compute from an object’s own data
Inheritance Ex 15 – Vehicle Customization Ex 13 – Bus inherits Vehicle Subclass extends a parent type
Overriding + super Ex 18 – Polite Person Ex 14 – Override with super() Method overriding and calling the parent version
Polymorphism Ex 25 – Animal Chorus Ex 16 – Dog & Cat speak() Same call, different subclass behavior

For the midterm exam, you will be expected to understand how to write solutions that work and are efficient.

3. Other Coding Interview Resources

If you are interested in pursuing a software engineering type career, code interviews are – for better or for worse – the currency of the realm. Given this, I highly recommend that you dedicate some time to doing practice problems. Here are some useful resources:

Loading quiz...

UNC Asheville Department of Computer Science