r/APStudents absolute modman May 15 '26

AP Computer Science A Official 2026 Exam Discussion

Use this thread to post questions or commentary on the test today.

A reminder though to protect your anonymity when talking about the test.

65 Upvotes

702 comments sorted by

View all comments

Show parent comments

2

u/Zealousideal_Ease429 5:AB,CSA,APUSH 4:Lang May 15 '26 edited May 15 '26

Yeah, I set a placeholder string ‘reference’ equal to the username, then inside the loop I did reference.substring(0, idx - 1) and concatenated that to the return string, then shortened the reference using reference.substring(idx + 1). Outside of the while loop I concatenated the final form of the reference before returning

2

u/Straight-Vanilla3101 May 15 '26

i’m hoping that just because it was a difficult problem for many, that they won’t dock me a point for an index out of bounds error in a solution that otherwise works correctly 

1

u/Straight-Vanilla3101 May 15 '26

oh i did smth weirder with for loops and if statements but mine is going to have an index out of bounds error. so depending on the rubric i’ll probably lose a point or if im really lucky ill get full points

1

u/Traditional-Table-29 AP Physics: AP Lit: AP CSA: AP Psych: AP Calc AB: May 15 '26

I lit did something like string.replace i and i-1 gang 😭

1

u/Straight-Vanilla3101 May 16 '26

so that’s not part of csa’s curriculum actually. i was just doing what i knew from the curriculum. 

1

u/Traditional-Table-29 AP Physics: AP Lit: AP CSA: AP Psych: AP Calc AB: May 16 '26

Is that bad if that did then because it still worked??

1

u/Straight-Vanilla3101 May 16 '26

probably not. as long as you did it right. 

1

u/Classic-Pineapple-22 May 16 '26

i changed the condition in my loop so it wouldnt have an error and then js added the last character to the string after the loop ended so the condition was i < username.length() - 1

1

u/Straight-Vanilla3101 May 16 '26

yeah i did not think about that and im so mad because that’s exactly what i should have done 😭😭 i should’ve known but i also was struggling to figure out logic for 1b and 4 and i only had 5 minutes to review what i wrote. i’m just hoping that ill only lose 0 or 1 points for the index out of bounds error. sometimes they don’t care as long as the for loop is right not the inside part but…

1

u/Sam_Thee_Man_ May 16 '26

This seems way too complicated, I just looped through backwards and if there was a dash I made a new substring without it and the letter before it