Mumbai University Solved Question Papers munotes.in
C Programming
Engineering · Sem 2
Dec 2014 Examination
Previous Year Question Paper with Solution
munotes.in Mumbai
Mumbai University Solved Question Papers munotes.in
C Programming
Engineering · Sem 2
Dec 2014 Examination
Previous Year Question Paper with Solution
munotes.in Mumbai
First published on munotes.in on 2 December 2026.
Published by munotes.in, Mumbai.
Model answers written and edited by the munotes.in editorial desk.
Passages from this volume may be quoted, in print, online or by an AI system, with credit: name munotes.in and link to this volume's page. The volume may not be reproduced as a whole. Full terms at munotes.in/content-license.
munotes.in is an independent study resource for students of the University of Mumbai. It is not affiliated with the University of Mumbai, and is not endorsed by it.
The University does not publish an official answer key for this paper. The answers in this volume are model answers, written to show how a full-mark answer is built. They are a study aid, not an authority on what an examiner marked.
The question paper reproduced here is the paper as set by the University of Mumbai at the Dec 2014 examination.
The questions below are the paper as the University of Mumbai set it at the Dec 2014 examination, in the order it was set.
MarksPage
MarksPage
MarksPage
The questions in this volume are the questions asked at the Dec 2014 examination, reproduced as the University of Mumbai set them, in the order it set them. Nothing has been reworded, added or left out. Only the answers are ours. See the original question paper.
Duration 3 hours · Total marks 80 · 19 questions answered
How to use this volume
Solve the paper first, under exam conditions and against the clock. Then read the answers here and mark your own. Reading a solution before attempting the question feels productive and teaches very little, because recognising an answer is not the same as being able to write one.
Q1 20 Marks
Answer
For full marks, cover: what a swap needs, the swap written with call by value and why it fails, the swap written with call by reference through pointers and why it works, the values in memory step by step, one program with both functions and its output, and a table of differences.
To swap two numbers m and n, a third variable holds one value while the other is moved: hold = m; m = n; n = hold. Inside main( ) this is easy. The question is what happens when the swap is a separate function, because a function receives its arguments in one of two ways, and only one of them lets it change the caller's variables.
void exchange_copies(int first, int second) receives copies of m and n. Its three statements exchange the copies correctly, as the line printed inside it shows, but first and second are local variables of the function: they disappear when it returns, and m and n in main( ) never changed. A call by value cannot swap the caller's variables.
void exchange_through_pointers(int *first, int *second) receives the addresses &m and &n. Then *first is not a copy of m but m itself, reached through its address, so hold = *first; *first = *second; *second = hold; exchanges the values stored in m and n. When the function returns, the swap remains. In C this is how call by reference is done: the addresses are passed, and the function works through them.
#include <stdio.h>
void exchange_copies(int first, int second)
{
int hold = first;
first = second;
second = hold;
printf("Inside exchange_copies: first = %d, second = %d\n", first, second);
}
void exchange_through_pointers(int *first, int *second)
{
int hold = *first;
*first = *second;
*second = hold;
printf("Inside exchange_through_pointers: *first = %d, *second = %d\n", *first, *second);
}
int main(void)
{
int m = 15, n = 40;
printf("In main at the start: m = %d, n = %d\n", m, n);
exchange_copies(m, n);
printf("In main after call by value: m = %d, n = %d\n", m, n);
exchange_through_pointers(&m, &n);
printf("In main after call by reference: m = %d, n = %d\n", m, n);
return 0;
}
Output
In main at the start: m = 15, n = 40
Inside exchange_copies: first = 40, second = 15
In main after call by value: m = 15, n = 40
Inside exchange_through_pointers: *first = 40, *second = 15
In main after call by reference: m = 40, n = 15
| Moment | m | n | The parameters |
|---|---|---|---|
| start of main( ) | 15 | 40 | none yet |
| inside exchange_copies, after the swap | 15 | 40 | first = 40, second = 15 (copies) |
| back in main( ) | 15 | 40 | the copies are gone |
| inside exchange_through_pointers, after the swap | 40 | 15 | first holds &m, second holds &n |
| back in main( ) | 40 | 15 | none |
| Point | Call by value | Call by reference |
|---|---|---|
| Arguments in the call | exchange_copies(m, n) | exchange_through_pointers(&m, &n) |
| Parameters | int first, int second | int *first, int *second |
| The swap works on | the function's own copies | m and n themselves, through their addresses |
| Point | Call by value | Call by reference |
|---|---|---|
| Result in main( ) | unchanged: 15 and 40 | swapped: 40 and 15 |
| Suited to | a function that only reads its inputs | a function that changes its inputs |
Conclusion. Swapping by call by value exchanges only the function's copies, so m and n stay 15 and 40 in main( ). Swapping by call by reference passes &m and &n, and the function exchanges *first and *second, which are m and n themselves, so main( ) sees 40 and 15. A swap function therefore needs call by reference.
This paper is locked
Elements of Biomedical Engineering has no solved papers, so it is not included.
All 17 subjects, as per the latest syllabus. Revised 2026.
Applied Mathematics II
Basics of Measurement and Sensors
Elements of Electrical Systems
Elements of Mechanical Engineering
Digital Electronics
Engineering Graphics
Physics of Measurements and Sensors
Environmental Chemistry and Non Conventional Energy Sources
Elements of Civil Engineering
Engineering Materials
Data Structure
Introduction to Chemical Engineering
Elements of Telecommunication
Physics for Emerging Fields
Elements of Biomedical Engineering
Introduction to Computational Chemistry
Already bought it? Sign in and it opens.
What do you need?
Tap one.
The answers are on this page
You can read the first answer here. The box further down shows how to read all of them.
Read it here, any time
We keep checking and updating our papers and notes, and adding more. A saved copy would be an old version. Reading on munotes.in always gives you the latest one.
I paid, but I can't open it
Please type an email, or a 10-digit phone number.
Done
If we find your payment, we send a link to the email you paid with. Open it to read.
Check your email in 2 minutes. Also check Spam.
No email after 10 minutes?
Something else
Please write a little more, so we can help.
Your email app opens with this. You can add more there. We reply by email.
Found an error in this volume? Report it and we will check it against the paper.