AP Computer Science Principles Mid-Term Review Boolean Expressions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

To attend a particular camp, a student must be either at least 13 years old or in grade 9 or higher, but must not yet be 18 years old. Let age represent a student's age and let grade represent the student's grade level. Which of the following expressions evaluates to true if the student is eligible to attend the camp and evaluates to false otherwise? A. ((age ≥ 13) OR (grade ≥ 9)) AND (age ≤ 18) B. ((age ≥ 13) OR (grade ≥ 9)) AND (age < 18) C. ((age ≥ 13) OR (grade ≥ 9)) OR (age ≤ 18) D. ((age ≥ 13) OR (grade ≥ 9)) OR (age < 18)

B. ((age ≥ 13) OR (grade ≥ 9)) AND (age < 18)

Let n be an integer value. Which of the following expressions evaluates to true if and only if n is a two-digit integer (i.e., in the range from 10 to 99, inclusive)? A. n = (n MOD 100) B. (n ≥ 10) AND (n < 100) C. (n < 10) AND (n ≥ 100) D. (n > 10) AND (n < 99)

B. (n ≥ 10) AND (n < 100)

Consider the following code segment. What is displayed as a result of executing the code segment? A. true true true B. false false false C. true false true D. false false true ADD IMAGE

B. false false false

To qualify for a particular scholarship, a student must have an overall grade point average of 3.0 or above and must have a science grade point average of over 3.2. Let overallGPA represent a student's overall grade point average and let scienceGPA represent the student's science grade point average. Which of the following expressions evaluates to true if the student is eligible for the scholarship and evaluates to false otherwise? A. (overallGPA > 3.0) AND (scienceGPA > 3.2) B. (overallGPA > 3.0) AND (scienceGPA ≥ 3.2) C. (overallGPA ≥ 3.0) AND (scienceGPA > 3.2) D. (overallGPA ≥ 3.0) AND (scienceGPA ≥ 3.2)

C. (overallGPA ≥ 3.0) AND (scienceGPA > 3.2)

In the following expression, the variable truckWeight has the value 70000 and the variable weightLimit has the value 80000. truckWeight < weightLimit What value does the expression evaluate to? A. 70000 B. 80000 C. true D. false

C. true

The following code segment is used to determine whether a customer is eligible for a discount on a movie ticket. val1 ← (NOT (category = "new")) OR (age ≥ 65) val2 ← (category = "new") AND (age < 12) If category is "new" and age is 20, what are the values of val1 and val2 as a result of executing the code segment? A. val1 = true, val2 = true B. val1 = true, val2 = false C. val1 = false, val2 = true D. val1 = false, val2 = false

D. val1 = false, val2 = false


Ensembles d'études connexes

Types of life policies Questions

View Set

EAQ_Content Area_Med-Surg_Cardio,Hema,&Lymph

View Set