6.33 Read Following statements T/F ?
a) C automatically passes arrays to functions using pass by reference.
b) When C passes an array to a function, the called function normally can modify the
element values in the caller's original array.
c) The name of an array is actually the address of the...
5.9 If a = 7.0, b = 7.0 and c = 6.0, then what is printed by
printf( "%.2f", sqrt( a + b * c ) );
a) 49
b) 7.00
c) 7
d) 49.00
✓✓~~ANS: (b)
5.10 What is the value of fabs( -5.0 )?
a) 5
b) 5.0
c) -5
d) -5.0
✓✓~~ANS: (b) all math functions return double in C
5.13 Which is not a motivation for "functionalizing" a program?
,a) The divide-and-conquer approach makes program development more
manageable.
b) Software reusability—using existing building blocks to create new programs.
c) Avoid repeating code.
d) Execution performance—functionalized programs run faster.
✓✓~~ANS: (d)
5.15 The function prototype
double mySqrt( int x );
(a) defines a function called mySqrt which takes an integer as an argument and
returns a
double
(b) defines a function called double which calculates square roots
(c) defines a function called mySqrt which takes an argument of type x and returns a
double
(d) defines a function called mySqrt which takes a double as an argument and
returns an
integer
✓✓~~ANS: (a)
5.18 Which of the following functions does not contain any errors?
, (a) void printnum ( int x )
{
print( "%i", x );
return x;
}
(b) int cube( int s )
{
return ( s * s * s );
}
(c) double triple ( float n )
return ( 3 * n );
(d) double circumference ( int r );
return ( 3.14 * 2 * r );
✓✓~~ANS: (b)
5.19 int square( int ); is an example of a function __________.
a) datatype
b) stereotype
c) prototype
d) proceduretype
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller TestTrackers. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.99. You're not tied to anything after your purchase.