c programming question paper

Upload: sachinsonu15

Post on 04-Jun-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 c Programming Question Paper

    1/9

    M.C.A. (Semester I) (Management Faculty) Examination, 201I! 12 " 102 # $C% &' 'AMMI*(2012 &attern) (*e+)Time : 3 Hours Max. Marks : 70Note : 1) Question 1 is compulsory .2) Attempt any 6 from remaining .1. Find and explain output of following (any our) : 10a) Void main ) !int fun int)"int i # fun 10)"printf $%d&n'( i)"*int fun int i) !return i ++)"*,) Void main ) !int i # -( # 1( k # 0( w( x( /( "w # i k"x # i 22 22 k"/ # i 22 k"

    # i 22 k"printf $%d %d %d %d&n'( w( x( /( )"*Seat*o.

    &.!. .- /0 1002 4

    5) Void main ) !unsigned in res"res # 6- 4 + 1 4)) 2 8 1 9 9 4))"*d) Void main ) !5 ar str; < # !70( =7( 10>( 116( 10-( 0*"printf $%s&n'( str)"

    *e) ? define @ >0? define A @ + 100Boid main ) !int i( "i # AC40"

    # >00 A"printf $i # %d( # %d&n'( i( )"

  • 8/13/2019 c Programming Question Paper

    2/9

    *4. Drite a E program to 5ount and displa/ total num,er of alp a,ets(numeri55 ara5ters( spe5ial 5 ara5ters( num,er of words and num,er of lines in afile. 103. a) Drite a E program to get transpose of giBen matrix in same matrix.,) Drite a program to find sum of t is series upto n terms....161=1-14

    1+1 + + + +-. Drite a E program to read runs s5ored ,/ a ,atsman in last > innings.ispla/ ,ar

    5 art s owing ,atsmanGs last fiBe performan5es. 10>. a) Drite a fun5tion for performing 5ase sensitiBe string 5omparison. ;usepointers 114 43 3 34 4 4 41 1 1 16. Drite a E program to a55ept 100 re5ords of emplo/ee. T e stru5ture5ontentsname( age and ,asi5 salar/. @lso 5al5ulate total salar/ of emplo/ee as 10total salar/ # Aasi5 + .@. + HI@w ere @ is 10% of Aasi5 andHI@ is >% of Aasi5

    ispla/ name( age and total salar/ of emplo/ees in des5ending order ont e,asis of total salar/.7. a) Drite re5ursiBe program to print Fi,ona55i series for n terms.,) Drite a fun5tion to reBerse t e giBen num,er.J. Drite s ort note on : 10a) Mallo5 ) and free ),) Ait fields.

  • 8/13/2019 c Programming Question Paper

    3/9

    M.C.A. (Management Faculty) (Semester I) Examination, 2012

    I !12 " 102 " C #$%&$AMMI'&(200 #attern)Time : 3 Hours Max. Marks : 70Instructions : 1) Question 1 is compulsory .

    2) Solve any six questions from Q. 2 to Q. 8.3) Assume suitable data wherever necessary.1. a) Find and explain the output of the following program. 101)void main ( ){

    int i = 1, j = 1, k = 0, l = 2, m;m = i ++ && j ++ && k ++ !! l++;printf (%d %d %d %d %d, i, j, k, l, m) ;}2)# define FALSE 1# define TRUE 1# define NULL 0void main ( ){if (NULL) puts (NULL) ;else if (FALSE)Puts (TRUE) ;elseputs (FALSE);}Seat'o.#. .%.

    *2 0+ 102 -2-

    3) void main ( ){char s [ ] = man;int i ;for (i = 0 ; s [i] ; i ++){printf (/n %c %c %c, %c, s [i], * (s+i), * (i+s), i [s]);

  • 8/13/2019 c Programming Question Paper

    4/9

    }}4) void change (int *p, int n){int i ;for (i = 0 ; i < n ; i ++)* (p + i) = * (p + i) + 5 ;}void main ( ){int a [ ] = {2, 4, 6, 8, 10} ;int i ;change (a, 5) ;for (i = 0; i < = 4; i ++)printf (%d, a [i]) ;

    }

    -3- *2 0+ 1022. Write a program which accepts the array of integers and find LCM andGCD. 103. a) Write a program which will accept a number find whether the givennumber isperfect, deficient or abundant number.b) Write short note on C- storage classes.4. Write a program to read C program file and count the following in the

    completeC program. 10i) Total number of statements.ii) Total number of opening brackets ([, (, {).5. Write a program to read a character array and count number of vowelsin it usingpointer to array. 106. Consider structureStudent{ int. roll no;

    char name [ ];char course [ ] ;} 10Accepts details of 100 students in array of structure. Display details ofstudentsin array of structure. Display details of students who are for MCA course.7. a) Write a program to print the following pattern.1

  • 8/13/2019 c Programming Question Paper

    5/9

    2 33 4 54 5 6 75 6 7 8 9b) Write a program for a moving car, the car can be drawn using rectangleandcircle.8. Write a C program to append contents of one file to another file.Filenamesshould be accepted from the user through command line. 10

    M.C.A. (Semester I) (Mgmt. Faculty) Examination, 2012I! 12 " C &' 'AMMI*(200/ &attern) (*e+)Time : 3 Hours Max. Marks : 70Instructions : 1) Question 1 is compulsory .2) Solve any 6 (six) questions from Q. 2 to Q. 8 .3) Assume suitable data wherever necessary.1. Find and explain output of following programme. 10i) Void main )!stati5 int x; < # !>0( 60( 70( J0( =0*"stati5 int K/; < # !x( x+1( x+3( x+-( x+4*"int KKL"p # /"KKp++"Lrintf $ % d % d % d'( L ( Kp x( KKp)"*ii) int main Boid)!unsigned int / # 10"int x # -"if x /)Lrintf $x is greater')"elseLrintf $/ is greater')"get5 )"return 0)"*

  • 8/13/2019 c Programming Question Paper

    6/9

    &.!. .Seat*o.- 1/0 102 4

    iii) Boid main )!5 ar str; < # $@nna Ha are'"int i "for i # 0" str;i

  • 8/13/2019 c Programming Question Paper

    7/9

    >. Ereate a stru5ture of ,ank a55ount older as a55ount num,er( name(,alan5e(write onl/ one fun5tion for wit drawing and depositing t e amount anddispla/,alan5e. 106. Drite a program to read t e sour5e file and 5al5ulate t e o55urren5e ofgiBen 5 ara5ter in t e file. @55ept sour5e file 5al5ulate t e o55urren5e of giBen 5 ara5ter int efile. @55ept sour5e file name and 5 ara5ter t roug 5ommand lineargument. 107. Drite a E program t at fills > > matrix as follows :Npper left 5orner wit +1GsUower left 5orner wit 1GsIig t to left diagonal wit 0Gs 10

    J. a) Drite a program w i5 draw 5on5entri5 5ir5les.,) Drite s ort notes on prepro5essor dire5tiBes.

    M.C.A. (Semester I) (Management faculty) Examination, 2010I !12 " 102 " #C#!$%&'%AMMI '(200 $attern) ( e*)Time : 3 Hours Total Marks : 70

    Instructions : 1) Question No. 1 is compulsory .2) Solve any six from Q. No. 2 to Q. No. 9.3) Use comments wherever necessary.4) Figures to the right indicate full marks.1. Find and explain output of the following : 10A int f! main! "f!1 #f!1$% #f!1$%$3 #&f!int a$ int '$ int (" printf !)*d *d *d)$ a$'$( #&+ ,define lee!a$'$( a-g !a$'$( / 0,define des!a$'$($d !d/ /1 ge2!a$'$( : lee!a$'$(

  • 8/13/2019 c Programming Question Paper

    8/9

    -oid main!-oid"int num / 70#(har (h / 0 #float f / %.0#if des !num$ (h$ f$ o puts !)lee) #else puts !)ge2) #&+ 0- 102 4%45 6oid main! "int x / 0 1%38#int 9 / 0 7;#x / x < 0 7;#

    9 / 9 = 0 1%38#x / x > 9#

    printf !)*x?t)$ x # printf !)*x?t)$ 9 #&@ 6oid main ! "(har sB C / ")@harma)$ )Dorton)$ )Eimens)$ )i'm)(har p#

    p / s# printf !)*s)$ p # printf !)*s)$ p # printf !)*s)$ p #&%. A Grite a program to (ompute the real roots of 2uadrati( e2uation px %2x / 0.The roots are gi-en '9 e2uation x 1 / I 2 s2rt !2 % I 8J K%p andx%/ I 2 I s2rt !2 % I 8J K%p.+ Grite a program to a((ept integer num'ers till user enters 0 and displa9

    howman9 non4Lero integers entered.3. Grite a program to a((ept fi-e strings from user and displa9 all thosestrings indes(ending order. 108. Grite a program$ whi(h will a((ept file name and string from (ommand

    prompt

  • 8/13/2019 c Programming Question Paper

    9/9

    and append the string in gi-en file. 10 434+ 0- 102

    . A Grite a note on I Masking using 'itwise operator.+ Grite a user defined fun(tion str(mp !(har t 1$ (har t % whi(h(omparestwo strings t 1 and t %.@o not use li'rar9 fun(tions.

    . 5reate stru(ture le(t +ill ha-ing mem'ers (onsumerNno$ name$noNofNunits$amt. Grite a program to a((ept 10 re(ords.5al(ulate amt I using following rate.For noNofNunits less than 100 I rate s. 1. 0 per unit.noNofNunits greater than 100 I rate s. . 0 per unit.@ispla9 the re(ords of largest and smallest amt. 107. A Grite a program to demonstrate fill (olor in (ir(le.

    + Grite a program to displa9 the following pattern.A1+%$ 53@8$ $ FO7$ H;$ PQ$ R10.;. Grite a program to displa9 fre2uen(9 of ea(h (hara(ter in a gi-en file. 10Q. A Grite a program using fun(tion to print sum of digits of gi-en num'er.

    + Grite a program to (ount no. of senten(es in a gi-en file. SSSSSSSS