There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

darkmogool , in You can certainly change it. But should you?

Is this wrench made of chocolate?

CptEnder ,

Forbidden chocolate

owen , in Programming languages personified - leftoversalad

This is awesome. Rust wearing full plate armor to dinner is hilarious… Also what’s up with Scala? lmao

marcos ,

Well, obviously she was already in full plate armor when her friends called, so why take it out?

captain_aggravated ,
@captain_aggravated@sh.itjust.works avatar

And being the designated driver.

tatterdemalion ,
@tatterdemalion@programming.dev avatar

I assume Scala is like a “gateway” (drug) to functional programming by way of also supporting imperative and object oriented paradigms.

owen ,

Ouuu. This makes sense to me, well thought

BatmanAoD ,

Probably more importantly, it runs on the JVM and is designed to interoperate with existing Java code. (FWIW, I actually think they made a major mistake in how they handle null Java objects, and that Kotlin did better here; but Kotlin is much newer.)

tatterdemalion ,
@tatterdemalion@programming.dev avatar

Oh good point I totally forgot it’s a JVM lang.

PhAzE , in Exam Answer

The answer is 6. It’s 6 characters long.

potustheplant ,

Not really, no. That would be the answer if x= len(day). The code in the image would just throw an error.

force , (edited )

no it wouldn’t, because this is OCR reference language

run this

Ephera ,

What the heck, did someone invent a programming language, so students wouldn’t have to learn any real ones?

mounderfod ,
@mounderfod@lemmy.sdf.org avatar

Having done OCR GCSE computing:
It’s just a pseudocode style language that they use in exam questions so that you can understand the question regardless of which language your school had you study (in my case it was VB6 💀). In questions where you are asked to write code, you can use the reference language but realistically you just use the one you learned (although I did it all in python instead)

56_ ,
@56_@lemmy.ml avatar

Huh interesting. In Scotland we had another one: en.wikipedia.org/…/Haggis_(programming_language)

PhAzE ,

Yea, it’s pseudo code.

flumph ,
@flumph@programming.dev avatar

“Monday”.length is working JavaScript and does equal 6. No print command afaik though.

AnAngryAlpaca ,

deleted_by_author

  • Loading...
  • kia ,

    You don’t need terminating semicolons in JavaScript. They’re added in if missing. It can actually cause a few bugs around returns.

    dvlsg ,
    @dvlsg@lemmy.world avatar

    There technically is!

    developer.mozilla.org/en-US/docs/Web/API/…/print

    Well. In browsers, anyways.

    Scrollone ,

    Yes, but it prints the page, so in this case it wouldn’t print anything

    PrettyFlyForAFatGuy , (edited )
    
    <span style="color:#323232;">function print(str) {
    </span><span style="color:#323232;">  console.log(str)
    </span><span style="color:#323232;">}
    </span>
    

    FTFY

    fidodo ,

    How do you know what language this is?

    lthlnkso , in Exam Answer

    I think this is a good question and answer in the sense that it reveals a fundamental misunderstanding on the part of the student - exactly what you hope an exam would do! (Except for how this seems to combine javascript’s .length and python’s print statement - maybe there is a language like this though - or ‘print’ was a javascript function defined elsewhere).

    This reminds me once of when I was a TA in a computer science course in the computer lab. Students were working on a “connect 4” game - drop a token in a column, try to connect 4. A student asked me, while writing the drop function, if he would have to write code to ensure that the token “fell” to bottom of the board, or if the computer would understand what it was trying to do. Excellent question! Because the question connects to a huge misunderstanding that the answer has a chance to correct.

    agressivelyPassive ,

    Teaching complete “clean slates” is a great way to re-evaluate your understanding.

    I’ve had to teach a few apprentices and while they were perfectly reasonable and bright people, they had absolutely no idea, how computers worked internally. It’s really hard to put yourself in the shoes of such persons if it’s been too long since you were at this point of ignorance.

    captain_aggravated ,
    @captain_aggravated@sh.itjust.works avatar

    I forget which one, but one of my flight instructor textbooks said “to teach is to learn twice.” And BOY HOWDY is that accurate.

    You will find no better teacher of expert aeronautics than a brand new student. They will show you a new perspective, every single time.

    abbadon420 ,

    Second this. I’m a teacher aid and I get to fix student’s code for students who are not technically inclined. It’s so much fun and I’ve learned so much McGuivering all that shitty mess together.

    MrRazamataz ,
    @MrRazamataz@lemmy.razbot.xyz avatar

    For reference the “language” used in the exam would probably be Exam Reference Language (OCR exam board specifically, which I believe this question is from) which is just fancier pseudocode.

    morrowind ,
    @morrowind@lemmy.ml avatar

    To add on to exam reference languages, this is valid ruby

    XEAL , in You can certainly change it. But should you?

    What is the context of the original image?

    isVeryLoud ,

    Could be simply a way to make sure the button never moves again. I would have simply taken out the knob, personally.

    octobob ,

    I work on industrial controls. Very likely that the switch is momentary, meaning it’ll go back when released.

    Sometimes there’s a little piece of plastic in them to remove the momentary setting, but this works too lol. Fuck it, it’s maintenance.

    isVeryLoud ,

    That actually makes sense, thank you for the tidbit!

    Still kind of an overkill solution haha

    hstde ,

    It could be about sending a message.

    A missing knob is easy to fix. Bolting a wrench to the housing holding the knob in place is very explicit. It screams “don’t touch”

    isVeryLoud ,

    Idk to me it screams “solve this puzzle and win a free wrench” /s

    I like the creativity of it, and it does solve the problem in a way that’s user-safe. I thought of removing the knob because that’s what I do with my barbecue as I store items on the grill when not in use. Remove knobs, put on grill, close barbecue, cover.

    Omega_Haxors ,

    Idk to me it screams “solve this puzzle and win a free wrench” /s

    What too many video games does to a mfer 😄

    Fubarberry ,
    @Fubarberry@sopuli.xyz avatar

    I’m sure they just needed a way to lock the selector knob to the primary position, and didn’t want to rewire it.

    octobob ,

    Drills and taps two holes, adds a metal strap, and sacrifices a tool to save a 5 minute fix of jumping over the contact with a 2" piece of wire lmfao

    Fubarberry , (edited )
    @Fubarberry@sopuli.xyz avatar

    A lot of people won’t touch electrical, and the problem with modifying the wiring is you need to be able to clearly document or show what was changed in case it needs to be reversed later.

    This is ugly, but it’s immediately obvious how to reverse it to anyone who looks at it. And that pipe wrench probably wasn’t being used anymore anyways. I doubt they tapped the holes, those are probably just self-tap screws that both drilled the hole and cut the thread as they screwed in. No one will call this an elegant solution, but if it works it works.

    octobob ,

    “documenting the change” is a pipe dream.

    If you’ve ever worked in maintenance, active production, etc, you’ll be lucky to even have schematics. And trust me, there are a lot of hacks of people fucking with controls for 30+ years straight that soooo much of it is full of “fixes” like this, whether it’s something pushing a button in, or pieces of metal instead of fuses, or wires jumping over what’s “in the way” like whole safety systems and e-stops, contactors forced to run, etc etc etc.

    Omega_Haxors , (edited ) in You can certainly change it. But should you?

    Context is very interesting: stackoverflow.com/…/difference-between-const-cons…

    Const flags to the code that you cannot change the value, and volatile flags to the compiler that it’s not safe to change the value.

    jlow , in Exam Answer

    Are they using a red pen to write the checkmarks for correct answers to make it confusing but logical at least?

    autokludge ,
    @autokludge@programming.dev avatar

    Nah, just using one of those handy pens with blue, black & 2 red ink. ;)

    blindsight ,

    Grading in red is generally avoided, nowadays. Red is closely associated with failure/danger/bad, and feedback should generally be constructive to help students learn and grow.

    I usually like to grade in a bright colour that students are unlikely to pick: purple, green, pink, orange, or maybe light blue (if most students are working in pencil). Brown is poo. Black and dark blue are too common. Yellow is illegible. Red is aggressive.

    Anyway, I’m guessing they just graded everything in green. The only time I’ve ever graded in more than one colour was when I needed to subgrade different categories of grades, like thinking/communication/knowledge/application. In that case, choosing a consistent colour for each category makes it easier to score.

    Hobbes_Dent , in You can certainly change it. But should you?

    Just spin the pipe wrench open and slide it up then you can switch it back real quick.

    Thank you for watching this OHSA message on bad lockout procedure, now back to your regularly scheduled programming.

    vvvvv , in Exam Answer

    print(“x”) is you want to screw your students.

    smokeybeef ,

    screw your students

    ಠ_ಠ

    treechicken ,
    @treechicken@lemmy.world avatar

    “Dr. Prof. Mann, I really didn’t understand anything about UNIX on that last midterm. Can we go over how to touch and finger after class?”

    treechicken , in Exam Answer
    @treechicken@lemmy.world avatar

    It’s obviously:

    Traceback (most recent call last): File “./main.py”, line 2, in <module> AttributeError: ‘str’ object has no attribute ‘length’

    theFibonacciEffect ,

    Ah yes, all pseudocode is python

    SkyeHarith ,

    Ah yes, python is psuedocode

    treechicken ,
    @treechicken@lemmy.world avatar

    I deduce these two sets must be the same then?

    alexdeathway , (edited ) in Exam Answer
    @alexdeathway@programming.dev avatar

    Trick question?

    attribute error

    Car ,

    Poor question more likely

    alexdeathway ,
    @alexdeathway@programming.dev avatar

    I am currently looking for job opportunity and amount of gotcha type question i see in OA is just something else.

    Car ,

    I can’t imagine that’s any fun to deal with.

    “You should have known what the intent of the question was. Management won’t know or care about the internals of your code as long as it meets requirements. You have failed this test.”

    Or

    “You should know that you’re calling a function with invalid parameters. Where did you get your CS degree from again?”

    alexdeathway ,
    @alexdeathway@programming.dev avatar

    “You should have known what the intent of the question was. Management won’t know or care about the internals of your code as long as it meets requirements. You have failed this test.”

    “You should know that you’re calling a function with invalid parameters. Where did you get your CS degree from again?”

    sigh you can have your ransom, just remove the cameras.

    takeda , (edited )

    Do we know it is Python?

    alexdeathway , (edited )
    @alexdeathway@programming.dev avatar

    looked into it, gcse cs uses python in syllabuses.So, most likely

    mounderfod ,
    @mounderfod@lemmy.sdf.org avatar

    no the school can realistically choose any sensible language, the one in the exam question is a pseudocode one that is used only to make the exam questions understandable regardless of which language you studied

    cows_are_underrated , in Exam Answer

    It is indeed wrong. The correct answer would be 24.

    humbletightband , in You can certainly change it. But should you?

    I see a Java programmer evolves into a C programmer

    homura1650 , in traslation: i made that bug 15 years ago and have been waiting for it to matter.

    Around 2 years ago, I got an email from a products team asking me for urgent help extending a program in time to make a sale.

    I looked over the program and wrote back sonething along the lines of “this program was written almost a decade ago by an unsupervisered highschool intern. Why TF are we still using it?”.

    Of course, I ended up helping them, because that highschool intern was me, and I ended up helping because no one else could figure out what highschool me was thinking.

    PrettyFlyForAFatGuy ,

    I sometimes wonder if the spaghetti i wrote when i was still learning to program (on my own, in the corner of the room, ignored by all the “real” devs) is still used by the team i wrote it for.

    ChickenLadyLovesLife , in traslation: i made that bug 15 years ago and have been waiting for it to matter.

    Not a bug exactly, but about ten years ago I was working as an iOS developer and to get around a major problem introduced by the app designer, I made use of a “private method”, which is something an app supposedly gets rejected for by Apple. I came up with a way of hiding it and had to sweat out the approval period before it went live. Ten years later that shit is still there; I’m sure the developers currently responsible for the app don’t even know it’s there. I normally comment my code with an eye to helping future programmers understand what’s going on and why, but this hack was one where I even obscured the comments.

    AVincentInSpace ,

    What does “private method” mean in this context? Did you make use of an undocumented endpoint of the iOS API?

    ChickenLadyLovesLife ,

    Yeah, same thing.

    firelizzard ,
    @firelizzard@programming.dev avatar

    Objective-C does not enforce method access (e.g. private methods) at the runtime level. If you are sufficiently determined, there are no restrictions on what methods you can call, unlike Java or C# (AFAIK).

    AVincentInSpace ,

    Java absolutely lets you do that with Reflections. You’re not supposed to, and it’s painfully slow, but the JVM is only marginally smarter than javac (and that’s saying something) so there’s nothing actually stopping you.

    humbletightband ,

    If you are determined enough, it’s not that slow 😉

    firelizzard ,
    @firelizzard@programming.dev avatar

    I thought there was security code to stop that kind of thing. Granted, it’s been over 10 years since I’ve done anything with Java more than tinkering with Minecraft mods.

    homura1650 ,

    Java did have a Security Manager that can be used to prevent this sort of thing. The original thinking was that the Java runtime would essentially be an OS, and you could have different applets running within the runtime. This required a permission system where you could confine the permissions of parts of a Java program without confining the entire thing; which led to the Java security manager.

    Having said that, the Java Security Manager, while an interesting idea, has never been good. The only place it has ever seen significant use was in webapps, where it earned Java the reputation for being insecure. Nowadays, Java webapps are ancient history due to the success of Javascript.

    The security manager was depreciated in Java 17, and I believe removed entirely in Java 21.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines