AP Computer Science Principles
What is a special data type that has one of two values? a boolean What are the two values a boolean can have? true or false What are the three ways a boolean can be returned? as a result of evaluating a condition as a result of comparing two values when evaluating one or more Boolean conditions 10 MOD 2 0 20 MOD 0 error 20 MOD 4 0 4 MOD 20 4 0 MOD 4 0 How can you determine if a number is even or odd? by using x MOD 2, if the answer is 1, it is odd, if the answer is 0, it is even What are the two main reasons modulus is used in programming? to determine if a number is odd or even to convert between number systems What is the opposite of less than? greater than or equal to What is the opposite of greater than? less than or equal to What is the opposite of is equal to? is not equal to What is the opposite of is not equal to? is equal to What is the opposite of greater than or equal to? less than What is the opposite of less than or equal to? greater than What is NOT (a AND b) equal to? NOT a OR NOT b What is NOT ( a OR b) equal to? NOT a AND NOT b If the word between two conditions is or and the first condition is true, what will the result always be? true If the word between the conditions is and and the first condition is false, what will the result always be? false What is a logic gate a part of? a circuit What are the parts of a logic gate? two boolean inputs and one boolean output What are the three major components of any algorithm? selection, sequencing, iteration When is iteration used in an algorithm? when you want to repeat something Give three examples of a time when you would use iteration in an algorithm. you want to do something a certain number of times you want to do something until a condition is true you have a collection of data and you need to see each element in the collection What is a collection of items of the same type? a list What is an index in a list? the location in the list where an item can be found What is an item in a list? one element of the list What happens if you try to access and element that is outside of the list? an error is returned What is the smallest list index? 1 What is the largest list index? the length of the list What are the three ways you can add elements to a list? initialize from a list of values, add one element at a time to the end of the list (append item), add one element at a time to a specific location in the list (insert item) How do you remove items from the list by their location? by using the REMOVE command What happens when elements are added or removed from a list? the length of the list is automatically adjusted What is a way to manage a group os instructions in a program? a procedure What do you have to do to call a procedure without receiving an error message? include the name of procedure and the correct number of parameters What does the robot data type do? gives you a way to move a
Información del documento
- Subido en
- 2 de junio de 2024
- Número de páginas
- 14
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas