Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Education Programming

How Should Schools Grade Unexpected-But-Correct Answers On Coding Tests? 177

There can be more than one correct answer for academic tests of programming ability, writes long-time Slashdot reader theodp: Take the first of the Free-Response Questions in this year's AP CS A exam, which asked 70,000 college-bound students to "Write the static method numberOfLeapYears, which returns the number of leap years between year1 and year2." The correct answer, according to the CollegeBoard's 2019 Scoring Guidelines, entails iterating over the range of years and invoking a provided helper method called isLeapYear for each year.

Which does work, of course, but what if a student instead took an Excel-like approach to the same problem that consists of a (hopefully correct!) single formula with no iteration or isLeapYear helper function? Would that be a worse — or better -- example of computational thinking than the endorsed AP CS A Java-based solution? (Here's a 7-minute AP Conference discussion of how to correctly grade this problem)?

So, how have you seen schools and companies deal with unexpected-but-correct approaches to coding test questions?
This discussion has been archived. No new comments can be posted.

How Should Schools Grade Unexpected-But-Correct Answers On Coding Tests?

Comments Filter:
  • by grep -v '.*' * ( 780312 ) on Sunday August 18, 2019 @06:42AM (#59098740)
    Remember that episode? And schools are a LEARNING environment, right?

    So the correct answer is: fail them, and teach them the egregious errors of their ways so that soon they too can enjoy the wonders of mindless group thinking.

    After all, you'll soon be noticed if you stick up like a nail.
    • by Z00L00K ( 682162 ) on Sunday August 18, 2019 @06:57AM (#59098782) Homepage Journal

      Failing is the incorrect way to do it. The correct way is to approve the solution since it's the goal that's important and not the specific way that the problem was solved.

      What school shall be for is to learn how to solve a problem, not to be a robot.

      Leap years are relatively easy to calculate too, at least if you keep to one calendar and not have to take the transition between Julian and Gregorian calendar into account.

      • Failing is the incorrect way to do it. The correct way is to approve the solution since it's the goal that's important and not the specific way that the problem was solved.

        A programmer should provide something that fulfills the specification. If the examiners want the program written in a particular way then their specification should make that clear. So if the student provides an unexpected solution the fail should be awarded to the examiners.

        • by Z00L00K ( 682162 ) on Sunday August 18, 2019 @07:49AM (#59098956) Homepage Journal

          Requirements shall declare the expected result and not the path to the result. I.e. what you want, not how. In the requirement you may require performance constraints.

          • by kenai_alpenglow ( 2709587 ) on Sunday August 18, 2019 @07:53AM (#59098970)
            THIS. I still remember elementary school, where I had come up with my own way of handling carry/borrow in subtraction. It worked, I knew how it worked. But because I was not doing the way the teacher wanted me to, I got marked down. When you're managing a contractor. you specify WHAT you want. You're paying that contractor for their expertise to figure out HOW best to do it. (Of course said contractor better be able to show that their way meets the the requirements--and you'd better have set those requirements correctly!)
            • by ShanghaiBill ( 739463 ) on Sunday August 18, 2019 @12:39PM (#59099662)

              But because I was not doing the way the teacher wanted me to, I got marked down.

              This is how the CS AP test works. If you use some fancy-pants approach, you WILL BE MARKED DOWN if the grader doesn't understand it.

              So students should be taught to not overthink, and to write the "expected" solution in a simple and straightforward way.

              Of course said contractor better be able to show that their way meets the the requirements

              The test-taker has no opportunity to "explain" their cleverness. They just turn in the paper copy of the program, and the grader anonymously grades it. There is no other communication between the test-taker and the grader other than what is written on the paper. No side-channel explanation, no appeal, nothing.

              The purpose of the free-response portion of the test is to show that you can write code, not to show that you are clever.

          • Exam, not a job (Score:5, Insightful)

            by Roger W Moore ( 538166 ) on Sunday August 18, 2019 @09:57AM (#59099270) Journal

            Requirements shall declare the expected result and not the path to the result.

            That's not the case in an exam where the goal is to test knowledge. In basic mechanics, there are often two paths to solving a simple mechanical system: use dynamics or use energy. Sometimes it can be hard to set up a question to force a student to take one path (or you might actually want them to use both paths and compare) so, because I want to test that they know how, I will say something like "using conservation of energy, find x". In such cases if they ignore that instruction and do it by a different method they get zero.

            On the flip side if I do not have such instructions then students are free to solve questions by any valid means but, if they go off the beaten track, then they do need to carefully explain and justify what they are doing because, particularly in simple physics problems, you can sometimes derive the correct numerical answer by a completely invalid path where the numbers "just happen" to work out for that one situation.

            • Re:Exam, not a job (Score:5, Insightful)

              by the phantom ( 107624 ) on Sunday August 18, 2019 @12:45PM (#59099676) Homepage

              Broadly speaking, yes, the point of an exam is to test the examinee's knowledge. However, that is a very vague and imprecise statement. In principle each exam item is meant to assess a specific piece of knowledge. For example, the example of finding leap years is likely intended to get students to demonstrate an ability to iterate using a for loop with a nested conditional. One could simply tell the examinee that this is the intention, but then you are essentially telling them how to answer the question, which reduces the validity of the assessment (to what extent is, of course, a matter of debate). At the end of the day, the exam writer needs to know if an examinee can actually recognize a situation which calls for iteration, and whether or not they actually code up a valid for loop.

              On the other hand, if a student comes up with a valid though unexpected solution, the fault is with the writers of the exam item, and not the examinee. The correct course of action in such a case is probably to give the examinee credit for their correct answer, or to remove the exam item from the computation of scores for all examinees. Hopefully, the knowledge which the invalid exam item was meant to assess is tested elsewhere—one or two problematic exam items should not seriously threaten the overall validity of an exam which is made up of many questions.

              • The correct course of action in such a case is probably to give the examinee credit for their correct answer, or...

                I would argue that this is the only correct course of action. If they solved the question that you asked in a manner consistent with the text of the question then they have to get the credit. Removing the item means that the time they spent on it is now wasted and, if they spent time on this at the expense of other parts of the exam, this would unfairly disadvantage them. Excluding a question should only be done when there is literally no alternative e.g. a question with no valid answer.

          • Both! If the examiners want you to use a loop to solve the problem, then create a problem that requires a loop. For example, count how many people in a group have a drivers license using the function hasDriversLicense.

            If the problem can be solved without using the skill the examiner wanted to probe for, the examiner screwed up when designing the test. The solution is easy, learn from your mistakes and make a better question next year.

    • by CaptainDork ( 3678879 ) on Sunday August 18, 2019 @08:22AM (#59099034)

      Real life experience:

      I had a nephew hit up against his first year of algebra. Luckily, I was an algebra tutor for kids his age and up.

      I told him, "Tommy Wayne, put down the pencil and close the book and let me tell you how this stuff works. THEN we'll do the homework."

      I talked him through the awkward newness of placeholders instead of actual numbers, and how equations are scales that must always balance, and off we went! I gave him some fun problems and we giggled and punched each other.

      The kid (like me) was bright.

      Two days later he was all upset. He'd gotten all the right answers and stuff, and he showed his work, but the teacher wanted the workflow to be HER style.

      I told him, "Work it both ways. I want you to work it the way I taught you first, then I want you to work it her way. It'll be cool to have a double check to make sure you're correct, because that's the ultimate goal."

      Kids his age rarely signed up for another semester of that crap, but he was like, "Bring it on!" He didn't have to show his work by then and I taught him some shortcuts.

      He's in college and tested out on all of his math except for calculus, a discipline in which I suck.

      • by Junta ( 36770 )

        I remember going thorugh that and now I get to see my daughter go through the same thing. Even worse as she's generally asked to show her work using multiple strategies for the same question and frequently none of the required strategies are what she likes.

        Gave the same advice, solve it whichever way you want and then go back and show the work the ways the coursework demands. It's tedious but that's just how the world can be sometimes. It's also good practice for the real world, where frequently the same

  • As correct? (Score:4, Informative)

    by weilawei ( 897823 ) on Sunday August 18, 2019 @06:43AM (#59098746)

    If you want to do a standardized test logical problem solving ability, then you don't get to quibble when they find holes in your logic.

    • I actually just had this exact case come up for my sons pre-calculus final exam. He solved some of the problems asking for how many roots. He included the complex roots and they marked it wrong since they meant real roots and cosidered analytic continuation a subject for 2nd year calculus. He also got marked down for computing analytic derivatives rather than taking small diferences and dividing by a small delta.

      Their concept was this-- they are trying to make sure you understand the process not memoriz

      • It’s not wrong to tell students that they must demonstrate a solution using a specific method. It’s wrong to tell them they have to demonstrate a solution, and then tell them that their method isn’t allowed.
      • by lgw ( 121541 )

        It's dishonest and unfair to to penalize someone in a game without first explaining the rules. Even small children understand this. But teachers often don't.

        If it was clear from the instructions on the test that a specific method must be used, not just "get the right answer", then fair enough. But, as with most tests, the full instructions were along the line of "solve this" or "prove that", then it's dirty pool to mark off for method chosen.

        • by stdarg ( 456557 )

          To be fair, if a child is providing answers with complex numbers when others in his class don't even know what they are, it would be silly to say "and don't count complex numbers" in the question. Over-explaining rules that don't apply to the vast majority of students only adds confusion.

          I agree it was handled badly, of course, sounds like he had a terrible teacher.

    • by Junta ( 36770 )

      While I agree with the sentiment:
      "In order to calculate this value, a helper method is provided for you.
      isLeapYear(year) returns true if year is a leap year and false otherwise.
      Complete method numberOfLeapYears below. You must use isLeapYear appropriately to
      receive full credit."

      In this case, the test is very clear and if you are clever enough to write the function without the helper, you are clever enough to know *exactly* what they are looking for and go with it.

      There are two facets to this. Obvio

      • You can simply implement your isLeapYear using the Excel formula as function numLeapSemiOpen called as numLeapSemiOpen(year,year+1) and obtain the best of all worlds.

        If isLeapYear isn't allowed to call out, then you assign begin=year, end=year+1 and fall through to the Excel formula inline.

        Procedural if blocks have no business existing inside of a simple algebraic map. We've been hammering on the wrong conceptual model of contingency so hard for so long, many programmers now find the direct approach weird,

        • by epine ( 68316 )

          I probably got some sign wrong in the example code. That wasn't the point. I had bigger fish to fry. If that's where you stopped, read again.

    • by cob666 ( 656740 )
      It really depends on the curriculum and instructions before the test. If VBA style inline / macro programming was NOT part of the curriculum and the teacher has been focusing on helper or recursive functions then the 'Excel Solution' would NOT be correct.
  • Comment removed (Score:5, Insightful)

    by account_deleted ( 4530225 ) on Sunday August 18, 2019 @06:45AM (#59098750)
    Comment removed based on user account deletion
    • Re: (Score:2, Insightful)

      by AC-x ( 735297 )

      This is a computer science test, answers should also be scored on things like code readability, maintainability etc. and not just a single score for any working answer.

      • Is it a computer science test or a software engineering test?

        Score on those for the latter, not the former.

      • by tomhath ( 637240 ) on Sunday August 18, 2019 @07:35AM (#59098916)
        This is a Java programming test. You must not write efficient code, you must write the method they have instructed you to write. Even though it's a dumb way to solve the problem; it's the Java way.
      • If there is a comment that counts as readability, and if it works as intended then there is no maintenance issue. Obviously if the comment is wrong that is a 100% fail. One man's readable maintainable code is another's nightmare. If the desired outcome is O(n) performance and n is met and the solution is actually more clever than expected that is never a failure. The problem with software today is so many people who shouldn't be doing it complaining that people who are qualified to do it won't hold their ha
    • Way back when I lost points on a test despite being the ONLY correct answer. Had to school the prof on why his solution (and most of the classes, at least all the ones that had an answer at all) was wrong. He was so petty that rather than give me full credit back, he went and found cosmetic quibbles to only give me about 75% credit despite being the only one in the class to get FM modulation after frequency multiplication right.

      At the end of the year be put the A/B line right above me, despite a large gap

  • by Antique Geekmeister ( 740220 ) on Sunday August 18, 2019 @06:45AM (#59098752)

    It occurred several times during my college days.When possible, the key was to do it _both_ ways, the expected way taught by the class to that point as well as the more effective or more elegant solution.

  • AP Grader (Score:5, Informative)

    by dmiller1984 ( 705720 ) on Sunday August 18, 2019 @06:51AM (#59098766)
    I've graded the AP Computer Science exam for a few years now, and if a student writes a solution that works they get full credit. Period. The College Board always releases a "canonical solution," but it is just an example. Sometimes it isn't even the most common solution students write.
    • Seen more often in subjects like history or logic, which explicitly contain both facts and reasoning to conclusions. The "answer" in the grading sheet is just an illustrative example.
    • Re:AP Grader (Score:4, Insightful)

      by bobbied ( 2522392 ) on Sunday August 18, 2019 @07:54AM (#59098972)

      Within the bounds of the question and good programming practice....

      If I tell you to sort a list of numbers using a bucket sort and you do it using a bubble sort, I might give you partial credit depending on the point of the course. If you write something that is less efficient but still does the bucket sort, you are getting more credit. Also, I don't really care about syntax errors or things that the compiler will catch (unless that's the point of the question) so I'm not marking down students for missing semicolons or mismatching braces.

      The point of the test is to verify the student knows the material well enough to answer the question asked. If you answer the question, using the specified technique, you get credit as long as I can figure out what you are doing. I do sometimes take off for egregious programming practice problems. If you are in a language that you have to manage memory and you don't, if you program something that leaks memory like a sieve, or if you go out of your way to program around not knowing how a 'while" loop works, then, depending on what the course is about, you might lose some points.

    • But how would you mark a "solution" that returned the correct answer but wasn't immediately obvious why it was correct? I don't know how the American system works, but I wouldn't accept it without justification, such as a proof of correctness.

      • by GuB-42 ( 2483988 )

        If it is correct in a way that is not obvious to you, learn from it, and give full marks.

        If it is not correct in some edge case, that's a fail. Dates in particular can be tricky. For example, in 1582, we switched from the Julian calendar to the Gregorian calendar. It affects leap year calculations.

        • Re: (Score:3, Informative)

          by rgmoore ( 133276 )

          Catholic countries switched to the Gregorian calendar in 1582. Most Protestant and Orthodox countries took longer to switch. England (and countries under English rule) didn't switch until 1752, and dates in the 170 year gap have to be specified as [NS] or [OS] to indicate if they're Gregorian (New Style) or Julian (Old Style). Russia didn't switch until after the Communists took over. Eastern Orthodox churches still use the Julian calendar for liturgical dates, which is why they celebrate Christmas late

        • by theodp ( 442580 )

          Good point. Perhaps the difficulty of defining what to do for these edge cases is one of the things that led the College Board to leave isLeapYear as an undefined black box. Microsoft Excel hiccups on dates earlier than 1900 [wikipedia.org], so hopefully handling things back to 1582 still merits partial credit. :-)

      • With the sort of problem mentioned in the main post, you can do relatively exhaustive testing. Like all pairs of dates between 100CE and 6000CE. That should be reasonably fast.

        There are a few correct answers, though, so you'd want a test harness adept enough to handle that. There's the proleptic Gregorian calendar, which would use the same leap year rule as we currently do. Or you could switch between the Julian and Gregorian at some point between 1582 (Catholic countries adopt the Gregorian calendar) and 1

    • The excel solution doesn't handle the years before the Gregorian calendar began, and the "leap years" in the problem might not even be the Gregorian leap years. Or perhaps it's a Gregorian leap-year with pre-Gregorian dates "filled in" for business purposes, perhaps it's grafted Julian leap-years on for the date range that would apply, or perhaps it's going to be used in a Mars calender where the leap year formula will necessarily have different coefficients (# sols / martian year is not the same ratio as d

      • by sjames ( 1099 )

        Appropriately in some cases may mean not at all. For example, when tightening a screw, the appropriate use of a circular saw is not at all.

        Unless calendry was a subject of the class, the examiners may NOT assume the students know there was a shift from Julian to Gregorian calendar resulting in a change in the leap year calculation.

        OTOH, if the irregularity of leap year WAS discussed in class, then the student is properly responsible for knowing that and so answered the question incorrectly.

  • by bloodhawk ( 813939 ) on Sunday August 18, 2019 @06:58AM (#59098788)
    The question specifically stated you need to use the "isleapyear" function to receive full credit. Therefore they should and probably would be marked down. The summary has edited the question to make it sound like the solution met the questions requirements, it doesn't.
    • by davecb ( 6526 )
      The illustrative example, which mentions isleapyear(), is not available to the students, so using it can't be a requirement
      • In order to calculate this value, a helper method is provided for you. isLeapYear(year) returns true if year is a leap year and false otherwise. Complete method numberOfLeapYears below. You must use isLeapYear appropriately to receive full credit.
      • The question provided to the student was:

        "Complete method numberOfLeapYears below. You must use isLeapYear appropriately to receive full credit."

        If this were the AP Calc exam the question said:
        "Calculate integral below. You must use integration by tables (see tables provided) appropriately to receive full credit." and the student use purely integration by parts or inverse trigonometric forms (without get near any of the formulas on the provided table). Student getting the correct result of course. No one

    • by tal_mud ( 303383 )

      So, if they had added a line

      bool ignoreMe = isLeapYear(startingDate);

      then they would have gotten full credit, but without it they get marked down?

    • No, the question says the function must be used appropriately. If the algebraic solution a 100 times more efficient than the for loop/fold in the worst case, it's actually inappropriate to use at all it it's on the critical path.

      An appropriate use doesn't always exist.

    • No, it says you must use isLeapYear appropriately, and in my experience when an O(1) algebraic solution exists that can effectively replace an O(N) iterative solution, the appropriate use of the helper function is to not use it at all.

      I know that's not what they meant, but if the proctors are going to hold us to every word, I'll hold them right back. They shouldn't have qualified the use of the function. They should have said, in no uncertain terms, that it must be used to receive credit.

  • Then reward them with full points. If it solves the problem in a non suboptimal way that is way too resource intensive anything else but full points would punish creative problem solving.

    If you want them to demonstrate application of a specific approach to solve the problem, then mention that they are supposed to solve it using that method.
    For example you could add: Use the methods we learned in class. As a general rule for answering questions. That doesn't give away the exact approach, which may make th
    • a non suboptimal way

      Hmm, is "non suboptimal" the same as "optimal"?

      • by fazig ( 2909523 )
        More or less.

        There can be solutions for problems that may work under some idealized conditions, but if you have restricted memory and computational power available it may not work that well and fail under those circumstances. Which makes the solution suboptimal.
        Well, at least that is how I am using that.
  • All the staff had to know their topics.
    The students should know the topics after years of "study".
    The academic tests will rank the best to the average to the well below average.
    The conscientious students with the correct IQ level will read the question and attempt to answer in the time given.
    The person doing the test learned something over the days/weeks/months and can now show what they know.
    Did not bother to study? Thats not the education systems problem.
    Wont study? Who passed the failed student
    • The goal in education is to give pupils a 'score' based on their ability and willingness to follow instructions. It isn't a score for creative thinking, or even productiveness. It's a score for doing what you are told and completing assignments compliantly.

      I don't do that well in such a setting. A lot of people here probably haven't because we are creative and find ways to route around authority whenever possible.

      But academic scores matter a LOT to the HR fucks who gatekeep at big companies.

  • by MindPrison ( 864299 ) on Sunday August 18, 2019 @07:15AM (#59098842) Journal

    ...I always tried to welcome creative solutions to the problems presented.

    Unfortunately, the school system is not created as simple as that. Most teachers, including the principle, would expect you to correct the tests according to the facit at hand (expected answers, correct down to the smallest detail), not the actual result or outcome, which I find so sad. This is primarily why I stopped teaching, I couldn't handle the constant onslaught and endless explanation to my fellow teachers that the students problem solving was correct, and not incorrect even if it did not have the exact same code as in the expected correct code. Some of them where even shorter and smarter.

    In my mind the school has to upgrade themselves, learn to respect creative individuals and recognize that there's more answer than just one.
    If you can outcode or outperform the expected result, meaning - you get an equal or better result - then you should be commended for it, not punished!

    Thankfully, the industry has far recognized this talent, and don't give a hoot about your test scores, but what you can do for the company.

    • Basically this.

      The problem is BURN OUT, grading answers is the most painful mental torture outside of modern US public school politics. New teachers may be OK but after they burn out from proper grading they will gravitate towards avoiding the suffering and some without oversight will go to multiple choice automated grading. Actually, technology encourages bad behaviors and does more harm in the end... it needs to be treated like an opiate... an occasional necessary evil. We also have generations of bad p

  • The Question should state "Calculate the number of leap years from year X-Y by iterating over the range of years"

    Then, any other method is incorrect.

    • The modulus operator used in the formulaic solution inherently iterates without actually having to iterate.

      Wait for it...

      It says to all the years, "Everyone who is a leap year, please step up." All the years heard it but only leap years stepped up.

  • This is nonsense (Score:4, Interesting)

    by onyxruby ( 118189 ) <onyxrubyNO@SPAMcomcast.net> on Sunday August 18, 2019 @07:22AM (#59098864)

    If someone supplies a correct answer they should be credited accordingly. Your inability to foresee all possibly correct answers to a problem should not inhibit others. It's like asking someone to prove their work and grading their answer wrong when they didn't prove their work to your satisfaction. I can recall more than one conversation over the years like this:

    Teacher: I marked it wrong because you didn't show your work.
    Me: The answer is correct, I did my work in my head.
    Teacher: How do I know you didn't cheat and copy the answer from someone else?
    Me: Because I'm always the first person to turn my test in.

    It shouldn't matter how someone comes up with an answer so long as they don't cheat. A correct answer is a correct answer and in the real world there is often more than one correct answer. Correct answers should always be credited.

    People are always clamoring about how they want diversity in ideas, so why the hell would you mark down an answer that is correct just because someone had a different idea on how to achieve the desired result? This is the kind of real world skill that employers need in the workforce. In my experience the ability to present multiple correct answers to a problem with the benefits, drawbacks and a recommendation between to leadership is a critical career skill.

    • Re:This is nonsense (Score:5, Interesting)

      by bobbied ( 2522392 ) on Sunday August 18, 2019 @08:06AM (#59098998)

      If a test question says 'show your work' and you don't, no credit from me. I had an instructor in college who absolutely required that your work be shown and if you didn't show it, even the correct answer got zero points. But the whole POINT of the course was to teach how to derive the equations to solve various physics problems, so that's what the test was about. Getting the correct answer was nice, but if you didn't know how to get that answer, you didn't know the material.

      This is all about what the teacher is trying to teach and what's being asked on the test.

      However, I recommend that the "in my head" folks show their work, always, in sufficient detail to show how the answer was obtained. In the rare instance the answer is wrong, showing your work may get you partial credit and help your grades. Of course lazy teachers don't like this, they just look at the final answer and don't care about the rest.... Which is a shame.

  • The teachers we have won't recognize the answer as right anyway.

  • College Memory.... (Score:4, Interesting)

    by Ronin Developer ( 67677 ) on Sunday August 18, 2019 @07:31AM (#59098900)

    When I took a computer engineering exam while at college, the prof said 5 points off for a missed gate.

    I did the minimization and checked the results. Then, I drew the diagram and turned in my exam thinking I had a 100.

    Got the exam back and got a 5. I was stunned. I then went to see the prof who insisted My solution was entirely wrong and that is why he gave me a 5 out of 100. I said I missed just one gate in my diagram.

    I then spent a hour with him, going over 256 possible inputs to demonstrate that all that was missing was a single inverter - which was clearly indicated on the calculations I had done.

    After all 256 cases were tested, he regraded the exam as a 95...taking off just the 5 points for the missed gate.

    He was a substitute prof for the course and was going off the answer key. He wasnâ(TM)t prepared for a better and truly minimal solution. But, he listened (albeit reluctantly) to me and gave me the correct score in the end.

    In my case, the test question did not spell out how the student was to solve the problem. In an open ended CS coding problem, plugging the code into a test framework (like used in online coding interviews) would demonstrate if they solved the problem correctly.

    So, I say make them implement the code to a particular interface as part of the exam and run it through a prepared test framework.

    In my case, I had used a different minimization technique that utilized Quinn-McClusky instead of 8 input Karnaugh maps....they hadnâ(TM)t taught QM in our course.

  • As someone who spends his days dealing with thousands and thousands of lines of overly complicated untested but operational code I would say fail them. When you break a problem into smaller pieces it becomes easier to test. A simple function called isLeapYear can be validated with a Spock expect/when specification and quickly know if it is hitting the mark for each year. If you test it as part of a larger looping method yes you can get the right answer. But, it becomes harder to write tests that prove i
  • I'm not sure how that formula could possibly work as it doesn't refernce cell B2, the end year.

    But number of leap years between 0 and the end year minus the number between 0 and the beginning year should work; they need to finish it.

    • by theodp ( 442580 )

      The three lines do start with "=INT((B2-". Assuming you're referring to the second calculation in each line, which I should have commented on, it omits B2 because it's an adjustment to add 1 if A2 was respectively divisible by 4, 100, or 400 (probably a clearer way to do this, but it is what it is). And, in retrospect, I should have showed the formula within C2 instead of copying-and-pasting it into a note and marking it up - when I read this, my first thought was that I moved something around in the worksh

  • ... and quite possibly the "correct" answer is broken as well.

    The one-line function 'Excel-like' does not work, at least in the sense that it uses the proleptic Gregorian calendar rather than calculating the leap years using the Julian calendar for those years before the changeover. (That is, it projects the Gregorian calendar backwards even during those years in which the Julian calendar was in use). There will be a similar proleptic error when we have to abandon the Gregorian calendar in a couple thousa

  • It's 1989 in my alternate universe. I predict that before the end of the 20th century, grading answers on coding tests will be completely automated. The answer will simply be executed on a computer for a variety of inputs, and if a student's solution gives correct answers and executes in a time not too much more than the execution time of a reference solution, the student gets credit for a correct answer. (The exact grade could depend on the execution time, if you want to get fancy.)
  • There are at least two correct answers to this test--pass and fail. Which one is less-incorrect depends on context and other facts not-in-evidence.

    In the past, testing was most often done to determine how much the student had learned and now knows. More recently testing (especially standardized) is done to predict some measure of subsequent success. These are very different goals. Back-testing might well indicate the unconventionally correct answer _should_ be marked wrong. (To the delight of mechanical

  • by multriha ( 206019 ) on Sunday August 18, 2019 @09:16AM (#59099142)

    The AP exam is a certification style examination. It is entirely different from a test a student normally in school or college.

    In school, test are (in theory) part of a learning experience. The testis NOT about learning, it solely about evaluation.

    A major function of the AP exam is to determine if the student has the knowledge and understanding they would receive from taking the corresponding college course. Reading and understanding how to answer question is part of this.

    For this example the each text of the question "Complete method numberOfLeapYears below. You must use isLeapYear appropriately to receive full credit."

    It should be noted that how a leap year is defined or determined is absolutely absent from this question. What a leap year is for the purpose of this question is what the isLeapYear methods returns true for.

    Understanding the abstraction and how to use it specifically what the question is intended to test for. Also the test is not taken in a vacuum. It is taken after having a school-year long course designed whose curriculum is specifically designed for the test and how it should be taken.

    The understanding that using a formula without touching the provided and required helper function is not the 'right answer' is part of what is being tested.

  • There are many ways to express ideas in english, and for a grade-nine student to demonstrate understanding of adjectives. A four-page poem demonstrated adjective-use far more than a four-page essay of prose.

    English teachers have no problem grading that poem -- it's a very quick F or "incomplete".

    It's "school", not "learning". It means "everyone together", not "understanding".

    There are many ways to swim through the ocean. You can't be in a school, and also go your own way.

    I don't see why it would be any d

  • The Story of Gauss [nctm.org]: "I love the story of Carl Friedrich Gaussâ"who, as an elementary student in the late 1700s, amazed his teacher with how quickly he found the sum of the integers from 1 to 100 to be 5,050. [...] This representation of the way Gauss solved the problem may help students explore the connection to the algebraic generalized form for finding the sum of a series of consecutive numbers: n(n + 1)/2."

  • Urban legend [snopes.com] around since the '50s.

    Interesting "out of the box" answers are generally celebrated, not punished. This is especially important in business as it can save a lot of money.

    Reminds me of how the original apple disk drive was made.

  • Because without more extensive explanation by the student, it suggests that the student avoided the most reasonable solution in favor of something complicated and unsupported.

    It means the student chose to ignore the specifically given function that was stated to provide isLeapYear (which may have been rigorously tested to not fail any situation), in favor of a formula they've defined and provided no other justification for.

    Is the definition of a leap year mod_4 - mod_100 + mod_400 precisely? There
    • by I4ko ( 695382 )

      even with the function, there are ways to optimize the number of comparisons needed. You don't need to compare each year, you only need compare every (lowerBoundary + ( 4 - lowerBoundary mod 4)) + 4 * n until it becomes equal to (upperBoundary - ( upperBoundary mod 4)), similar to this

      c:=0
      y:= (lowerBoundary + ( 4 - lowerBoundary mod 4))
      h:= (upperBoundary - ( upperBoundary mod 4))
      if y>h then error
      while y = h {
      if isLeapYear(y) then c++
      y:=y+4
      }

      • by I4ko ( 695382 )

        Obviously also check if the boundaries themselves are leap years which the above code will not do.

  • Who is setting these questions that they consider the obvious answer "unexpected"?
  • Comment removed based on user account deletion
  • Interviewer made some quip in email about not asking silly questions like "Write a kernel-quality scheduler in under 20 lines of code."

    I came back immediately with:

    for(;;)
    ;

    It will require some work to scale past N=0, but that wasn't in the requirements.

  • Sorry, but expecting people to know Java to answer questions on a test that's supposed to be general is inherently flawed.

  • Don't programming teachers not know how to calculate complexity anymore?

    The answer works, so in all cases it should get a passing grade, at least. If the complexity is equivalent to that of the expected answer, full mark. If it's better, bonus points (the teacher grading the test should also explain why in the first and last cases).

  • people capable of formulating unexpected-but-correct answers to CS questions either study math or physics, not CS.
  • by kpoole55 ( 1102793 ) on Sunday August 18, 2019 @12:15PM (#59099616)

    This happened to me when we actually studied Geometry in high school. I wrote a proof that was a line shorter than the standard proof and the marker tagged it wrong. I went to the teacher and asked why my proof was wrong and when it was actually read they had to agree that the proof was correct and changed my mark.

    Challenge them to tell you why a thing is wrong when it produces the desired result in a more imaginative way. We need to understand but we cannot understand AND PROGRESS by sticking to wrote learning. We need original thinking as well.

  • by istartedi ( 132515 ) on Sunday August 18, 2019 @12:19PM (#59099626) Journal

    I've experienced this myself as a student, in both good and bad ways. One time I wrote what I thought was a "cool" self-modifying function that worked. I did not get full credit for that, and later I learned why self-modifying code was bad. OTOH, I once had a TA take off because I produced a solution to a problem that used a Mealy network rather than a Moore network. That TA said he expected me to use a cookie-cutter approach (that we hadn't even been taught!) and that it would produce a Moore network. I badly wanted to complain about this to the prof., but I decided not to make waves since I was getting an A in that course anyway. It still sticks in my craw though.

    So. If the solution produces the correct output, properly handles exceptions, is readable, and runs as fast as the "standard" answer, the student should get full credit--regardless of how they get there, or what they got.

    OTOH, they could have a solution that produces correct output but is excessively "cute", or slow, or somehow insecure. Partial credit, depending on how bad these problems are.

    Don't straitjacket them, but don't let them wander in the woods either.

  • But seriously, if the test makers are looking for demonstration of knowledge of certain coding/problem solving problems, they need to come up with better questions.

  • If the question given was "provide the correct answer to this question" then anything that does needs to be given full points, because the taks, as stated, has been accomplished.

    If you ask something like "apply the approach you learnt in class to solve the following problem ..." then only that approach counts, because you're essentially asking a memory question.

    It really is very simple when you use a bit of logic, isn't it?

    I know this is common, and I hate it, but people do need to stop asking open-ended qu

  • Much like in math where you need to show your work you are proving you know a concept, not just how to get to the answer. If you are teaching on recursive functions, you best show your work using them.

"If the code and the comments disagree, then both are probably wrong." -- Norm Schryer

Working...