AP Computer Science A : Program Design

Study concepts, example questions & explanations for AP Computer Science A

varsity tutors app store varsity tutors android store

Example Questions

Example Question #31 : Object Oriented Program Design

True or False.

 

The best data structure to represent a set of keys and values is an array. 

Possible Answers:

True

False

Correct answer:

False

Explanation:

Arrays can be two-dimensional. However, when trying to keep track of keys and values it can become complicated when using an array. HashMaps are the best way to represent data containing keys and values. 

Example Question #33 : Object Oriented Program Design

What is not a feature of the Java programming language?

Possible Answers:

Ability to write functions without making them class methods

Compile time error checking

primitive data types such as int, boolean and double

Garbage Collection

Object Oriented Programming

Correct answer:

Ability to write functions without making them class methods

Explanation:

In Java, the only way to write functions is to make them class methods. Java does have primitive types int, boolean double. There is compile time error checking. Java is an Object Oriented langauge and supports the OO paradigm. There is automatic garbage collection support, which helps manage memory for the user.

Learning Tools by Varsity Tutors