Madurai Kamraj University (MKU) 2007 B.Sc Mathematics Programming in C and C++ - Question Paper
Programming in C and C++
(6 pages)
6254/M34 october 2007
Paper IX PROGRAMMING IN C AND C ++
(For those who joined in July 2003 and after)
Time : Three hours Maximum : 100 marks
SECTION A (8 x 5 = 40 marks)
Answer any EIGHT questions.
1. iSlCTreu0ijb rfjloSluL| ui)rp6iflfib, iSleiDLpadT jl0uiSl65T eiDGUffiaoerT 6rorgli51ii)..
(,g\) intx;
() double = p, q
({)) exponent a, /?
(ft) short char c;
(s_) longintm;n;
Find errors, if any, in the following declaration statements.
(a) int x;
(b) double = p, q
(c) exponent a, /3
(d) short char c;
(e) long int m ; n ;
(a) |
Area = 7jr2h | |
(t) |
side = a2 + b2 |
- 2ab cos (x) |
() |
Energy = mass |
v2 acceleration X height + |
(ff) |
v = u + at | |
(a-) |
1 2 s - ut + at 2 |
Write C assignment statement to the following : | |||||||||||||||
|
3. Switch LDppLD if a.rf)pffi(Gf5ffilioini_GiLi 2_erraT GojpurrffieinisrT cr(ipg]s.
Write down the difference between
switch and if statements
4. Null <si.rf)p OTsmDrra) OT65r6BT? |g)a>6in uiU6BTffiD6iT oSl&Jifl. What is a null statement? Explain its usefulness.
5. Garraneu LDrTr51a()6iT C rfjlijaSlei) OT&jojrTp nfjloSluurTuj? @0 OT@j<5rnl(jli_6ffT aSl&jrfl.
How will you declare array variables in a C program? Explain with an example.
6. (xpj6b n -LSlGum5rr$ ctot<s0dcit 2_0<ajrra,9; @0 C-rglijanai
OT(Lpl.
Write a C program to generate first n Fibonacci numbers.
7. 60 OTQJ&Jmp 60 Gffi(TeS)SyuSl6l0IBJ Gjpu@lfDgl?
How does a structure differ from an array?
8. ail OTCffTjDrrsb ermesi?
What is a pointer?
9. (y)60L) 6S)LpLiUBj)(gLb LDdluL| (l0ljb
S5)ipLiUfbLb 2_CTT6tT GsupUtT@6TT 6T0D&J?
What are the differences between call by reference and call by value?
10. Freek QffuJsbssubnSlesT Qurrgiajn-ajT 6uu}.6uanLDuss)u oSleuif).
Explain the general format of freek function?
3 6254/M34
11. GffitruLj 6WffiujrT(6n>fls)ffiuSla), Got urnij@ Gnaj&jirp OT(Lpgj urnBjil<5iSl0(5j GeupuQdsliDgi?
*
How does an append mode differ from a write mode in file handling?
12. (LpsirfpiflaoLD ajifldDffonuju urbnjil 60 @rS)uL| sr(Lp)<5. Write a note on priority queue.
SECTION B (6 x 10 = 60 marks)
Answer any SIX questions.
13. Qffin'@ffiffiuuL_i_ (ip(Lp ilas>ffi erem n-&(g, iSl6isTaj0Lb
Qrri_iflein- aiuL($l,$ QrraDse&uj ffi6rors.](5lLb C-rglijeb
665Trfjl65)65T OT(LpgJffi.
.11 1
1 + + +.....+ .
2 3 n
Write a C program to determine the sum of the following series for a given positive integer n.
' 1 1 1
1 + - + +.....+ .
2 3 n
14. 100 ffi@Lb 200 @ld Jg)ani_uS)cb s-cttctt, Lprreu Qj@u(lLb
(ip(Lp OT6Wra56lf)ST OTiin'6Slfl<S0D LDJDpLD h.L_@d5 Q(T0DiS0RUJ 655r@tliq.ffi(gjLb (Slijcu 05rr5li)65r cr(igi.
Write a program to find the number and sum of all integers greater than 100 and less than 200 that are divisible by 7.
15. QfT@ffiffiUUL_L_ (ip(Lp LjSl0O<5 GTeOffTCCufl SffT _puqffiD6TT Loup aiiflaDffuSla) LDrnopLb fglijd) 665rn5l0S)65T, While- LDL_ffi.flaouj
piU0HU(Jll OT(Lpg).
Write a program, using while loop, to reverse the 'digits of a given positive integer.
16. @0 (ip(Lp uSlfiina 6rawrwfl(r Qitljt Qu0a@ ldIuli arrapib Qffiucba.p 66ir5laj)68T cr(igj. ajanssr uiuaruQI nPr -g>
Write a function to calculate the factorial of a positive integer. Use this function to calculate nPr.
17. fij}0 Gffirrf>&JuS)g>]OT6n' eriin'ffifl06n gpajiflenffuSlo)
6(Lp[ij@U@<5gJLb lllJ0) 65Tr5l0)65T OT(Lp]<5.
Write a program to arrange the numbers in an array in ascending order.
18. $0 GffirraoaiuSla) s-eaen erem&eiftm Qprraoffiaouj
assrai, L.@<56n6n uujoru!, tSIijsu 0rrn5l6S)6ST cr(Lp).
Write a program using pointers to compute the sum of numbers stored in an array.
19. fgjijemQ) |655flcs)6rT aw.Luj., ai.il@QiT0f)ffi0!)uj
c&lS5)Lpffi@ii) Qffiua)an.(br61(f)0 |0ulS) i@iilju, *i1@0S)6ttu uiumuQ $0 Q<f(Lisb<3ti.fi)n5l0O0fr cr(Lpj.
Write a function using pointers to add two matrices and return the resultant matrix to the calling function.
20. $0 Qrr@ui_| ULirj-UJfflSla) a_OT6rr, aasini amSlanejr sjDfD rfjllJCO 660T6V)65T
Write a program to delete a node from a linked
list.
21. (y>6STj)|lf)0DLD 6Ulfl6S)ffuSla) _6TT6TT ffiggpiffiffiClflon CTakfiBflffiaf)aDUJ a5iT6Ber jSlrreb @6inn51D65r sr(Lpgi.
Write a program to determine the number of nodes in a priority queue.
22. 60 ajiflaoffuSlcb 2_6rrcrr *@5] 6jrn5)Dn *iri)fi)@Lb jflrraoa) er(ipgi.
Write a program to delete a node from a queue.
Attachment: |
Earning: Approval pending. |