Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
Programming Education

The Toughest Programming Question for High School Students on This Year's CS Exam: Arrays 65

America's nonprofit College Board lets high school students take college-level classes — including a computer programming course that culminates with a 90-minute test. But students did better on questions about If-Then statements than they did on questions about arrays, according to the head of the program. Long-time Slashdot reader theodp explains: Students exhibited "strong performance on primitive types, Boolean expressions, and If statements; 44% of students earned 7-8 of these 8 points," says program head Trevor Packard. But students were challenged by "questions on Arrays, ArrayLists, and 2D Arrays; 17% of students earned 11-12 of these 12 points."

"The most challenging AP Computer Science A free-response question was #4, the 2D array number puzzle; 19% of students earned 8-9 of the 9 points possible."

You can see that question here. ("You will write the constructor and one method of the SumOrSameGame class... Array elements are initialized with random integers between 1 and 9, inclusive, each with an equal chance of being assigned to each element of puzzle...") Although to be fair, it was the last question on the test — appearing on page 16 — so maybe some students just didn't get to it.

theodp shares a sample Java solution and one in Excel VBA solution (which includes a visual presentation).

There's tests in 38 subjects — but CS and Statistics are the subjects where the highest number of students earned the test's lowest-possible score (1 out of 5). That end of the graph also includes notoriously difficult subjects like Latin, Japanese Language, and Physics.

There's also a table showing scores for the last 23 years, with fewer than 67% of students achieving a passing grade (3+) for the first 11 years. But in 2013 and 2017, more than 67% of students achieved that passsing grade, and the percentage has stayed above that line ever since (except for 2021), vascillating between 67% and 70.4%.

2018: 67.8%
2019: 69.6%
2020: 70.4%
2021: 65.1%
2022: 67.6%
2023: 68.0%
2024: 67.2%
2025: 67.0%

The Toughest Programming Question for High School Students on This Year's CS Exam: Arrays

Comments Filter:
  • Interesting that they have the kids write the answers for this exam using Java.

    I can see a plus side ("universal" implementation) and a really big negative (Oracle).

    I was in school pre-computer age so there was no such thing at that time, but didn't the kids learn Pascal in school some years back?

    I suppose any language will do, more-or-less, since they'll all show you functions and function calls, arrays, variable types and data handling.

    • by ls671 ( 1122017 )

      I can see a plus side ("universal" implementation) and a really big negative (Oracle).

      Nowadays you don't need anything Oracle to build and deploy in Java so you can take that one off your list.

    • I suppose any language will do, more-or-less, since they'll all show you functions and function calls, arrays, variable types and data handling.

      Technically, a language that supports pointers is very helpful. You can get by without pointers for a little while, even data structures with a little hand waving. But in the computer architecture class understanding memory, variable, arrays, etc pretty much requires a couple of aha moments where a language with pointers can be useful. Details covered in a different post.

      Note, this does not mean you have to use a language with pointers going forward. Just that getting past the aha moments could really us

      • by HiThere ( 15173 )

        Pointers aren't required for most purposes. They're often just an optimization, frequently a questionable optimization. It's true that C pretty much requires pointers, but in C++ references can generally be substituted with greater clarity. Pointers are almost never used in Java (are they ever?), and certainly not in Python. Or many other languages I could name. (Yeah, they still exist "under the hood", but that's not the point of an exam of early or intermediate programming skill.) For that matter c

        • by kertaamo ( 16100 )

          Conveniently ignoring that references are pointers. Albeit with restrictions on their use.

          • by HiThere ( 15173 )

            Lots of things are pointers under the hood. But that's really irrelevant to the point.

            Yeah, EVERYTHING is implemented at the base level in assembler, so pointers are in use everywhere. And I learned assembler first. But if that's your idea of where one should start, someone else can say we need to start with transistor theory, with just as valid an argument.

            • by AuMatar ( 183847 )

              It's not irrelevant. To understand what the program is actually doing and how the computers actually work, you need to understand pointers. They aren't necessary in day to day work, but not understanding how they work will lead to subtle bugs.

              • by Jeremi ( 14640 )

                To understand what the program is actually doing and how the computers actually work, you need to understand pointers. They aren't necessary in day to day work, but not understanding how they work will lead to subtle bugs.

                If you are coding in a language that doesn't have pointers, then you don't actually need to understand how pointers work... any more than you need to understand how assembly language works in order to program in C++. It might be helpful in some cases to understand pointers, in the same way it might also be helpful to understand assembly, or transistors, but plenty of people successfully write software (even well-designed, correct, performant software) without it.

          • References are not pointers, they CAN be implemented using a memory pointer (into raw memory) or as an offset into a base memory block, and they can also be reference counted or not. References are in general much SAFER than pointers, as they can actually check if the thing they are referencing still exists.

            Pointers are just a number, with no guarantees that that number refers to memory which is even still allocated to the process.
            Pointers can be incremented while references cannot.

            When you de-reference a

        • Pointers aren't required for most purposes.

          Keep in mind the context here is the computer architecture class, which should be a core required class. Assembly language and pointers should be taught here, regardless of whether either will be used in future projects. The student needs to understand what is happening at a low level. It helps to write better high level code.

    • by godrik ( 1287354 )

      The exam and curriculum were redesigned in 2004 and haven't changed much since In 2004 it made sense to do java.
      In the past they have used other languages in the past. According to wikipedia: pascal from 84 to 99, c++ from 99 to 04 and java since.

    • I went to high school 1984-1989 and took 3 years of programming classes.

      Year 1: basic
      Year 2: pascal and z-80 assembly
      Year 3: pascal

    • by NaCh0 ( 6124 )

      Interesting that they have the kids write the answers for this exam using Java.

      They have to pick something. You can't switch it every year or public school teachers won't keep up.

      It is fairly trivial to jump from Java to C++, PHP, C#, Dart or any number of C-like languages.

      Worst case, you flip the variable name before the type as the function parameter and you've instantly opened another few dozen common languages. (Kotlin, Golang, Swift, Rust, etc)

      Java is a fine language to teach if statements, for loops a

    • I was in a java class that had the same problem. The issue is that Java itself doesn't require the programmer to initialize memory for the most part unless they use an array. Everything else is handled automagicly, so the students don't assume it's required until their code throws a NullPointerException. Then they have no idea what they are doing because again, most modern languages try to hide details like this while calling all programmers idiots that need to be handheld. Completely obvious to the fact th
  • On the surface that hardest question (matrices, question 4) doesn't seem particularly hard. However... I do spot places where the desired result seems uncertain. Do you exit the analysis as soon as the puzzle is shown to not be solved, or do you process all the cells regardless? A small point... but there has to be a reason why less than 1/5 got full marks.

    • The way I read it, they didn't need to write the code to solve the actual game, they just needed to write a constructor and a method that, given one cell and it's value, search the array from the row specified to the end for a second value that either is equal to the first or sums to 10 with the first. That ought to have been easy for anyone who was paying attention in class and was actually doing the assignments instead of submitting chatgpt's responses to their homework.

      • by tlhIngan ( 30335 )

        Yeah, it's basically that simple.

        The first question is to write the constructor - basically allocate the array in memory and set its contents to a random value between 1 and 9.

        The second question just asks if given a number, find one that matches in the game - either the same value or its complement that adds it 10. If there are multiple possible matches, you pick one arbitrarily.

        The examples shown go through it fairly well so if you read it carefully and process what is happening, it's not a hard problem a

        • by narcc ( 412956 )

          a fairly basic and trivial problem that should've been covered in the first week of any CS class.

          Nonsense. Multidimensional arrays are not a week 1 topic. Not even in AP CS, which doesn't cover anything other than programming.

          I'm periodically asked to teach the AP CS class at a local private school. Most students have no programming experience at all. A few have done hour of code, but their no better off for it. The first two weeks are all computational thinking. You can't just throw aggregate structures and nested loops at them and expect anything other than confusion and frustration.

          If those

    • That was my reaction too. If they'd said "here is a problem, solve it" then it would have been relatively easy. Instead they threw in a huge pile of constraints dictated by how the person who wrote the question would have solved it, which makes it a lot tougher to figure out. The first paragraph should have been the entire question, not the following four pages.
  • by markdavis ( 642305 ) on Sunday August 03, 2025 @02:59PM (#65563978)

    >"There's tests in 38 subjects"

    But apparently not including English. Next up, English primary school exam!

    "There's tests" = "There is tests". "Is" is singular, not plural.
    Correct answer is "There are tests" or "There're tests."

    • "There're" ??

      Your grammar Nazi license has hereby been revoked.

      • >" "There're" ??

        That is a valid contraction. But it is strange. Much easier to just say/write "there are."

        >"Your grammar Nazi license has hereby been revoked."

        I actually thought it was a funny/witty posting, seeing the construct and subject (exams, education, AP, subjects). Sorry you think it is "grammar Nazi-ism", it wasn't meant to be that way. I do have better things to do than go after incorrect grammar- that would be a futile, full-time job.

      • Make allowances: he might be speaking Texan.
    • by zurtle ( 785688 )

      Then there was the word "vascillating" at the end. An odd combination of vacillating and oscillating, I guess.

    • English is not a prescriptivist language. This is a common enough form, so it's fine.

      • >"This is a common enough form, so it's fine."

        It is "fine" if you want to sound uneducated. Like it or not, people can and will judge you on the way you write and speak. So if you say/write "There is three people", then you will appear less educated. This may interfere with advancement or even just validity of what you are trying to say. In a perfect world, it might not matter (more focus on what is meant), but we aren't living in that world.

  • by drnb ( 2434720 ) on Sunday August 03, 2025 @03:32PM (#65564008)
    And to professors who have taught computer architecture, and to a lesser degree data structures, there is no surprise here.

    There are two big relevant aha moments here. And surprisingly one can possibly get through data structures without them.

    The first is that memory is just a series of addressable words, that can hold an unsigned integer in the range 0-N. N subject to the bit size of the word. And that these unsigned integers can be INTERPRETED as signed integers, floating point values, colors, a CPU instruction, etc. In special cases the hardware interprets these values, the CPU fetching instructions from memory, the video hardware fetching pixels for the screen. More often its just computer software interpreting its various variables of different types that are defined to be at a certain address.

    The second moment is that we can add further abstraction by taking a contiguous number of these locations to interpret as an array. These locations are the data of the array, interpreted as whatever type is appropriate. Plus two supplemental locations are needed. The first recording the starting address of the array, the second the size, or number of elements, in the array.

    A certain amount of hand waving can get one through data structures, but computer architecture is where one will have to face the above.

    A friend that teaches the above says that multidimensional arrays are not as big a deal as the above two. That mapping multidimensional coordinates to a simple array is a pretty straight forward function. Students tend to get that given the math prerequisites. That if someone is having a problem with two dimension arrays check for the second aha moment above. They might not have fully gotten there.
  • What about results from 1966 ?
    chemistry
    Calculus
    Physics

  • You should basically never use a generic ArrayLists or multidimensional arrays anyway. The test authors should feel ashamed to even ask somebody to allocate an ArrayList and return it from a function.

    • by znrt ( 2424692 )

      there is nothing wrong with any of that in java.

      (returning a generic arraylist instead of a specialized type would probably be frowned at, but the exercise was quite clear about that ... besides i find people look specially funny when they frown for nonsense!).

      • by pjt33 ( 739471 )

        The problem is not that ArrayList is insufficiently specialised but that it is too specialised. Anywhere you see ArrayList in a method signature you are entitled to expect an explicit justification for why it isn't an IList.

        • by znrt ( 2424692 )

          that's a fair point but i wouldn't say it's a problem. given the context there is justification to expect an (efficiently) indexable collection. there is no other suitable implementation of list (and there will never be since oracle killed java :O)). that's of course an opinionated design decision. unnecessary generalization adds gratuituous complexity.

          but with a specialized type i was thinking about the collection's content, not the implementation. most java developers i've worked with (not necessarily the

  • by ScooterBill ( 599835 ) on Sunday August 03, 2025 @06:32PM (#65564238)

    How long until people quit learning programming languages?

    I started using AI coding assistants last year. Because of this, I haven't had to write any actual code since then but I've made huge progress with my projects.
    The beauty of AI coding is you leave room in your brain for conceptual ideas instead of volumes of syntax.

    I think these tests will need to change to find the students who can compete while using AI assistants.

    • Re: (Score:2, Insightful)

      by Anonymous Coward
      what a load of bullshit. I use various AI's daily to help with my coding. If you have found some magically AI that can accurately do 100% of your code either your code is so laughably basic as to not matter or you are simply incompetent. AI is great, but no way in hell can it currently do everything or even the majority of coding for a developer yet.
    • Re:Obsolete (Score:5, Informative)

      by gweihir ( 88907 ) on Sunday August 03, 2025 @09:56PM (#65564530)

      How long until people quit learning programming languages?

      Never. There is tons of advanced stuff where you need that knowledge and were AI cannot do anything because insight is required. If you just do simple coding with CPU and memory overkill and no security requirements, sure, "AI" may do most of it. But that is not the situation in most important projects.

    • "How long until people quit learning programming languages?"

      This reminds me of the Office episode where Kevin starts talking in abbreviated English to "save time".

  • A lot of students who might try such CS classes take it on a whim, or because they've heard the pay is good for programmers, or just to try it out. Many of them will find out that working with computers is not what they're good at. And if that's the result, it's a good thing, they will be steered towards something else that they are better at.

    Art is no different. I took art and music classes in school. I learned the theory, but also that I was terrible at art. So I went into programming, which turned out to be my strength.

    There's nothing wrong with taking classes to learn that a subject is not for you.

  • Describing a dog-walking company, we have:

    "Returns the number of dogs, always greater than 0, that are available for a walk during the time specified by hour"

    "always greater than 0"? As this means that every compliant dog-walking company must never run out of dogs to walk, how could one start a dog-walking company? To even exist, it must already have registered dogs — available to be walked at any hour of day or night — or it cannot be instantiated in a valid manner.

    Is there an unspecified

    • by gweihir ( 88907 )

      Yep, the spec is broken right there. There are already two major cases where this will not be true: (a) no dog at that time and (b) no dog at all, because no customers. Obviously this task was defined by an incompetent that does not understand border cases.

      Incidentally, I had some exams in my CS studies where I had to fix the questions because they were broken. Always got the points from the TAs doing the grading in the review, although in one case I had to suggest I could explain why the question was broke

      • by Jeremi ( 14640 )

        Obviously this task was defined by an incompetent that does not understand border cases.

        Is that obvious? To me it looks like the task was defined by someone who was looking to simplify the requirements so that test-takers could focus more on the relevant parts of the problem and less on corner-case minutiae.

        It's the programming equivalent of the Physics exam question that ends with "ignoring air resistance".

    • Either these problem statements are deliberately written to be confusing, or whoever wrote them should be fired.

      Are they testing for programming ability, or for ability to read poorly worded problem statements ?

    • > Or perhaps to muddle through and pretend that the commented contracts are irrelevant

      I'm guessing that the only way to get graded as correct.

      If you took the method definition at face value you'd be entirely justified (given no other comment about error handling) to throw an exception if this assertion is false, and your code would therefore fail if they test it (unless their test code is doesn't even test for their own corner case).

  • I have a hard time believing that writing for loops to access an array is causing problems for students, but rather the excessively verbose description of the clearPair() method, including all the examples which might make one assume there is some corner case under-specified by the description.

    It seems like middle school math problems where the math itself is easy but the challenge is understanding the problem statement.

  • At first I thought it would be some form of BFS, but it's really simple, cause if you have a matrix, where you want to see if all the numbers pair up, and each can pair with any other eligible, it doesn't matter which cells pair together.

    They don't ask if the puzzle is solvable but it seems like this should be solvable in O(n) time if the sum of all elements is the same as the sum of foreach(10-element).

    e.g.

    1 2
    1 2

    = 6

    9 8
    9 8

    = 34

    1 2
    9 8

    = 20

    4 4
    2 0

    = 10

    6 6
    8 10
    = 30

C makes it easy for you to shoot yourself in the foot. C++ makes that harder, but when you do, it blows away your whole leg. -- Bjarne Stroustrup

Working...