You are on page 1of 2

THis is the paper related to db satyam Madras.

1. If i = 5 what is the output of

printf("%d %d %d", ++i ,i ,i++);
a) 5,6,7 b) 6,6,7
c) 7,6,5 (ans) d) 6,5,5
2. For the following code how many times
the printf func. is executed,
Code is :
int i,j;
for (i = 0; i =8 && y >2; (false)
f) a + b; (false)
g) a = b;(true)
h) c+4 ; (true)
26. answer the following in true or false (2 marks)
a) int ctr ; is a valid variable declaration(true)
b) scanf is a keyword(true)
c) stdout is a standard I/P ( false)
d) register variables can be used as loop index for
faster access(false)
e)a = (a>b) is valid statement( true)
f) x = a>b ? x:y is a valid statement( true)
g) given x=1,y=4,z=2 , a=9 and b=3,
evaluate x = x*y/z +a/b ; the value
of x = 5 (ans: true)
h) volatile is a keyword (false)
Give one line answers for the following questions: count = 11; (4 marks)
while (--count+1)
printf("count down is %d \n",count);
how many times the printf statement is executed? ans : 11.
29) How does
an existing data type in c ?
ans: typedef using define
30) What is the output generated for the following code. [1 m]
#define square(a) (a*a)
31. In the following enumeration declaration determine the
value of each member.
eenum compass {north =2 south ,east=1,west
ans: North = 2, south=3, east =1, west =2.
32. for the following declaration
union x{
char ch;
int i;
float j
what is the value of sizeof(u-var)
33. How many bytes of memory will the follwing arrays need ?
(a) char s[80] ans: 80.
(b) char s[80][10] ans: 800.
(c) int d[10] ans: 20.
(d) float d[10][5] ans: 200.
34. For the follwing statement find the values generated for p and
q ?
int p=0,q=1;
The value of p equal to 1 and the value of q equal to 1.
35. Write an appropriate declaration for the follwing situations.
(a) x: function returning pointer to array[] of pointer to
function returning char.
(b) Declare a function func that accepts two integer arguments
and returning a pointer to a long integer.
ans: long int *func(int int)
36. int size ,*int_ptr,table[20];
char ch,*char_ptr;
double d,grid;
Find out the value for the following statements.
a)size=sizeof(int) = 2.
b)size=sizeof(ch) = 1.
c)size=sizeof(size)= 2.
d)size=sizeof(table) =40.
e)size=sizeof(grid) = 160.
f)size=sizeof(char_ptr)= 4.
37. Give the name of the standard library function for the
a)string length ans: strlen.
b)string compare ans: strcmp.
c)string copy ans: strcpy.
d)string concatenation ans: strcat.
38.Suppose i and j are both integer type variables, and j has been
a value of 5.Then find the valie of i for the following
a)i=2*j-2*j/5. ans:8.
b)i=j/2 ans:2.
c)i=2*j/2 ans:4.
d)i=(2*j)/2 ans:5.
39.What is the o/p generated by the following program ?
int n=10;
int func(int);
int func(int n)