If you assign int x = 0.75;, what actually will be stored in memory?

A. 0
B. 0.750000
C. 1
D. You will get a compiler error.

A

Computer Science & Information Technology

You might also like to view...

(Invoice Class) Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four data members—a part num- ber (type string), a part description (type string), a quantity of the item being purchased (type int) and a price per item (type int). [Note: In subsequent chapters, we’ll use numbers that contain

decimal points (e.g., 2.75)—called floating-point values—to represent dollar amounts.] Your class should have a constructor that initializes the four data members. Provide a set and a get function for each data member. In addition, provide a member function named getInvoiceAmount that calcu- lates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as an int value. If the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0. Write a test program that demonstrates class Invoice’s capabilities. What will be an ideal response?

Computer Science & Information Technology

Which of the following statements is false?

a. Set method add inserts its argument if the argument is not already in the set; otherwise, the set remains unchanged. b. Set method remove removes its argument from a set—a KeyError occurs if the value is not in the set. c. Method discard also removes its argument from a set but does not cause an exception if the value is not in the set. d. You can remove the first element of a set with pop.

Computer Science & Information Technology