University Of Pune Question Paper
FY MCA(Engg. Faculty)
PROBLEM SOLVING AND PROGRAMMING IN C
(Semester - I) (2008 Pattern) (510901)
Time: 3 Hours] [ Max. Marks : 70
Instructions to the candidates:
1) Answers to the two sections should be written in separate answer books.
2) Neat diagrams must be drawn wherever necessary.
3) Figures to the right side indicate full marks.
4) Solve Q1 or Q2, Q3 orQ4, Q5 or Q6 from Section –I and Q7 or Q8, Q9 or Q10, Q11 or Q12 from
Section -II
5) Assume Suitable data if necessary.
SECTION I
Q1) a) Explain the Concept of Program verification with Suitable example. [6]
b) Develop an algorithm to compute the sum of the first n terms (n>=1) of series
s = 1 – 3 + 5 – 7 + 9……
[6]
OR
Q2) a) What constraints should be considered for efficiency of algorithms? [6]
b) Write an algorithm to display all the Fibonacci numbers below 50. [6]
Q3) a) What do you mean by Operator Precedence and Associativity? Explain
it with suitable example.
[6]
b) (i) Write a syntax for -- for, while and do..while loop.
Distinguish between While and do..while loop.
(ii) What will be output if you will execute following c code?
#include<stdio.h>
int main() {
int i;
for(i=0;i<5;i++){
int i=10;
printf(“%d”,i);
i++;}
return 0;}
[3]
[3]
OR
Q4) a) Define iteration and recursion. Mention the difference between them with an
example.
[6]
b) Write a program to read in 10 numbers and compute the average, maximum and
minimum values.
[6]
[4366]-101 Page 2 of 3
Q5) a) What will be output of the following C code with justification:
i) #include<stdio.h>
void main () {
char arr[11]=”The African Queen”;
printf(“%s”,arr);}
ii) #include<stdio.h>
void main () {
int xxx[10] = {5};
printf(“%d%d”,xxx[1],xxx[9]);}
[6]
b) Write a C program to Find last occurrence of character c in string without using
string library function.
[5]
OR
Q6) a) Explain any three string library functions used in C with basic syntax and suitable
example.
[6]
b) Write a C program to multiply two matrices. [5]
SECTION II
Q7) a) Explain the concept of local and global variables with suitable examples. [6]
b) What is the output of following program segment?
main {
int a, b, *p1, *p2, x, y, z;
a = 12; b = 4;
p1 = &a;
p2 = &b;
x = *p1 * *p2 – 6;
y = 4* - *p2/*p1 + 10;
printf(“Address of a = %u\n”,p1);
printf(“Address of b = %u\n”,p2);
printf(“a = %d, b=%d\n”,a,b);
printf(“x = %d, y=%d\n”,x,y);
*p2 = *p2+3;
*p1 = *p2-5;
z = *p1 * *p2-6;
printf(“a = %d, b = %d\n”,a,b);
printf(“z = %d\n”, z);
}
[6]
OR
Q8) a) Explain Function pointer & Null Pointer with example.
[4366]-101 Page 3 of 3
[4]
b) Write a C program for addition of two matrices Am*n and Bm*n
Use Dynamic memory allocation.
[4]
Q9) a) Distinguish between the following:
i) Array and structure.
ii) Structure and Union
[6]
b) Write a C program to find maximum value from given two integers using macro
with parameters.
[6]
OR
Q10) a) What is union ? Create a union with three data elements initialize it and display
it.
[6]
b) Define a macro to compute volume of cube. Write a program using this macro to
compute the volume of cube.
[6]
Q11) a) Write a difference between Text file and Binary file.
[4]
b) Write a C program to count number of spaces, number of lines and number of
characters in a given text file.
[7]
OR
Q12) a) Write a short note on the followings:
i) Error handling.
ii) Redirection.
[4]
b) Write a program to accept two file name using command line and copy the
content of one file into another file.
0 comments:
Pen down your valuable important comments below