# Medium Multiple Choice Questions¶

These problems are similar to those you will see on the AP CS A exam.

5-8-1: Which of the following expressions is equivalent to !(c || d) ?

5-8-2: Which of the following is equivalent to the code segment below?

if (x > 2) x = x * 2;
if (x > 4) x = 0;


5-8-3: Which of the following is equivalent to the code segment below?

if (x > 0) x = -x;
if (x < 0) x = 0;


5-8-4: At a certain high school students receive letter grades based on the following scale: 93 or above is an A, 84 to 92 is a B, 75 to 83 is a C, and below 75 is an F. Which of the following code segments will assign the correct string to grade for a given integer score?

I.   if (score >= 93)
if (score >= 84 && score <=92)
if (score >=75 && score <= 83)
if (score < 75)

II.  if (score >= 93)
if (score >= 84)
if (score >=75)