CS-05 / IT-05
June - Examination 2016 BA/BSC Pt. II Examination
Programming in C Paper - CS-05 / IT-05
Time : 3 Hours ] [ Max. Marks :- 70
Note: The question paper is divided into three sections A, B and C. Write answers as per given instructions.
{ZX}e : ¶h àíZ-nÌ VrZ IÊS>m| "A', "~' VWm "g' ‘| {d^m{OV h¡& à˶oH$
IÊS> Ho$ {ZX}emZwgma àíZm| Ho$ CÎma Xr{OE&
Section - A 7
×
2 = 14 (Very Short Answer Questions)Note: Answer all questions. As per the nature of the question delimit your answers in one word, one sentence or maximum upto 30 words. Each question carries 2 marks.
IÊS> - "A' (A{V bKw CÎmar¶ àíZ)
{ZX}e : g^r àíZm| Ho$ CÎma Xr{OE& Amn AnZo CÎma H$mo àíZmZwgma EH$ eãX, EH$ dm³¶ ¶m A{YH$V‘
30eãXm| ‘| n[agr{‘V H$s{OE& à˶oH$ àíZ
2
A§H$m| H$m h¡&
800
CS-05 / IT-05 / 100 / 6 (1) (P.T.O.)
CS-05 / IT-05 / 100 / 6 (2) (Contd.)
1) (i) What will be output of following code segment:-
{ZåZ {X¶o J¶o
code segmentH$m
output³¶m hmoJm :-
int a=-5, b=-2,c; c=a%b; printf(“%d”,c);
(ii) State the rules to name identifiers/variables in C programming language.
C programming language
‘|
name identifiers/variablesHo$
{Z¶‘ H$mo ~VmBE&
(iii) What will be output of following code segment:-
{ZåZ {X¶o J¶o
code segmentH$m
output³¶m hmoJm :-
int *iptr; char *cptr;
printf(“%d\n%d\n”, sizeof(iptr),sizeof(cptr));
(iv) What will be output of following code segment:-
{ZåZ {X¶o J¶o
code segmentH$m
output³¶m hmoJm:-
int i; for(i=1;i<=10;i++);
printf(“%d\n”,i);
(v) What will be output of following C program:-
{ZåZ {X¶o J¶o
code segmentH$m
output³¶m hmoJm:-
#include<stdio.h>
#define SQR(x) x*x int main( )
{ int a, b=3; a=SQR(b+2);
printf(“%d\n”,a); return 0;
}
(vi) What is array ? array
³¶m h¡?
CS-05 / IT-05 / 100 / 6 (3) (P.T.O.)
(vii) What will be output of following code segment:-
{ZåZ {X¶o J¶o
code segmentH$m
output³¶m hmoJm:-
char str[ ] =”VMOU”; int a=5;
print(a>10? “C Programming” : %s\n”,str);
Section - B 4
×
7 = 28 (Short Answer Questions)Note: Answer any four questions. Each answer should not exceed 200 words. Each question carries 7 marks.
(IÊS> - ~) (bKw CÎmar¶ àíZ)
{ZX}e : {H$Ýht Mma àíZm| Ho$ CÎma Xr{OE& Amn AnZo CÎma H$mo A{YH$V‘
200
eãXm| ‘| n[agr{‘V H$s{OE& à˶oH$ àíZ
7A§H$m| H$m h¡&
2) Differentiate between header file and library file.
Header file
Am¡a
library file‘| A§Va g‘PmBE&
3) What are similarities and differences between structures and unions. Explain with suitable example.
Structures
Am¡a
union‘| g‘mZVm Am¡a A§Va ~VmAmo& VWm Bgo CXmhaU g{hV g‘PmBE&
4) Explain the use of pointer operators (& and *), with suitable example(s).
Pointer operator (&
Am¡a
*)H$m Cn¶moJ ~VmBE, CXmhaU Ho$ gmW&
CS-05 / IT-05 / 100 / 6 (4)
5) How bubble sort, perform sorting of array elements? Explain with suitable example.
array element
H$s gm°{Q>ªJ
bubble sortHo$ Ûmam H¡$go hmoVr h¡? CXmhaU g{hV g‘PmAmo&
6) Write a C program, explaining the concept of recursion.
Recursion
H$m {gÕm§V
CàmoJ«m‘ Ûmam g‘PmBE&
7) What is meant by generic/void pointer? Explain with suitable example.
Generic/void pointer
go Amn ³¶m g‘PVo h¢? CXmhaU g{hV g‘PmBE&
8) What is an algorithm? Write an algorithm to find largest element in an array and print its position in array.
Algorithm
³¶m h¡?
array‘| g~go ~‹S>r g§»¶m nVm bJmZo VWm CgH$s pñWVr nVm bJZo H$mo
algorithm{bI|&
9) Explain working of nested for loop, using a suitable example.
Nested ‘for’ loop
H$mo H$m¶©àUmbr H$mo g‘mPm¶|& VWm BgH$m CXmhaU ^r X|&
Section - C 2
×
14 = 28 (Long Answer Questions)Note: Answer any two questions. You have to delimit your each answer maximum upto 500 words. Each question carries 14 marks.
CS-05 / IT-05 / 100 / 6 (5)
(IÊS> - g) (XrK© CÎmar¶ àíZ)
{ZX}e : {H$Ýht Xmo àíZm| Ho$ CÎma Xr{OE& AmnH$mo AnZo CÎma H$mo A{YH$V‘
500
eãXm| ‘| n[agr{‘V H$aZm h¡& à˶oH$ àíZ
14A§H$m| H$m h¡&
10) With respect to dynamic memory allocation, explain with example.
Dynamic memory allocation
Ho$ g§X^© ‘|, {ZåZ H$mo g‘Pm¶| :-
(i) How block of memory is allocated ? Memory
H$m
blockH¡$go
allocatehmoVm h¡?
(ii) How multiple blocks of memory are allocated?
~hþV gmao
blockH¡$go
allocatehmoVo h¢?
(iii) How used memory space is released?
Memory space
H¡$go
releasedhmoVr h¡?
(iv) How can the size of allocated memory be altered?
Allocated memory
H$s g§»¶m H$mo H¡$go n[adV©Z {H$¶m Om gH$Vm h¡?
11) (i) Write a C program to swap two integer numbers, without using third variable. (Numbers should be input by user) (ii) Write a C program, which inputs a non negative integer
from user, and check whether the number is even or odd.
(i)
{dZm Vrgao
variableH$m Cn¶moJ {b¶o Xmo
integerg§»¶m Ho$
swapH$aZo H$m
CàmoJ«m‘ ~ZmBE&
(ii)
g§»¶m g‘ AWdm {dg‘ h¡, H$m
CàmoJ«m‘ ~ZmBE&
CS-05 / IT-05 / 100 / 6 (6)
12) Write a C program, which calculates area of following geometrical shapes.
Circle, Rectangle, Square, Triangle, Trapezium using switch-case. (Input should be provided by user)
Switch-case
H$s ‘XX go {ZåZ H$m joÌ’$b {ZH$mbZo H$m
C-àmoJ«m‘
{bI|:-
Circle, Rectangle, Square, Triangle, Trapezium
13) Explain all storage classes and properties associated with it, using suitable example(s).
g^r
storage classAm¡a CZgo OwS>r g^r {deofVmAm| H$mo CXmhaU g{hV
g‘PmBE&