2015
Paper: 1.1
Full Marks:80
Time:Three hours
INTRODUCTION TO
C PROGRAMMING
1)Define the following terms with suitable example: (10)
i)Keyword
ii)Identifier
iii)Token
iv)Datatype
v)Relational operator
PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
vi)Goto statement
vii)Formal parameter
viii)Structure variable initialization
ix)Declaration of pointer variable
x)File mode
2)Differentiate the following with suitable examples :(5*2=10)
a)String constant and character constant
b)break and continue statements
c)do while and while
d)call by value and call by reference
e)File input and output
3)What will be the output of the following program segment(assume no syntax error) ? (5*2=10)
a)
void main()
{
int i=1, j=1, x;
x=++1 + ++j - --j - --i;
PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
printf("x=%d i=%d j=%d", x,i,j);
}
b)
void main()
{
printf("\"GAUHATI UNIVERSITY\"");
}
c)
void main()
{
int i;
for (i=1; i<10; i++)
{
if(i%2==1)
continue;
printf("%d",i);
}
getch();
}
d)void main()//[Assume initial adress of x is-12]
{
int *p,x=10;
p=&x;
printf("p=%d\n",p);
p=p+1;
printf("p=%d\n",p);
p=p+1;
printf("p %d",p);
}
e)void main()
PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
{
int j=5;
while(j>=1)
{
printf("\n%d",j);
j=j-1;
}
}
4)Answer the following: (3*4=12)
a)Explain precedence of operators ? Why it is useful ?
b)Explain the four basics types of constants in C .
c)What is type casting ? When it is useful ?
d)Explain different types of qualifier .
5)Point out the errors, if any, in the following C statements. (8)
i)int=4*6;
ii)name='Guwahati';
iii)3.14*r*r=area;
iv)x=(a+b)(a-b);
v)salary=basic pat + house rent;
vi)area=3.14*r*r
vii)area of circle=3.14*r*r
PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
viii)int *p; folat x; p=&x
6)Write C programs for the following : (5*6=30)
i)The basic pay of an employee is input through
the keyboard. His dearness allowance is 119% of
basic pay, and house rent allowance is 15% of
basic pay. Write a program to calculate his
gross salary.
ii)The distance between two cities(in kms) is input
through the keyboard. Write a program to convert
and print this values in meters, inches and
centimeters .
iii)A number is entered through the keyboard.
Write a program to find the reversed number and
to determine whether the original and reversed numbers
are equal or not.
iv)Any character is entered through the keyboard,
Write a program to determine whether the character entered
is a capital letter, a small case letter, a digit or a
special symbol.
v)Read few numbers from the keyboard and write the odd numbers
in one file and the even numbers in another one file.
vi)Read data from a text file and display it.
PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
________________________________
PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com