CSC 240 — CSC 141/142 Diagnostic

Follow along in class · submit one question at a time · ungraded

CSC 141/142 Diagnostic

This is a no-stakes diagnostic, not a graded quiz. We go through it together in class — answer each question, then click its Submit button. You do not have to finish all three at once; each question is recorded on its own, and you can re-submit a corrected answer any time.

Enter these once — they are remembered on this device for each question.

Q1 · Gauss Sum CSC 141 · loops

Gauss’s teacher’s problem: 81297 + 81495 + 81693 + … + 100899, where each step adds the same amount.

Q2 · Array processing CSC 142 · arrays

For the array double[] a = {4.0, 9.0, 7.0, 2.0, 9.0, 5.0}; give each value:

Q3 · Design a class CSC 142 · OOP → 240

A Bulbasaur has id (1=Bulbasaur, 2=Ivysaur, 3=Venusaur; start 1) and level (start 1). setLevel(int lv) updates level; if level is in [16,31] it evolves (id→2); if level ≥ 32, id→3. getName() returns the name from id.

Bulbasaur (id 1) → Ivysaur (id 2) → Venusaur (id 3)

id 1 = Bulbasaur → id 2 = Ivysaur → id 3 = Venusaur

Reference answers are posted here after class.