in , ,

Got this terrible question on the AP Computer Science Principles practice AP test. Answer key said correct answer was C, as far as I can tell the answer is D.

Got this terrible question on the AP Computer Science Principles practice AP test. Answer key said correct answer was C, as far as I can tell the answer is D. | code-memes, computer-memes, computer science-memes, test-memes, c-memes, ML-memes | ProgrammerHumor.io
code-memes, computer-memes, computer science-memes, test-memes, c-memes, ML-memes | ProgrammerHumor.io

Content

num2 – temp (D) num1 – num2 num2 num1 23. A programmer wants to write code which will evaluate each number from 1 to 30 and determine whether it is an odd number. Odd numbers will be added to the list oddNum and displayed. Evaluate the 2 code segments below to determine whether they will output the correct list. Code Segment 1 Code Segment 2 oddNum number 1 REPEAT 30 TIMES oddNum – number 1 REPEAT 30 TIMES IF (number MOD 2 1) IF (number MOD 2 0) oddNum number number APPEND (oddNum, number 1) number – number 1 number – number DISPLAY (oddNum) DISPLAY (oddNum) (A) Both code segments will correctly add all even numbers from 1 to 30 to the list. (B) Only Code segment 1 will correctly add all even numbers from 1 to 30 to the list. (C) Only Code segment 2 will correctly add all even numbers from 1 to 30 to the list. (D) Neither code segment will correctly add all even numbers from 1 to 30 to the list.