Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

9.Give a set of four test cases for the algorithm from question 9 that covers all branches. 10.In a scheduling program, we want to check

9.Give a set of four test cases for the algorithm from question 9 that covers all branches. image text in transcribed

10.In a scheduling program, we want to check whether two appointments overlap. For simplicity, appointments start at a full hour, and we use military time (with hours 024). The following pseudocode describes an algorithm that determines whether the appointment with start time start1 and end time end1 overlaps with the appointment with start time start2 and end time end2.

If start1 > start2: s = start1 Else: s = start2 If end1

Using the table described in question 8, trace this algorithm with each of the following:

an appointment from 1012 and one from 1113

an appointment from 1011 and one from 1213

11.Complete the following truth table by finding the truth values of the Boolean expressions for all combinations of the Boolean predicates (variables) p, q, and r. image text in transcribed

12.True or false? A && B is the same as B && A for any boolean expressions A and B.

13.Suppose the value of the boolean variable b is false and the value of the int variable x is 0. What is the value of each of the following expressions?

a.b && x == 0

b.b || x == 0

c.!b && x == 0

d.!b || x == 0

e.b && x != 0

f.b || x != 0

g.!b && x != 0

h.!b || x != 0

14.Simplify the following expressions. Assume b is a variable of type boolean.

a.b == true

b.b == false

c.b != true

d.b != false

15.Simplify the following statements. Here, b is a variable of type boolean and n is a variable of type int.

a.if (n == 0) { b = true; } else { b = false; } (Hint: What is the value of n == 0?)

b.if (n == 0) { b = false; } else { b = true; }

c.b = false; if (n > 1) { if (n }

d.if (n else { b = n > 2; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

=+1 Why are local employment laws important to IHRM?

Answered: 1 week ago

Question

=+ Are some laws more important than others? If so, which ones?

Answered: 1 week ago