AP Comp Sci

Study Guide Vocabulary

User Interface

  • The means by which the user and a computer system interact, particularly using input devices and software.

Input

  • To provide or give something to the computer.

Output

  • Information that a computer or device displays, prints, or transmits to another device.

Program Statement

  • A syntactic unit of an imperative programming language that expresses some action to be carried out.

Program

  • Instructions for a computer to execute specific tasks.

Sequential Programming

  • The process of programming multiple devices in a chain, one device at a time.

Event Driven Programming

  • A programming paradigm where external events determine the flow of program execution.

Documentation

  • Written text or illustration that accompanies computer software or is embedded in the source code.

Comment

  • A human-readable explanation or annotation in the source code of a computer program.

Debugging

  • The process of finding and fixing errors or bugs in the source code of any software.

Pair Programming

  • A software development technique in which two programmers work together at one workstation.

Event

  • An action that indicates a user interacting with a program.

Expression

  • A combination of literals, variables, operators, and function calls that produce a value when evaluated.

Assignment Operator

  • An operator allowing the value of one variable to be copied into another variable.

Variable

  • A piece of memory that stores a value that can be changed.


Data Types and Operations

String

  • A data type used in programming to represent text rather than numbers.

Boolean Value

  • A result that can only have one of two possible values: true or false.

Comparison Operators

  • Operators that compare values and return true or false.

Logical Operators

  • Fundamental operations performing logical calculations on two or more values and producing a result based on the truth values of the inputs.

Conditional Statement

  • A type of coding instruction used to compare values and express and make decisions.

Function

  • A sequence of commands that can be reused together later in a program.

Function Call

  • An expression containing the function name followed by the function call operator, () .


Sample Questions

  1. Adding Binary Values – A programmer adds 14 and 15 using a programming language that represents nonnegative integers with 4-bit binary sequences:

    • (C) An overflow error will occur because 4 bits are not large enough to represent 29, the sum of 14 and 15.

  2. Character Movement in Games – For a video game character facing 8 directions:

    • (A) Four bits are not enough to store the eight directions. Five bits are needed for the new version of the game.

  3. Representation of Bits – Which can be represented by a sequence of bits?

    • (D) I, II, and III (Integer, Alphanumeric character, Machine language instruction).

  4. Data Compression – Which statement about data compression is true?

    • (D) There are trade-offs involved in choosing a compression technique for storing and transmitting data.

  5. Procedure Documentation – For the procedure printNums(max):

    • (B) Prints all positive odd integers that are less than or equal to max.


Algorithm Analysis Questions

  1. Counting Occurrences – In a procedure to count the number of occurrences of a value in myList:

    • Problematic code identified – variable count initialized inside the loop rather than before it.

    • (C) Moving the statement in line 5 so that it appears between lines 2 and 3.

  2. Error in Program – If score needs to be reduced by penalty, and we need to avoid negative values:

    • Change line 1 to IF(score - penalty < 0) and adjust conditions accordingly.


Concepts in Storage and Representation

  1. Binary Sequences – How many items can be identified by 6-bit vs. 7-bit sequences?

    • (C) 2 times as many items can be uniquely identified with 7-bit sequences.

  2. Understanding Data Types – The most appropriate data type for storing a person’s age?

    • (B) number.

  3. Boolean Variable Simulation – For a simulation that needs to store a true/false condition:

  • (A) A simulation of flipping a fair coin.


Additional Problem Statements

  1. Data Representation in Databases - Using fixed bits:

  • Likely causes for observed imprecision due to constraints in representation include overflow errors, round-off errors.

  1. Code Correction - Identifying necessary adjustments in given pseudo-code based on logic errors.

  • Check for optimal documentation and decision-making statements.


Understanding Constructs and Control Flow

  1. Logic for Eligibility - More complex expressions for eligibility evaluations must account for predefined range conditions and logical operators to ensure accuracy in computational checks.

robot