Practice Problem 2.54 (solution page 160)
Assume variables x, f, and d are of type int, float, and double, respectively. Their values are arbitrary, except that neither f nor d equals +∞, –∞, or NaN. For each of the following C expressions, either argue that it will always be true (i.e.,evaluate to 1) or give a value for the variables such that it is not true (i.e., evaluates to 0).
- A. x == (int)(double) x
- B. x == (int) (float) x
- C. d == (double)(float) d
- D. f == (float)(double) f
- E. f == -(-f)
- F. 1.0/2 ==1/2.0
- G. d*d >=0.0
- H. (f+d)-f == d
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Computer Systems: Program... -Access
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Software Engineering (10th Edition)
Concepts of Programming Languages (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with Python (4th Edition)
- (Practice) a. To convert inches (in) to feet (ft), the number of inches should be multiplied by which of the following conversion factors? i. 12 in/1 ft ii. 1 ft/12 in b. To convert feet (ft) to meters (m), the number of feet should be multiplied by which of the following conversion factors? i. 1 m/3.28 ft ii. 3.28 ft/1 m c. To convert sq.yd to sq.ft, the number of sq.yd should be multiplied by which of the following conversion factors? i. 1 sq.yd/9 sq.ft ii. 9 sq.ft/1 sq.yd d. To convert meters (m) to kilometers (km), the number of meters should be multiplied by which of the following conversion factors? i. 1000 m/1 km ii. 1 km/1000 m e. To convert sq.in to sq.ft, the number of sq.in should be multiplied by which of the following conversion factors? i. 144 sq.in/1 sq.ft ii. 1 sq.ft/144 sq.in f. To convert minutes (min) to seconds (sec), the number of minutes should be multiplied by which of the following conversion factors? i. 60 sec/1 min ii. 1 min/60 sec g. To convert seconds (sec) to minutes (min), the number of seconds should be multiplied by which of the following conversion factors? i. 60 sec/1 min ii. 1 min/60 secarrow_forward4.1.1 Complete solution and answer only no need explanation Given three data points (1,6), (3,28), and (10, 231), What is the value of y at x = 2 if the function y = 2x2 + 3x + 1 passes through the three data points.arrow_forwardPROBLEM 13. [TIME ALLOWED = 5 MINUTES] Give the contrapositive, converse, and inverse of the following proposition: “If the number is positive, then its square is positive.”arrow_forward
- 4 We consider the following initial value problem for two functions y(x),z(x): 0=y′′+(y′+6y)cos(z), 5z′=x^2+y^2+z^2, where 0≤x≤2 and y(0)=1.7, y′(0)=−2.7, z(0)=0.5. Approximate the solution of this initial value problem using Euler's method with 100 steps. (use Maple) What approximation value do you obtain for y(2) and z(1)?arrow_forwardProblem 4 Discrete Mathematics.Combinations and Permutations. (5,10,10): Soccer A local high school soccer team has 20 players. However, only 11 players play at any given time during a game. In how many ways can the coach choose 11 players To be more realistic, the 11 players playing a game normally consist of 4 midfielders, 3 defend ers, 3 attackers and 1 goalkeeper. Assume that there are 7 midfielders, 6 defenders, 5 attackers and 2 goalkeepers on the team 2. In how many ways can the coach choose a group of 4 midfielders, 3 defenders, 3 attackers and 1 goalkeeper? 3. Assume that one of the defenders can also play attacker. Now in how many ways can the coach choose a group of 4 midfielders, 3 defenders, 3 attackers and 1 goalkeeper?arrow_forwardPROVIDE PYTHON CODE Determine the drag coefficient needed so that an 80-kg parachutist has a velocity of 36 m/safter 4s of free fall.Note: The acceleration of gravity is 9.8m/s2. Start with initial guesses of xl = 0.1 and xu = 0.2 and iterate until the approximationrelative error falls below 2 % in pythonarrow_forward
- Computer Science f(x)= Sin(x) – x 3 + C Where C = Max [0.15, (69/100)] x20, (x is in radian). Apply the false position method three iterations to find the root of the function (Decide the starting values of Xl and Xu yourself)arrow_forwardQ.) Do given c and d problem belowarrow_forward(Oceanography) The pressure, P, exerted on an underwater object can be determined by this formula: P=gh is the density of water, which is 1.94slug/ft3 . g is the acceleration caused by Earth’s gravity, which is 32.2ft/sec2. h is the object’s depth in the water in feet. a. Determine the units of P by calculating the units resulting from the right side of the formula. Check that your answer corresponds to the units for pressure listed in Table 1.1. b. Determine the pressure on a submarine operating at a depth of 2500 feet.arrow_forward
- Show complete solution please. I am at a loss of how to even begin this problem and would like to learn how to work through each step.arrow_forward(Practice) Run Program 7.10 to determine the average and standard deviation of the following list of 15 grades: 68, 72, 78, 69, 85, 98, 95, 75, 77, 82, 84, 91, 89, 65, and 74.arrow_forwardProblem 1: The monthly payment M of a loan amount P for y years and with interest rate r can be calculated by the formula: P(r/12) M = 1-(1+r/12)-12y Calculate the monthly payment and the total payment for a $100,000 loan for 10, 11, 12, ..., 29, 30 years with an interest rate of 4.85%. Display the results in a three-column table where the first column is the number of years, the sec- ond is the monthly payment, and the third is the total payment.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr