The AP Computer Science A course is one of two AP Computer Science courses offered by College Board. The course teaches the fundamentals of Java, one of the most popular programming languages in the world.
By the end of the course, students are expected to know how to read Java code and handwrite their own code.
The test is divided into two sections:
Here is a sample multiple choice question:
int sum = 0;
for(int i = 0; i < 7; i++){
sum+=i;
}
System.out.println(sum);
What is the the value of sum
?
A) 28
B) 21
C) 20
D) 0
E) 7
Answer: B) 21
Explanation:
The best way to tackle this is to create a table of i
and sum
.
i | sum
0 | 0 + 0 = 0
1 | 1 + 0 = 1
2 | 1 + 2 = 3
3 | 3+3 = 6
4 | 4+6 = 10
5 | 10 + 5 = 15
6 | 15 + 6 = 21
Therefore, the sum is 21.
There are two requirements:
First do a diagnostic test. After completing a diagnostic test, review it and identify your weaknesses. Keep on practicing then on this website. I provide actual test-taking tips on released AP CS sample problems.