How To Exam?

a knowledge trading engine...


Thapar University 2006 M.C.A Programming in C - Question Paper

Friday, 19 April 2013 02:30Web


Thapar Institute of Engineering & Technology
MCA (1st Year)
Final Term exam
CA004(Programming in C)



THAPAR INSTITUTE OF ENGINEERING AND TECHNOLOGY-PATIALA School of Mathematics and Computer Applications






End Semester Examination (Dec.-2006)

M.M.: 36 Time: 3 Hrs.


CA-004 (Programming in C)


Note: Answer any four out of first six questions. Question No. 7 is compulsory. All programs should be written in C only. Only first five attempted questions will be evaluated.

Q1. (a) Why do we need FILES in C programming language? Write the various options available for reading, writing and appending. Also write action of each of the option.

(b) What are the various storage classes in C? Explain through example.

(4+3)

Q2. (a) Write a program for finding sum of n numbers starting from m number.

(b) Write a program that takes set of names of individuals and abbreviates the first, middle and other names except the last name by their first letter.

(3+4)

   vmte a program to find the hef of four numbers.

\4n\c a program to insert an element into already sorted array.

(3+4)

* Q4. (a) Using pointers, write a program to find vowels, consonants, digits and other characters in a line.

(b) Write a program to search a telephone number in a record of five telephone subscriber and print the name, telephone number, bill number and amount of the searched record.

(3+4)

Q5. (a) Write a program which should read the elements of the matrix and then write two separate functions which should check whether (i) It is a sparse matrix (ii) It is a upper triangular matrix. (A matrix is said to be sparse if number of zero elements are more than non zero elements)

(b) Given the initial values int a=5, b10, c =15,(in each separate while loop), how many times

(i)

while (a ++ < b --) printf(hello, world\n);

(iii)

while(--a && (--c > b++)) printf(hello, world\n);

(ii)

while (b = a ) printfThello, world\n);

(iv)

while (++b < c --) printfThello, world\n);

(i) main() {

(ii) main() {

int x =1, y=2;

int x =5, y=2, z;

switch (y) {

while (x >y ++) {

default : x += 4;

z =x <= ++y ? x - ++ y : y ++ - -- x;

case 1: x+=l;

printf(x=%d, y=%d, z =%d\n, xsy,z); }

break;

do {

case 2 : x+=2;

Z = ++x - y--;

case 3: x +=3; }

printf(x=%d, y=%d, z=%d\n, x,y,z);

printfi(%d\n,\x); }

if(x = x/2) continue;}

while (x >= y/2 ? 1:0); }

(iii) main() { int m= 1000; function2(); printf("%d\n",m); } function 1()

{ intmlO; printf("%d\n",m); } function2()

{ intm=100; function 1(); printf("%d\n"im); }

(iv) int x;

main() { x=10;

printf("x=%d\n",x); printf("x=%d\n",fun 10); printf("x=%d\n",fun2()); printf(Hx=%d\nn,fun30); } fiinl() { x=x+I0;

return x; } fun2() { int x= 1; return x; } fun3() { x=x+10; retum(x); }

(v) main() {

(vi) main() { intx;

int x=5, y=0;

for (x=0; ++x>l?0:l; ++x)

if(x>y)

if(x>3)

printf(x>y\n);

break;

if(x<y)

printf(%d\n, x); }

printf(x<y\n);

if(!(x=y))

printf(x!=y); }

(1+2+1+1+1+1)

Q7. State the output of following program/program segments_

(i) int x,y;

(ii) struct s {

void func(void);

char ch; int i;

void main(void) {

float a;

int z=l;

};

while (x hh- <= 5) {

main()

printf(x=%d, y=%d, z=%d.\n,x5y,z);

{

func();

static struct s var= {C, 100 12.66}

y++; z++;

f(var);

main();

g(&var);

printf(lx=%d, y=%d, z=%d.\n,x,y,z); }

}

y-; z++;

f(struct s v)

printf(x=%d, y=%d, z=%d.\n,x,y,z); }

{

void func (void) {

printf(%c %d %f\n, v.ch, v.i, v.a);

static int a=5;

}

int b=5;

g( struct s *v)

printf(a=%d, b=%d.\n, a,b);

{

x++; y++;

printf(%c %d %f\ v->ch, v->i, v->a);}

a-; b~; }

(iii) main() {

static int arr[3][3] = {2,5,1,6,8,4,1,4,3);

int ij;

for (i =2; i>0; i--) /

i

for(j=2; j>=0; j)

printf(%d %d\n, arr[i][j], *(*(arr+i)+j));

} }

(4+2+2)







Attachment:

( 0 Votes )

Add comment


Security code
Refresh

Earning:   Approval pending.
You are here: PAPER Thapar University 2006 M.C.A Programming in C - Question Paper