Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

VU Past Papers CS201- Midterm Solved Questions on : Functions in C Programming

Q#1: What is the purpose of function declaration in C programming?
Answer: A function declaration (prototype) informs the compiler about the function’s name, return type, and parameter types before its actual definition. It ensures proper compilation when a function is called before it is defined, especially if the function is in a separate file.


Q#2: Explain the concept of “call by value” in function calls.
Answer: In “call by value,” a copy of the argument values is passed to the function. Any changes made inside the function do not affect the original variables in the calling program. For example, passing x and i to raiseToPow modifies only the copies, leaving the original values unchanged.


Q#3: How is the area of a ring calculated using functions in Sample Program 2?
Answer: The program calculates the area of a ring by using a circleArea function to compute the area of both the larger and smaller circles. The area of the ring is then determined by subtracting the area of the smaller circle from that of the larger circle.


Q#4: What is the purpose of the isEven function in Sample Program 3, and how does it work?
Answer: The isEven function checks whether a number is even. It returns 1 if the number is even and 0 if it is odd. This allows the function to be used in conditional statements like if(isEven(number)), promoting modularity and code reuse.

Contents Copyrights Reserved By T4Tutorials