Programming in C (CS1003) Midterm Dec 2024 Question Paper
RV University Midterm exam for Programming in C (CS1003), held Dec 2024, semester 1, with 9 questions. Also searched as C, PIC, POC. Last updated 2026-11-14.
Questions
1. What will be the output of the following code?include
2. What is the result of using the increment operator i++ ?a) The variable i is incremented by 1 immediately,and the incremented value is used in the currentexpression. b) The variable i is incremented by 1 after its currentvalue is used in the expression. c) The variable i is decre
3. What will be the output of the following code?include
4. A is defined to terminate the recursion function when the boundary conditions are met. a) Base case b) Recursive casec.) Functions case d) String caseAnswer - a)
5. How many times will the following C code execute the printf statement?include int main() {int i = 5;do {printf("Hello, World! ");} while (i < 5);return 0;}A) 0B) 1C) 5D) InfiniteB) 1The do-while loop executes the body of the loop at least once, even if the condition is false. Her
1. A teacher wants to calculate the average marks of students in a class. The number of students is not fixed and is
2. 2a.) Solve the following statement using correct precedence operators and provide the output 11 + 2 6 && !0 11! = 7 && 11-2 <= 5Provide the answer stepwise.Ans : Step 1: Evaluate arithmetic operations (1 Mark)We first calculate the results of arithmetic operations, as they have h
3. a. Explain in detail about call by reference with an examplePass by ReferenceIn Call by Reference, the address of the actual parameter is passed to the function. The function operates on the address and can modify the original variable. (1 Mark)Example:include void modifyValue(in
4. Explain the concept of Recursion and Write a program in C using recursion to find GCD of two numbersSol : Recursion is a programming technique where a function calls itself to solve smaller instances of the same problem. Each recursive call reduces the problem size, and a base ca