Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please provide correct answers: 1. Which of these statements will always cause a program to halt? (x is an int variable). A. assert(10 > 0);

please provide correct answers:

1. Which of these statements will always cause a program to halt? (x is an int variable).

A. assert(10 > 0);

B. assert(10 < 0);

C. assert(x < 0);

D. None of the above will always cause a program to halt.

2. What does a run-time analysis usually count?

A. The number of arithmetic and other operations required for the program to run

B. The number of megabytes required for the program to run

C. The number of seconds required for the program to run

D. The number of seconds plus the number of megabytes

E. The number of seconds times the number of megabytes

3. Which of these is the correct big-O expression for 1+2+3+...+n?

A. O(log n)

B. O(n)

C. O(n log n)

D. O(n)

4. What term is used to describe an O(n) algorithm.

A. Constant

B. Linear

C. Logarithmic

D. Quadratic

5. Express the formula (n - 2)*(n - 4) using big-O notation:

A. O(1)

B. O(8)

C. O(log n)

D. O(n)

E. None of the above

6. Why is it important to test boundary values when testing programs?

A. Calculating by hand, it's easy to find the right answers for boundary values.

B. Debuggers are easier to use when testing boundary values.

C. In practice, a large proportion of errors arise from boundary values.

D. The correct execution of a function on all boundary values proves a function is correct.

7. How may boundary values for a function be found?

A. Pick values that are one step away from different behavior.

B. Pick values that make the precondition equal to the postcondition.

C. Pick values where the precondition is false.

D. Pick values where the postcondition is false.

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_2

Step: 3

blur-text-image_3

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions