Identify the various assertions in the following code as being always true, never true, or sometimes true
Question:
Identify the various assertions in the following code as being always true, never true, or sometimes true and sometimes false at various points in program execution. The comments indicate the points of interest:
Categorize each assertion at each point with ALWAYS, NEVER, or SOMETIMES.
Transcribed Image Text:
public static int mystery (Scanner console, int x) { int y = console.nextInt (); int count = 0; // Point A while (y < x) { // Point B if (y == = 0) { count++; // Point C = console.nextInt (); // Point D // Point E return count;
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 75% (8 reviews)
In computer programming specifically when using the imperative programming paradigm an assertion is a predicate a Booleanvalued function over the state space usually expressed as a logical proposition ...View the full answer
Answered By
Sandra Dimaala
Sandra from Philippines ,LICENSED PROFESSIONAL TEACHER.
Teachers are our nation builders—the strength of every profession in our country grows out of the knowledge and skills that teachers help to instill in our children. And, as a nation, we must do much, much more to fully appreciate and support their work.
0.00
0 Reviews
10+ Question Solved
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted:
Students also viewed these Computer science questions
-
Indicate whether each statement is always true or sometimes false. Justify your answer by giving a logical argument or a counterexample. (a) If ||u + v ||2 = ||u||2 + ||v||2 then u and v are...
-
Indicate whether each statement is always true or sometimes false. Justify your answer by giving a logical argument or a counterexample. (a) If Rn maps Rm into and T(0) = 0, then T is linear. (b) If...
-
Indicate whether each statement is always true or sometimes false. Justify your answer by giving a logical argument or a counterexample. (a) If Ax = b is any consistent linar system of m equations in...
-
What are the major considerations in structuring a channel of distribution?
-
An Ocean Thermal Energy Conversion (OTEC) power plant built in Hawaii in 1987 was designed to operate between the temperature limits of 86F at the ocean surface and 41F at a depth of 2100 ft. About...
-
What are some uses of software in medicine? List some.
-
A simplified schematic drawing of the carburetor of a gasoline \((S=0.75)\) engine is shown in Fig. P5.96. The throat area is \(0.5 \mathrm{in.}^{2}\). The running engine draws air downward through...
-
You are engaged to perform an audit of the Giordani Corporation for the year ended December 31, 2013. You have decided to perform the following cutoff test for payables and accruals. Select all items...
-
A manager of an emergency response team is responsible for emergency management services and resources. Their duties include routinely planning for responses to incidents that require communication...
-
Indico Ltd is a well established company which has operated in a sound but static market for many years where it has been the dominant supplier. Over the past three years it has diversified into...
-
Identify the various assertions in the following code as being always true, never true, or sometimes true and sometimes false at various points in program execution. The comments indicate the points...
-
Write code that prompts for three integers, averages them, and prints the average. Make your code robust against invalid input.
-
During April, Darling Company accumulated 12,000 hours of direct labor costs on Job 50 and 15,000 hours on Job 51. The total direct labor was incurred at a rate of $21.50 per direct labor hour for...
-
In 1979, JCB, the large British manufacturer of construction equipment, entered into a joint venture with Escorts, an Indian engineering conglomerate, to manufacture backhoe loaders for sale in...
-
Founded in 1837, Cincinnati-based Procter & Gamble (P&G) has long been one of the worlds most international companies. Today, P&G is a global colossus in the consumer products business, with annual...
-
Nordstrom is one of Americans most successful fashion retailers. John Nordstrom, a Swedish immigrant, established the company in 1901 with a single shoe store in Seattle. From the very start,...
-
When Jeff Bezos founded Amazon.com in 1995, the online retailer focused solely on selling books. Music and videos were soon added to the mix. Today, one can purchase a wide range of media and...
-
Thirty years ago, Starbucks was a single store in Seattles Pike Place Market selling premium-roasted coffee. Today, it is a global roaster and retailer of coffee with more than 24,000 stores, 40% of...
-
A battery has an emf of V and an internal resistance of r. What resistance R, when connected across the terminals of this battery, will cause the terminal voltage of the battery to be 1/2V? (a) R =...
-
Flicker, Inc., a closely held corporation, acquired a passive activity this year. Gross income from operations of the activity was $160,000. Operating expenses, not including depreciation, were...
-
Suppose an initially empty queue Q has performed a total of 32 enqueue operations, 10 first operations, and 15 dequeue operations, 5 of which returned null to indicate an empty queue. What is the...
-
Give a precise and complete definition of the concept of matching for grouping symbols in an arithmetic expression. Your definition may be recursive.
-
Give a recursive method for removing all the elements from a stack.
-
Scenario: Yarning Circle and Talking Stick Sarah has recently been employed by Blue Bay Early Learning Centre. Sarah is very proud of having just achieved the Diploma of Children's Services and she...
-
The principal at your school decides to retire, and several well-qualified teachers on the staff apply for the position. Mr. England has been teaching for four years and has his administrator's...
-
Sandi's parents have been divorced since she was five years old. She is now seven. She lives with her mother and visits her father every other weekend. He brings her to school on Monday mornings...
Study smarter with the SolutionInn App