Search Header Logo

Comp Sci Unit 2 #8

Authored by Nick Nessralla

Computers

11th Grade

Used 26+ times

Comp Sci Unit 2 #8
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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?

val1 = true, val2 = true

val1 = true, val2 = false

val1 = false, val2 = true

val1 = false, val2 = false

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case.

A NAND gate is a type of logic gate that produces an output of false only when both of its two inputs are true. Otherwise, the gate produces an output of true . Which of the following Boolean expressions correctly models a NAND gate with inputs P and Q ?

Media Image
Media Image
Media Image
Media Image

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

The figure below shows a circuit composed of two logic gates. The output of the circuit is true.

Which of the following is a true statement about input A?

Input A must be true.

Input A must be false.

Input A can be either true or false.

There is no possible value of input A that will cause the circuit to have the output true.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To be eligible for a particular ride at an amusement park, a person must be at least 12 years old and must be between 50 and 80 inches tall, inclusive.

Let age represent a person’s age, in years, and let height represent the person’s height, in inches. Which of the following expressions evaluates to true if and only if the person is eligible for the ride?

(age ≥ 12) AND ((height ≥ 50) AND (height ≤ 80))

(age ≥ 12) AND ((height ≤ 50) AND (height ≥ 80))

(age ≥ 12) AND ((height ≤ 50) OR (height ≥ 80))


(age ≥ 12) OR ((height ≥ 50) AND (height ≤ 80))

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

A large spreadsheet contains the following information about local restaurants. A sample portion of the spreadsheet is shown below.

  • In column B, the price range represents the typical cost of a meal, where "lo" indicates under $10, "med" indicates $11 to $30, and "hi" indicates over $30.

  • In column D, the average customer rating is set to -1.0 for restaurants that have no customer ratings.

A student wants to count the number of restaurants in the spreadsheet whose price range is $30 or less and whose average customer rating is at least 4.0. For a given row in the spreadsheet, suppose prcRange contains the price range as a string and avgRating contains the average customer rating as a decimal number.

Which of the following expressions will evaluate to true if the restaurant should be counted and evaluates to false otherwise?

(avgRating ≥ 4.0) AND ((prcRange = "lo") AND (prcRange = "med"))

(avgRating ≥ 4.0) AND ((prcRange = "lo") OR (prcRange = "med"))

(avgRating ≥ 4.0) OR ((prcRange = "lo") AND (prcRange = "med"))

(avgRating ≥ 4.0) OR ((prcRange = "lo") OR (prcRange = "med"))

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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?

(overallGPA > 3.0) AND (scienceGPA > 3.2)

(overallGPA > 3.0) AND (scienceGPA ≥ 3.2)

(overallGPA ≥ 3.0) AND (scienceGPA > 3.2)

(overallGPA ≥ 3.0) AND (scienceGPA ≥ 3.2)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In a certain country, a person must be at least 16 years old to drive a car and must be at least 18 years old to vote. The variable age represents the age of a person as an integer.

Which of the following expressions evaluates to true if the person is old enough to drive but not old enough to vote, and evaluates to false otherwise?

  1. (age ≥ 16) AND (age ≤ 18)

  2. (age ≥ 16) AND (NOT(age ≥ 18))

  3. (age < 18) AND (NOT(age < 16))


II only

I and II only

I and III only


II and III only

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?