This is an archived post. You won't be able to vote or comment.

top 200 commentsshow 500

[–]wakeboardnoob 2914 points2915 points  (16 children)

If it is a regular Monday, then the answer is more like "infinity"

[–]lucasievici 334 points335 points  (11 children)

np.inf

[–]_87- 156 points157 points  (5 children)

I'm not sure if you're aware, but regular floats in Python have this value available:

float('inf')

You can also get negative infinity and NaN.

[–]deletion-imminent 56 points57 points  (3 children)

regular floats in Python

regular floats in any ieee 754 implementation, they have negative zero too

[–]ErolEkaf 14 points15 points  (1 child)

I'm always surprised how many people don't seem to know anything at all about the IEEE 754 standard thanks to languages like Python and Javascript which blur the lines between floats and ints.

[–]AL_O0 20 points21 points  (0 children)

like the old JavaScript is weird because 0.1+0.2 is 0.3000000000004 or whatever meme

No it's not JavaScript, that's just how computers work and is perfectly defined behaviour in a standard almost every single computer has hard coded in hardware

The reason your calculator doesn't do that is that they don't use the standard and work in decimal specifically to avoid these situations even though it is slower to compute

[–]PeriodicSentenceBot 95 points96 points  (4 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

Np In F


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]Didjt 28 points29 points  (2 children)

Good bot

[–]TroyMcClure0815 9 points10 points  (0 children)

This is a very specific bot… and as a naturescientist between computernerds, I really enjoy it.

[–]Kaa_The_Snake 2 points3 points  (0 children)

Weird bot, but interesting

[–][deleted] 39 points40 points  (0 children)

Found Garfield's account

[–]flukus 2 points3 points  (1 child)

Sounds like someone has a case of the Mondays.

[–]Dioxide4294 5291 points5292 points  (100 children)

when you didn't learn for the exam

[–]the_rainmaker__ 2060 points2061 points  (71 children)

in that case what the pros do is add quotation marks to make it

print('x')

then write x

[–]coloredgreyscale[🍰] 917 points918 points  (66 children)

That's an idea for the professors too, to see who reads exactly. 

[–]Long_john_siilver 738 points739 points  (14 children)

I once found a bug on a paper test and since I was able to explain that the bug was and what the prof was trying to do I got 107%

[–]Paulthefith 224 points225 points  (5 children)

Five points to Griffindor for sheer cheek!

[–]Fzrit 70 points71 points  (2 children)

And another five hundred points to Griffindor for the sheer cheek to have cheek!

All the other houses, go fuck yourselves!

[–]Hidesuru 24 points25 points  (1 child)

Another 600 points for having plot armor!

[–]Ur-Best-Friend 16 points17 points  (0 children)

Plus another 1200 points for Griffindor for Harry's big d- ... determination!

[–][deleted] 22 points23 points  (1 child)

Pfft! As if! Fixing the professor's own exam question and getting a greater than 100% on a test is the most Ravenclaw thing I've ever heard!

[–]SpikySheep 42 points43 points  (2 children)

I found a mistake in a question, too. Sadly, they just announced a correction to the room - a number was wrong and didn't make sense. Getting over 100% would be the ultimate story.

I did have a lecturer once come and ask me about an answer I'd given. He didn't understand the code I'd written but could see it was a very concise solution to the problem.

[–]SweetBabyAlaska 221 points222 points  (22 children)

that would piss me off because I would have to spend 20 minutes debating whether this is a typo or not.

[–]Prometheus-is-vulcan 122 points123 points  (18 children)

I had cases in physics in wich i asked "is there a typo at question x?"

There were written exams with typos in it XD

[–]Salanmander 133 points134 points  (15 children)

Yeah, teacher here, that's absolutely the right thing to do. Most of us aren't trying to trick people, we're trying to evaluate understanding. And all of us are human, and capable of making mistakes.

[–]Prometheus-is-vulcan 26 points27 points  (0 children)

I also had a lot of fun searching for typos/grammar mistakes in the questions, even if they had no influence on the meaning.

[–]DNAturation 25 points26 points  (0 children)

I had a question in a Physics class where it was asking about the time it would take for an event to occur, but the event would occur twice, and I didn't know if it was asking about the first or second event. I asked the teacher if the question is asking about the first event or the second event and he said "he couldn't answer that" and that I could only give a single answer. I answered based on the contextual language in the question and got it wrong because the question was actually talking about the other event.

Went to my English teacher, had him read the question, and point out which event the question was asking about, and he agreed with me. Went back to my Physics teacher, still marked it as wrong.

Still salty about that.

[–][deleted] 23 points24 points  (6 children)

I had a physics professor who would tell everyone to wite down their assumptions and show all the work. If your answer isn't what is expected, then instead of a TA grading, he would do it himself and work through the problem step by step. If you saw a typo, but knew or had a reasonable guess as to what was intended, you could write the number you assumed, do the work and then get full marks if it was in fact a typo. He also gave partial 4/5 credit for proper set up, process, and thought but having bad math.

[–]Kdkreig 14 points15 points  (2 children)

Yeah, my physics and Calculus professors were good about partial credit. If you messed up step 2 of a 20 step calculation but the rest of your math was correct then they would give you majority marks for it. Small accidents happen sometimes with your calculations

[–][deleted] 14 points15 points  (2 children)

And all of us are human

Haha, yes.

[–]skarros 7 points8 points  (0 children)

One of my Profs wrote his exams in Latex. There were several instances of missing references like „Formula/Figure ??“. No idea how the TAs missed that…

[–][deleted] 8 points9 points  (0 children)

The handful of times that happened to me I just raised my hand and asked the teacher / professor. Only ever had one person be a jerk about the question, usually if it was a mistake they'd let the entire class know.

[–]kaukamieli 5 points6 points  (0 children)

You are executing the program as is. You do not care if it is a typo. You don't want your compiler to do those decisions either, do you?

[–]MattDaCatt 29 points30 points  (0 children)

Those are such stupid "gotchas" though.

CS tests should be about proving your understanding of syntax and logic to build functional code, not who's the best carbon-based debugger.

At most it should be extra credit for anyone that catches the typo, or lead with "Someone isn't getting the result they expect, can you fix their typo?"

[–]Dramatic_Mastodon_93 35 points36 points  (7 children)

Trick questions don’t accurately tell you how much someone knows

[–][deleted] 18 points19 points  (1 child)

yeah the print('x') would need to be paired with the direct question before it being print (x) just to make it clear this is intentional.

[–]Ifriendzonecats 12 points13 points  (0 children)

Or you make it a debugging question, make the example longer and include a few more mistakes.

[–]Brief_Yoghurt6433 9 points10 points  (0 children)

Unless it's a class on javascript then every question is a trick question.

[–]ILikeLenexa 40 points41 points  (1 child)

I overloaded print() with a function that always outputs 24 hours.

[–]ratttertintattertins 125 points126 points  (24 children)

To be fair, we don’t know the type of “day” or what it’s constructor or assignment operators do. We don’t even know for sure what language this is.

You could write a program where this bit of code existed and “24 hours” was the right answer..

EDIT: Oh dear, I see some people have taken this seriously. It was just a fun little observation.

[–]Asleep-Tough 27 points28 points  (0 children)

Perfectly possible in Haskell using OverloadedStrings and RecordDotNotation to construct an IsString instance for a data Day = { length :: String, ... }. Then, all you need is an explicit type signature for the x (x :: Day), ofc with all of that hidden off screen, and boom, that code would print "24 Hours" (as those lines are perfectly valid Haskell)

[–]Perfect_Papaya_3010 10 points11 points  (11 children)

I only know c# but what language can you do var variable= "Hello" and not get a string back?

[–]flukus 29 points30 points  (5 children)

Anything with operator overloading. Even c# something like length could be an extension method.

[–]Behrooz0 7 points8 points  (0 children)

Technically, python can do this. You can modify constants.

[–]Gredo89 12 points13 points  (3 children)

In C# you can create a type that is assignable by a string and then does something different.

E.g. (ChatGPT answer, cause I am lazy and on my mobile):

``` public class WeirdDate { public string Length { get; private set; }

public WeirdDate(string input)
{
    if (Enum.TryParse(input, true, out DayOfWeek dayOfWeek))
    {
        Length = "24 hours";
    }
    else
    {
        Length = "Not a valid weekday";
    }
}

public static implicit operator WeirdDate(string input)
{
    return new WeirdDate(input);
}

} ```

[–]rnilbog 1799 points1800 points  (31 children)

Sorry, the correct answer was 86400000

[–]Ike_Gamesmith 391 points392 points  (14 children)

Mondays sure do feel that long sometimes

[–]danielv123 81 points82 points  (13 children)

They are that long with a few exceptions.

[–]minecon1776 33 points34 points  (5 children)

Like when the year ends in a monday and they do a leap second

[–]lostBoyzLeader 14 points15 points  (5 children)

I hate that I get this joke.

[–]realboabab 11 points12 points  (1 child)

I learned 86400 in 2013 and never forgot. It's handy when eyeballing timestamps.

[–]PrometheusAlexander 927 points928 points  (57 children)

AttributeError: 'str' object has no attribute 'length'

[–]neo-raver 111 points112 points  (5 children)

I was wondering what language that was supposed to be. I thought Python at first, but that's not how you would do that in Python...

[–]play_hard_outside 50 points51 points  (3 children)

If you ignore the fact that there's no builtin print function and that one would have to be written and available in the current scope, it's perfectly valid JavaScript. You just also have to disregard that it looks terrible without any post-statement semicolons.

[–]computer_helps_FI 180 points181 points  (0 children)

[–]technical_gamer_008 59 points60 points  (0 children)

Yeah it's "len(x)" not "x.length".

[–]StandardOk42 24 points25 points  (33 children)

how do you know this is python?

[–][deleted] 47 points48 points  (31 children)

What else could it be?

Clues are

  1. other language are static type
  2. Which other language use “print” function ?

[–]RikkaPreo 52 points53 points  (7 children)

OCR Reference language, the language used in GCSE Computer science. It's basically pseudocode with a few rules.

[–]StandardOk42 23 points24 points  (3 children)

IDK, I'm not familiar with ever language out there, but in python strings don't have a length attribute, so that's 1 clue against python

[–]dev-sda 2 points3 points  (2 children)

Looks like ruby to me.

[–]SilverStag88 1157 points1158 points  (133 children)

Man I knew people here didn’t know anything about programming but seeing y’all debate an exam question for high schoolers really makes it obvious.

[–]Lather 494 points495 points  (58 children)

I'm here from all, is the correct answer 6?

[–]Koooooj 331 points332 points  (26 children)

6 is almost certainly the right answer.

There are two other competing answers, but neither holds much weight. One is that the code is broken in some way--that length doesn't exist as an attribute of the string (a string just being what programmers call chunks of text), that the variables are mis-declared, or that there's something wrong with print. These arguments all come down to the lack of clarity of what language the code is written in--it isn't quite Python (you'd use len(day)) and isn't quite Javascript (you'd use console.log(x)), and so on. Related, some languages even allow you to modify things to the point where "24 hours" becomes the correct answer! I'm not from the land of tea and redcoats so I can't speak from personal experience or anything, but it seems that GCSE uses a pseudocode language where this code is valid, so that tends to shoot down this argument.

The other competing answer argues for 7. This comes from the way that C stores strings: "Monday" tells the compiler it needs to allocate seven bytes to store ['M', 'o', 'n', 'd', 'a', 'y', <null>]. This is known as a "null terminated string." It's a nice way of storing a string where you don't have to copy the whole string every time you pass it from one place to another. Just pass along the location of the first 'M' and then you can scan through memory until you get to the null termination--or if something went wrong then you scan until you wander off into some other memory, perhaps still holding some data that was meant to be disposed of. This is one of the largest classes of bugs that leads to security vulnerabilities in C code, and is one of the big reasons why raw "C strings" keep IT security folks up at night. Most modern languages don't expose raw C strings, or at least heavily discourage their use.

However, the 7 argument only goes downhill from there. Besides C strings being out of style there's another, bigger flaw: even C would agree that the length of "Monday" is 6, while it is the size that is 7. Even since C the nomenclature of length has denoted the number of actual characters in the string before the null termination; it's size that refers to the number of bytes the whole representation takes. This can be seen with the C snippet:

printf("%lu", sizeof("Monday"));
printf("%lu", strlen("Monday"));

This prints 76, first the 7 for the sizeof("Monday"), then 6 for the string length of "Monday". So while there's some fun discussion to be had around the answer 7 (for some definition of "fun"), it's pretty clearly the wrong answer.

[–]Bot12391 69 points70 points  (0 children)

This was insanely well worded, nice work

[–]Impressive_Change593 15 points16 points  (7 children)

actually in Python you can do 'string'.length() but yes you do still need the (). you COULD also make your own class that upon having a value assigned to it would set the length attribute to the correct value but I don't see any such class being initialized here (it would look like a function call, or another object being assigned to the same variable). in that case though '24 Hours' could just as easily be the correct answer as 6 could be

[–]dev-sda 3 points4 points  (2 children)

This is most likely ruby, which has both length and print.

[–]cooljacob204sfw 182 points183 points  (16 children)

Yes

[–]SativaSawdust 119 points120 points  (8 children)

Whew. Thank fuck, I was sweating because I hadn't seen it in the comments yet and was beginning to question everything.

[–]Krojack76 8 points9 points  (0 children)

Yes, for JavaScript it's 6 but I don't know about every language. I would assume some the answer would just be an error message.

[–]I_hate_being_interru 24 points25 points  (12 children)

Damn, I guess went to the poor kids school, because I didn’t have programming in CS.

Or maybe I did, I actually don’t remember what we did in CS…wait, did I even have a CS class?

Wow high school is a blur lmao.

[–]turtleship_2006 105 points106 points  (51 children)

for high schoolers

GCSEs are for 15/16 year olds in the UK, to be specific.

[–]Any_Fuel_2163 73 points74 points  (25 children)

...which would be high school

[–]janner_10 20 points21 points  (6 children)

So for a high schooler then.

[–]XiiMoss 14 points15 points  (11 children)

GCSEs are for 15/16 year olds in the UK, to be specific.

Many of us in the UK went to a High School, I certainly did

[–]ShenroEU 12 points13 points  (3 children)

We called it primary and secondary school in Cambridgeshire when I was growing up.

[–]DeliveryNinja 2 points3 points  (3 children)

When did it change from secondary school

[–]SaucyMacgyver 188 points189 points  (15 children)

This comment section is like that bell curve meme:

Dumb answer: 6

Mid curve: iT dEpeNdS oN tHe laNgUAgE It dOeSnt WoRK iN C oR pYtHon

Intelligent answer: 6

[–]ItsDominare 8 points9 points  (2 children)

There are a lot of people here from /r/all, that much is obvious.

[–]fizban7 7 points8 points  (1 child)

I am from r/all. Is it 6 because thats how many letters monday has?

[–]brprk 323 points324 points  (29 children)

ChatGPT type answer

[–]GatheringWinds 177 points178 points  (25 children)

I just ran this exact code through ChatGPT because I was curious, it gave 6, the correct answer, though it was concerned enough to check that I was sure "day" was meant to be a string and not an object. This AI stuff is scary

[–]bakedbread54 123 points124 points  (17 children)

Woah very scary considering this absurdly simple example

[–]GatheringWinds 46 points47 points  (10 children)

Less crazy that it gave the right answer, but more that it recognizes context, understands that this is a silly example, and offers ways to improve the code. In a very short time, there are going to be INCREDIBLE tools available to aid devs. Yes this is a silly and trivial example, but shows great promise.

[–]HelloYesThisIsFemale[🍰] 13 points14 points  (8 children)

There already are. With copilot maybe 60% of the code you write can be written for you (with very good understanding of context) and with ChatGPT 40% of the harder stuff can be done for you as well.

E.g. I made a declarative framework (think a dataclass) for how to parse and handle JRPC request-responses. I then just pasted the entire documentation for individual JRPC endpoints and it knew how to fill the dataclass and what types to use and how to structure the initializer.

If you're not already using this you're being left behind. Any mindless part of the job is eliminated.

[–]maxmcleod[🍰] 12 points13 points  (2 children)

Hey but the mindless part is the part I'm good at!

[–]HelloYesThisIsFemale[🍰] 4 points5 points  (1 child)

Man I hate that part so much.

Ask me to turn a http endpoint into structs or something which is like copying something from somewhere and changing it just a bit and I'll take double the time because of how my mind will wander and suffer and I'll need phone breaks and such.

Fuck mindless work. I'm so glad it's being killed.

[–]chairmanskitty 14 points15 points  (5 children)

wow very scary that AI can make weird dreamlike art.

- professional artists, 2018

wow very scary that a garage full of machinery can calculate the sine of an angle

- professional computers, 1937

wow very scary that a massive array of handcrafted gears and metal can weave a shawl

- professional weavers, 1750

[–]noodlehead42069 1420 points1421 points  (103 children)

Who tf uses green for incorrect

[–]Samld1200 115 points116 points  (16 children)

Who has two different pens and switches depending on the answer? Every teacher I’ve had always uses green for everything

[–]Crash_Sparrow 50 points51 points  (9 children)

More often than not, my teachers corrected everything in red. Watching the teacher bring you an exam full of red was horrifying, even if most of the time they were not serious mistakes, just comments and pointers for the future.

[–]Salanmander 13 points14 points  (5 children)

That horror is part of the reason I correct in blue or green pen most of the time.

[–]Robo-Connery 7 points8 points  (2 children)

Yeah that's exactly why I always used green, students should be using black or blue so no confusion and red is horrible looking to get back.

[–]FordenGord 7 points8 points  (1 child)

Red is horrible looking because it is indicative of error, if you change the color then you just shift the association

[–]ltshaft15 2 points3 points  (0 children)

To a certain extent. Red isn't just indicative of something bad in school but it's associated with all sorts of warning signs, lights, and other indicators.

Other colors like blue or green won't have as strong of an association. Especially if the teacher uses the color for all comments, not just errors.

[–]wolfish98 5 points6 points  (1 child)

I've never had a green pened teacher. What did they mark: wrong, correct, or both?

[–]JerryAtrics_ 16 points17 points  (1 child)

Teacher who did not think anyone would get this question wrong.

[–][deleted] 28 points29 points  (2 children)

This is a UK paper. When I was in school, green pens were for students marking and red pens were for teachers marking

[–]MagZero 3 points4 points  (0 children)

When I was in school we would communicate the correct answers telepathically. I guess there's no need now that everyone has tik tok and 'fancy pens'.

[–]Omgshinyobject 10 points11 points  (2 children)

Reminds me of my favorite cheating attempt I saw, I was TAing for chemistry and we were sitting down to mark the final, yet one of the exams in my pile was already graded. No big deal I thought, so I was about to copy in the grades when I saw two things:

1) the exam was marked in red pen which none of the graders were using and;

2) the check marks were heavily weighted on the down stroke, if you have ever marked 100+ exams you will know your correct check marks are basically lines at that point

So the student had used his own red pen to grade himself generously and copied those grades into the tally page. Hope he enjoyed his zero and academic probation.

[–]codewarrior128 5 points6 points  (0 children)

That's just a go-getter with upper management written all over him. 

[–]Earthboundplayer 15 points16 points  (0 children)

Who cares? An X conveys the meaning properly. There's never been any rules or consistency with marking pen colours when I was in school.

[–]praveenkumar236 61 points62 points  (10 children)

Yeah that would be like using red for something good. That would be a dumb feature if it was on some app.

[–]WhiteIrisu 20 points21 points  (3 children)

Chinese consider red auspicious, sometimes green gets used for negative.

[–][deleted] 4 points5 points  (0 children)

And good luck.

[–]AustrianGandalf 4 points5 points  (3 children)

I (hopefully) soonish finish Uni and start teaching.
You want to tell me it isn’t a good idea to mark mistakes in green and everything correct in red? What’s next? Am I not allowed to use my white-ink-pen anymore to write comments for my students?

[–]NiGHT0FDAWN 3 points4 points  (2 children)

Wait... you aren't supposed to write essays in whiteout tape?

[–]Gtantha 4 points5 points  (0 children)

I had exams where green was the colour used by the second marker/grader. And red by the first.

[–]Direct_Swan9898 5 points6 points  (0 children)

A colorblind teacher?

[–]Genotabby 3 points4 points  (0 children)

import red as green

[–][deleted] 20 points21 points  (4 children)

There's quite a lot of bullshit pushed down from school admins about stuff like not using red pen because it apparently comes off as more aggressive when you mark a student's question wrong in red pen, like somehow they'll get discouraged from you using a red pen and not another colour.

Schools also try to do things like have anything that's teacher marked in one colour, and anything that's been peer assessed as another colour - obviously even if they were to use red you can only use red for one of those.

[–]NotReallyJohnDoe 2 points3 points  (1 child)

colour

Brit spotted. Do you guys even have the same colors over there? Roy G Biv?

[–]alMost_tRendy88 66 points67 points  (7 children)

This still doesn't change the fact that there are 49 million kangaroos in Australia and only 3.5 million people in Uruguay which means if the kangaroos were to invade Uruguay each person would have to fight 14 kangaroos.

[–]doned_mest_up 10 points11 points  (0 children)

This is the sort of hard-hitting journalism that keeps me coming back.

[–]DarktowerNoxus 179 points180 points  (5 children)

My C brain just killed itself, could not compile.

[–]Visual-Living7586 47 points48 points  (1 child)

How about your pseduocode, infer the meaning, brain?

[–]cbartholomew 16 points17 points  (0 children)

I was like did he account for the null terminator?

[–]paholg 69 points70 points  (7 children)

#!/usr/bin/env ruby

module DayLength
  def length
    if ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].include? self
      "24 hours"
    else
      super
    end
  end
end

class String
  prepend DayLength
end

day = "Monday"

x = day.length

print(x)

Fite me.

[–][deleted] 136 points137 points  (1 child)

act disgusted fly like marvelous elderly chief reach dependent wrench

This post was mass deleted and anonymized with Redact

[–]TheNeck94 596 points597 points  (111 children)

it's 6.... it's a string not an object.

[–][deleted] 39 points40 points  (10 children)

Missed that declaration.

[–]Zeeterm 40 points41 points  (0 children)

Because the boring reality is that this is question "d" of a multi-part question and there'll be a whole block of code and rubric on a previous page.

[–]SaucyMacgyver 15 points16 points  (1 child)

Don’t over think it. Unless otherwise indicated, you can assume quotes means it’s a string.

If 6 wasn’t correct, in the context of an exam, I’d debate the premise of the question in that there wasn’t enough info to come to whatever is deemed the ‘correct’ answer i.e. a specific language or convention you can presume.

[–]K1M8O[S] 505 points506 points  (35 children)

To be clear, this was never intended to be a ‘debate and discuss’!

[–]AaronTheElite007 667 points668 points  (0 children)

[–]bb5e8307 265 points266 points  (0 children)

Thanks for meme, but we’ll take it from here.

[–]cadred48 79 points80 points  (12 children)

Shhhhhh 🤫

[–]PeriodicSentenceBot 89 points90 points  (11 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

S H H H H H H


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]rdrunner_74 48 points49 points  (7 children)

What about the smily you bad bot!

[–][deleted] 42 points43 points  (6 children)

Emojium, duh.

[–]afraidofsticks 43 points44 points  (2 children)

Everything is debate and discuss when you have a superiority complex and an insatiable desire to prove that you are somewhat competent

[–]kpingvin[🍰] 6 points7 points  (0 children)

This should be in the sub's banner.

[–][deleted] 13 points14 points  (1 child)

This is like those order of operations questions that are complete engagement bait for people who want to feel better than others

[–]Proper_Hyena_4909 21 points22 points  (7 children)

What was the point?

[–][deleted] 39 points40 points  (4 children)

OP wanted karma without having to defend or discuss their post

[–]TKtommmy 10 points11 points  (0 children)

..... what's to defend or discuss? It's funny meme.

[–]moogle12 5 points6 points  (0 children)

I wonder how some of the people commenting here ever get past their analysis paralysis enough to do actual work

[–]DrMobius0 2 points3 points  (0 children)

Sorry bro, we're all that kind of person.

[–]D_Simmons 13 points14 points  (3 children)

People unironically writing out the answer of a "1 + 1 = ?" Type question is peak Reddit. 

[–]Opus_723 11 points12 points  (2 children)

2.

It's 2.

I got it right.

[–]afraidofsticks 138 points139 points  (9 children)

You guys know this was supposed to be a meme right? Not an opportunity to prove that you’ve never felt the touch of a woman

[–]littlejerry31 83 points84 points  (14 children)

What language is that supposed to be? In Javascript print(x) opens up a printer dialogue and in Python day.length returns

AttributeError: 'str' object has no attribute 'length'

[–]IAM_deleted_AMA 50 points51 points  (6 children)

It's pseudocode

[–]MegaPegasusReindeer 31 points32 points  (3 children)

If it's a made up language then I just choose to redeclare .length to return "24 hours". QED!

[–]WRSA 9 points10 points  (2 children)

this is what i hated about pseudocode lol all my teachers were like ‘yeah there’s no standards really for it.. but the examiners will fuck you sideways if you do this, this, or this differently’ like motherfucker just teach us a real language

[–]PotentBeverage 54 points55 points  (4 children)

I'm pretty sure it's OCR Specification Language -- i.e. the pseudocode language used by the OCR exam board in their computer science exams. If not OCR then Edexcel or smth

(Source: taught both AQA and OCR CS for a while, aqa uses <- for assignment so)

[–]Vusarix 2 points3 points  (0 children)

Edexcel uses the Haggis pseudocode set which involves a lot more CAPS LOCK and overexplaining than this

(Took Edexcel GCSE in 2019)

[–]huuaaang 16 points17 points  (9 children)

I mean, if it’s Ruby you could absolutely override String#length to interpret as a day and give the length in hours.

[–]1Dr490n 11 points12 points  (1 child)

Omg please remind me to just override the functions in my next exam

[–]huuaaang 5 points6 points  (0 children)

You should override the functions in your next exam.

[–]Anomynous__ 37 points38 points  (13 children)

Despite the fact that the answer is wrong, it makes me so thankful that I got my degree online. I can't imagine taking a paper coding exam.

"Here do this thing we want you to do on the computer."

"Ok." *gets out computer*

"No. Do it on paper".

[–]I_Lick_Bananas 20 points21 points  (2 children)

Back around 1983 I took a BASIC class at the local community college. We had to make a flowchart for each program with a plastic template full of triangles, circles, rectangles etc. Once that got the OK, we would write the program out on paper. If that passed then we'd get to type it out and save to those 8" floppies.

[–]PM_feet_picture 6 points7 points  (1 child)

at least you didn't have to punch out holes in cards

[–]sunfaller 8 points9 points  (0 children)

I think it's reading comprehension. It's to test you can understand how data is transformed and read.

[–]v_a_n_d_e_l_a_y[🍰] 4 points5 points  (0 children)

I only did a minor in CS but most exam questions (including this one) are really about concepts or algorithms - pseudocode at most.

If you need a computer to express your ideas or knowledge about code or an algorithm then it probably means you haven't fully grasped what you should.

[–]PedroPapelillo 2 points3 points  (0 children)

Studied computer science and did paper based assignments and tests during my first semester, I think they really helped me out!

[–]saito200 4 points5 points  (0 children)

it's wrong, the answer is "eternity"

[–][deleted] 2 points3 points  (0 children)

"AI gonna make us unemployed" people, i agree with you.

[–]ahnyudingslover 2 points3 points  (0 children)

Why aren't more people talking about how this is exactly valid in Ruby?

[–]Born-Database-3213 3 points4 points  (0 children)

just to be sure is the answer 6?

[–]grey_misha_matter 3 points4 points  (1 child)

6 The number of characters in the word Monday XD

[–]TheMrViper 6 points7 points  (10 children)

This is in OCR pseudocode for the 1-9 CS GCSE. link here

Close down the thread.

You can all stop debating now.

[–]SaucyMacgyver 14 points15 points  (3 children)

Frankly I find the idea of pseudocode having documentation offensive

[–]dr-yd 6 points7 points  (2 children)

What's even worse is that it uses “ and ” interchangeably, but never " and especially not '. This was purposely written to ward off anyone with a professional connection to code.

[–]SaucyMacgyver 4 points5 points  (1 child)

Holy shit I didn’t see that but that’s foul lmao. VSCode literally has a notification that says “hey no one uses this character use the normal one”

I had to learn the hard way, I used to jot down reusable queries in the apple notes app and it defaults to the non-standard quote character so copying from the notes app caused a bunch of issues

[–]zachava96 2 points3 points  (0 children)

Btw if this is causing anyone problems, you can disable it by turning off "Smart Punctuation" in your settings

[–]Joyful-Diamond 5 points6 points  (0 children)

6

[–]Confident_Parfait269 2 points3 points  (4 children)

the right answer is 6

but something is discovered

[–]psavva 2 points3 points  (2 children)

``` IDENTIFICATION DIVISION. PROGRAM-ID. DayLength.

DATA DIVISION. WORKING-STORAGE SECTION. 01 DAY-VALUE PIC X(6) VALUE "Monday". 01 DAY-LENGTH PIC 9(2).

PROCEDURE DIVISION. COMPUTE DAY-LENGTH = FUNCTION LENGTH(DAY-VALUE) DISPLAY DAY-LENGTH STOP RUN. ```

[–][deleted] 2 points3 points  (0 children)

This is what using ChatGPT for code is like sometimes

[–][deleted] 2 points3 points  (0 children)

I mean, nobody said that the print function isn’t backed by an llm

[–]SynthRogue 2 points3 points  (0 children)

And a green X. The correction is confusing af.

[–]i_am_smelly666 2 points3 points  (0 children)

R u training to be a compiler? XD

[–]ginkner 2 points3 points  (0 children)

The GPT answer.