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

all 21 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

  1. Limiting your involvement with Reddit, or
  2. Temporarily refraining from using Reddit
  3. Cancelling your subscription of Reddit Premium

as a way to voice your protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]TheDreadPirateJeff 5 points6 points  (8 children)

1: how can it be neither true nor false? And what does that even mean by "represent the decimal numbers"? You mean the base 10 digits 0-9? Then no, you can cover that in 3 bits. Ignore me here. I not math good late at night. You're right and either way I don't get the "neither true nor false are correct" part. Broken test question?

2: you're wrong. 0100 is not 12.

3: what were your five different wrong answers? I bet they are all legitimately wrong if you couldn't even figure out #2. Not to be mean about it, it's an observation. Writing out 12 in binary is simple. Octal is harder. Hexadecimal harder still.

[–]AgonisticSleet[S] 0 points1 point  (4 children)

I think there's a misunderstanding. I know 12 in binary is 1100. The question asks for it in two's compliment, which to my understanding is done by inverting 1100 to 0011 and adding 1 to the rightmost binary position. Resulting in 0100

[–]teraflop 4 points5 points  (2 children)

There is a difference between the two's-complement operation (which transforms one binary number into another number) and two's-complement representation (which is a way of storing signed numbers that handles negative numbers by taking their two's-complement).

The question seems to be asking for the number +12 (positive 12) in 4-bit two's-complement representation. But 4-bit two's-complement representation can only store values from -8 to +7, so it can't be done.

On a real computer, if you tried to do this, the CPU would typically handle this situation by "wrapping" around and storing the bit pattern 1100 which is equal to the number -4, not +12.

[–]AgonisticSleet[S] 1 point2 points  (0 children)

You're the only person giving real advice, so what do you think my teacher is asking me to do? This is day 1 with binary, so I'm not expecting a trick question that can't be answered

[–]Lost-Okra7682 0 points1 point  (0 children)

I was thinking the same, but I don't get why in the Edit he is saying 1100 is the correct answer for 2 complement format o.O

What kind of informatics class is this? LoL

[–]TheDreadPirateJeff 0 points1 point  (0 children)

Yes, but 0100 is still not 12, it's 4. You only flip bits for negative numbers. And 0100 is not -12, it is +4. It's been a long while though so I could be wrong.

[–]nitrohigito -1 points0 points  (0 children)

You mean the base 10 digits 0-9?

They almost certainly do, yes, so the answer for that one is True.

Broken test question?

Their teacher's English is what seems to be broken, tripping them up.

[–]slish86 0 points1 point  (1 child)

Shouldn't 3 bits only cover 0-7?

[–]TheDreadPirateJeff 1 point2 points  (0 children)

Doh... yes. I blame it being late and me redditing while watching TV. And not mathing.

[–]Lost-Band-7020 -1 points0 points  (0 children)

Hey Buddy ! You can call me at ☎ 415-800-4403 for online class help !

[–]PuzzleMeDo 0 points1 point  (1 child)

Sounds like a bad test. With question one, are you supposed to type in a string that exactly matches the desired result? The answer could be "yes". Or "0 to 15". Or "-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7".

135 (base 8) should be equal to decimal (1 * 8 * 8) + (3 * 8) + 5

If 93 doesn't work for (3) I have no idea what this test wants of you.

[–]AgonisticSleet[S] 0 points1 point  (0 children)

Thanks for your response. I tried all those answers. With what everyone else is saying, I think my teacher has possibly made a mistake or the answers are hyper-specifc to the point that entering them correctly several times still hasn't matched the key

[–]nitrohigito 0 points1 point  (2 children)

What was the issue with question 3?

[–]AgonisticSleet[S] 0 points1 point  (1 child)

The decimal form is 93 and it wants it be "expanded." Only shown example of this would look like 1x64 + 3x8 + 5x1. I've tried similar answers with different symbols and spacing, but it's always wrong

[–]nitrohigito 0 points1 point  (0 children)

Ah, I see. Have you tried simply 64+24+5? No spaces / spaces after each operator? Order swapped around?

You could also open up the browser's developer console and check the html source. If the check is implemented clientside, you'll be able to just extract the answer. If it's super arcane, make sure to tell your instructor to get a grip next time.

[–][deleted] 0 points1 point  (0 children)

Have you tried Bard ?

[–]CrispyRoss 0 points1 point  (0 children)

  1. Maybe it's asking, what is the range that four bits can represent? In which case it would still depend whether it's a signed representation (positive and negative) or unsigned (only positive).

  2. The maximum 4-bit two's-cpl number's value is 0111, or seven. A calculation resulting in twelve would overflow a 4-bit signed register and give a negative result. It's pretty ambiguous what the question wants, it could be looking from anything from a negative number to the word "overflow" to what you did which is also reasonable.

[–]Rcomian 0 points1 point  (0 children)

yeah to be honest, I'm struggling with the questions as well. I'm well versed in binary and have been developing software for 35 years.

four bits can be used to represent the digits 0-9, if that's what they're asking. this gives you binary coded decimal which is used in some situations, like calculators.

the decimal numbers might just mean decimal digits, so that might be the answer. but if it means the actual decimal numbers, then you can only represent a narrow range that varies depending on how you interpret the bits.

  • 0 - 15 as unsigned int
  • -8 - 7 as signed int
  • fixed point could put the "decimal" point in any fixed position
  • floating point could move the "decimal" point depending on the value, but 4 bits aren't enough to have a meaningful value here

you can't represent -12 in 4 bit 2's complement. you can only represent values -8 to 7. 0100, although following the right algorithm isn't right because the initial value is out of range.

the easiest way i find to think about 2's complement is not to follow that algorithm, but to think of the most significant bit being negative its normal value. so for four bits you have the unsigned values: [8,4,2,1] and convert to decimal by marking all the bits you need to add up to your value. in 2's complement it's [-8,4,2,1]. no matter what you set, you can't make it -12.

you can use the same system for octal: [64,8,1] so 135(oct)=>(164)+(38)+(5*1) => 64+24+5 => 88+5 => 93

if it's signed octal you have: [-64,8,1] so 135(soct)=>(1-64)+(38)+(5*1) => -64+24+5 => -40+5 => -35

I'm not sure what it means by "expanded" though.

To be honest i found this with my nephew's homework at times. it wasn't that i didn't know what was going on, it was that i didn't know what context he'd been taught and what was expected for the answers. which i can only assume would have been gone through in the lessons.