Chapter 6 Exercise 2, 3, 4, 5, 6, 7

EX 6-11.) P Q ! ((P // Q) && (P && Q))T T FFT FF TFT F TF F T T2-a.) Trueb.) Falsec.) Trued.) False4.) ! > && > //5.) if (min <= x && x<= max)System.out.println(“x is within the min and the max.”) EX 6-21-a.) If the number is bigger than 0,action 1 will work, if the number is smaller than 0, action 2 will work.b.) If the number is bigger than 0 and smaller than 100, action 1 will work. If the number is smaller than 0 or bigger than 100, action 2 will work.2.) Every line in a program is executes at least once, but is not the same thing as testing all possible logical paths through the program, this would provide a more thorough test, and also might require considerably more test data.3.) Equivalence Class is all the sets of test data that exercise a program in the same manner.EX-when the employee type is 1, test data for the payroll program fall into just two equivalence classes: hours between 0 and 40 and hours greater than 40.4.) Boundary Conditions are a value at which two equivalence classes meet.EX-when the employee type is 1, the hourly rate will be 10 and the hours worked will be 39, 40, and 41.5.) Extreme Conditions are data at limits of validity.EX-when the employee type is 1, the hourly rate will be 10 and the hours worked will be 0 and 168.6.) EX 6-3 1.) P: Time is before noon Q: It’s Monday Action TakenTT Take the computer science quizT F Go to gym classF T Go to gym class F F Throw a frisbee in the quad2.) A nested if statement used within another selection statement, a multiway statement is nested selection in which additional if-else statement are used in the else opinion.EX 6-41.) (income > 20000) need to change to (income > 20000 && income 50000)2.) if (income > 10000)rate = 0.10;else if (income > 20000 && income 50000)rate = 0.40;elserate = 0.0;EX 6-51-a.) Output will be 2, 3, run for three times which is 2,3 2,3 2,3  b.) out put will be 1,2,3 1,2,3 1,2,3 run for three times.EX 6-61.-a) To test the number, we must test number that is bigger than 0, for example 1, 2, 3. But if the number is smaller than 0, the test is wrong.b.) Test the number that is bigger than 0 and smaller than 100, fro example, 1, 2, 3, 99, 98, 97. The number that is bigger than 100 or smaller than 0 will not be the test number.2.) 3.) When a loop that does not executes a fixed number of times, it’s test data should be cover all three possibilities.4.) A program that tolerates errors in user inputs and recovers gracefully is robust program. EX- EX  6-71-a.) b.) 2.) 3.) 

Published in: on November 28, 2007 at 3:39 pm  Leave a Comment  
Follow

Get every new post delivered to your Inbox.