# BPUT MCA C question paper 2013

Total number of printed pages — 3 MICA
MC 101

First Semester Examination — 2012-13
PROGRAMMING IN C
Full Marks -70
Time: 3 Hours

Answer Question No.1 which is compulsory and any five from the rest.

The Figure in the right hand margin indicate marks.

Q1. Answer the following questions: (2*10)

(a)Subtract 203.1'\$ from 11.2 using 9's and 10's complement method.

(b)Write few factors that affect the performance of a computer.

(c) Differentiate between time sharing and distributed computing.

(d) Find the output of the following program with reason
int main()
{
int a[5]={1.3,6,7,0); int b; b =&a[2];
printf("%d”, b[-1]);
return 0;
}

(e) Differentiate between recursion and iteration with example in each.

(f) What will be output if you will compile and execute the following C code ?
Explain.
struct marks
{
int p:3;
int c:3;
int m:2;
};
void main()
struct marks s={2,6,5};
printf("%d %d %d", s.p, s.c, s.m);
}

The following is a simple C program to read and print an integer. But it is not working properly. What is(are) the mistake(s)?
# include
int main()
{
int n;
printf("Enter a number\n");
scanf ("%d\n",n);
printf("You entered %d/n",n);
return 0;
}

h) Using conditional operator (? :) write a Single program segment, not complete program, for checking weather a year is leap year or not.

i) What will be the output of the program (sample.c) given below if It is executed from the command line ?
cmd› sample ".c" /* sample.c */
# include
int main(int argc,int argv)
{
int i;
for(i=1;i printf("%s/n",argv[i]);
return 0;
}

j)How many bytes of memory will the following code reserve ?
# include
# include
int main()
{
int *p;
p = (int*)malloc(256*256);
if(p==NULL)
printf("Allocation failed");
return 0;
}

2. (a) Develop a flowchart and write a complete program to calculate the third largest number amongst a set of n positive integers using only if, else and go to structure. Do not sort an array.

(b) Develop the flowchart and write a program to find the HCF of two positive integers. Using this concept find the LCM of four integer numbers.

3. (a) Develop the flowchart and write the program to find the binary equivalent of a decimal integer value.

(b) Write a program that will store the personal information of a student (such as name, date of birth, address) in a structure that you,will define and then prints the record on the screen. A table of characters can be defined using pointers such as char *myline

4.(a) Give a string as input , write a function that counts the numbers the lower case, the upper case and special characters.

(b) Write a program to multiply two integer numbers using recursive procedure

5.(a) Write a program to find the sum of squares of elements on the diagonal of a Square matrix n x n.

(b) Write a program to find the determinant of a 3 x 3 matrix by using a function subprogram meant for to calculate the determinant of a 2 x 2 matrix.

6.(a) What is dynamic memory management? Discuss briefly all dynamic memory management functions are available in C with example in each.

(b) Find the largest element of a set of n positive integers using appropriale dynamic memory function.

7.(a) Write a program to copy the contents of one text file into another text file.

(b) Write complete program which will read a text and count all occurrences of a particular word.

8. Explain the following with at least one example in each

i. Storage classes

ii. Self-Referential Structure

iii. Union

iv. Macros

Subscribe with us to get latest topic update

Choose a Language