Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

double y = 100; double *ptr = &y; int x = 7; int *iptr = &x; a) Write a cout sta

ID: 3843431 • Letter: D

Question

double y = 100; double *ptr = &y; int x = 7; int *iptr = &x; a) Write a cout statement that uses the ptr variable to display the contents of the y variable ............... b) What will be displayed if you send the expression *iptr to cout? .......................... c) What happens if you send the expression iptr to cout? .................................................... d) Assuming that soap is an instance of the Inventory class, which of the following below is a valid call to the setOnHand member function. e) A) setOnHand (20); B) soap::setOnHand (20); C) soap.setOnl land (20); D) Inventory.setOnHand(20); e) The follow ing program contains errors. Find as many as possible. class circle: {private double centerX; double center; double radius; public SetCenter (double, double); setRadius (double);}

Explanation / Answer

question 3)

a)cout<<*ptr<<endl;

this will print the contents of y

b)will print the contents of x, which 7

7 is printed

c)address of variable x is printed

d)answer: C

soap.setOnHand(20);

e)

class circle://error: colon should not be present
{
   private //error : there shoulde be colon : before..
       double centerX;
       double center;
       double radius;
   public //error : there shoulde be colon : before..
       SetCenter(double,double);//error : in function declaration..expected return type
       setRadius(double);   //error : in function declaration..expected return type
}//error :expected ;