Thursday, July 9, 2009

Can someone please help me with some C++ (programming) questions?

24. In testing code having an if or an if-else clause, describe how to construct test data. Give an example based on:





if (x %26gt; y)


statement1;


else


if (u %26gt; v)


statement2;


else


statement3;





25. Answer the question at the end of this code.





const int x = 1.23456789;


int f(int y)


{


int z;


//body of function: int f(int)


}


const int w = 9.987654321;


int g(double u)


{


int v;


// body of function: int g(double)


}


int main ()


{


int m;


double nn;


// body of function main()


m = g(nn);


// ...


m = f(x);


return 0;


}





In which functions can each variable be accessed?





a)x e) w


b)f f) g


c)y h) v


d)z i) m


j)nn





26. Why not make all variables non-constant global variables, and avoid the bother of parameters for functions?





27. Describe the similarity and difference between a function's parameters and function's local variables.

Can someone please help me with some C++ (programming) questions?
Do we get to share your class grade too? You at least should try to answerthem and then ask if your answers make sense.


No comments:

Post a Comment