Create an account to track your scores
and create your own practice tests:
Test: AP Computer Science A
1. | Which of the following code samples adequately uses constants? |
final String s = "Hello, "
int intVal;
// Variable intVal read in during this code.... Excerpted...
if(intVal < 0) {
s += "World!";
} else if(intVal == 0) {
s += "People!";
} else {
s += "Folks!";
}
final int rows = 4;
for(int i = 0,l = rows; i < l; i++) {
rows += 2;
}
for(final int i = 0, rows = 5; i < rows; i++) {
System.out.println(i);
}
const int rows = 4;
for(int i = 0; i < rows; i++) {
System.out.println(i);
}
final int rows;
int intVal;
// Variable intVal read in during this code.... Excerpted...
rows = intVal;
for(int i = 0; i < rows; i++) {
System.out.println(i);
}
Rajiv
Certified Tutor
Certified Tutor
University of Michigan, Bachelor of Science, Electrical Engineering. University of Michigan, Master of Science, Industrial an...
Popular Subjects
Computer Science Tutors in San Francisco-Bay Area, Algebra Tutors in Atlanta, Math Tutors in Philadelphia, LSAT Tutors in Boston, Biology Tutors in Seattle, Computer Science Tutors in Houston, GRE Tutors in New York City, SSAT Tutors in Atlanta, GMAT Tutors in San Diego, Spanish Tutors in San Diego
Popular Courses & Classes
SAT Courses & Classes in Miami, MCAT Courses & Classes in Dallas Fort Worth, MCAT Courses & Classes in San Diego, SSAT Courses & Classes in Denver, MCAT Courses & Classes in Seattle, SAT Courses & Classes in Seattle, SSAT Courses & Classes in Washington DC, ACT Courses & Classes in San Diego, ACT Courses & Classes in Seattle, ACT Courses & Classes in Houston
Popular Test Prep
GRE Test Prep in Phoenix, SSAT Test Prep in Washington DC, ACT Test Prep in Houston, GMAT Test Prep in Washington DC, GRE Test Prep in Boston, GRE Test Prep in Philadelphia, SSAT Test Prep in Los Angeles, LSAT Test Prep in Chicago, GMAT Test Prep in Boston, GRE Test Prep in New York City
