Académique Documents
Professionnel Documents
Culture Documents
main()
{
printf("Hello\n");
fork();
printf("Hi\n");
}
Justify:
Answer :
n=7623
{
temp=n/10;
result=temp*10+ result;
n=n/10
}
Answer : 3267
157.
158.
159.
what does " calloc" do?
Answer : A memory allocation and initialising to zero.
160.
www.Technicalsymposium.com
161.
162. how does the C compiler interpret the following two statements
p=p+x;
q=q+y;
a.
p=p+x;
q=q+y
b.
p=p+xq=q+y
c.
p=p+xq;
q=q+y
d.
p=p+x/q=q+y
Answer :
163.
main()
{
int i=0;
for( ;i++; )
printf("%d",i);
}
a. Finite Loop
b. Infinite loop
c. one time loop
d. none of the above
Answer :
164.
If i = i * 16;
Which of the following is a better approach to do the operation
A) Multiply i by 16 and keep it
B) Shift left by 4 bits
C) Add i 16 times
D) None of the above
Answer :
165.
www.Technicalsymposium.com
Answer :
166.
167.
which of the following is the correct declaration for the function main() ?
if ptr is defined as
int *ptr[][100];
which of the following correctly allocates memory for ptr?
170.
char *a[4]={"jaya","mahe","chandra","buchi"};
what is the value of
sizeof(a)/sizeof(char *)
Answer :
171.
172.
a) 2
b) 0
c) erroneous syntax
Answer :
www.Technicalsymposium.com
173.
C allows
a) only call by value
b) only call by reference
c) both
d) only call by value and sometimes call by reference
Answer :
174.
a) valid
b) invalid
c) can't say
Answer :
175.
176.
int *i;
float *f;
char *c;
which are the valid castings?
i) (int *) &c
ii) (float *) &c
iii) (char *) &i
Answer :
177.
int i = 20;
printf ("%x", i);
what is the output?
a) x14
b) 14
c) 20
d) none of the above
178.
Meaning :
179.
Max value of SIGNED int
Answer :
www.Technicalsymposium.com
180.
void main()
{
char *s="\12345s\n";
printf("%d",sizeof(s));
}
Answer: 6
3.
#include<malloc.h>
char *f()
{
char *s=malloc(8);
strcpy(s,"goodbye");
}
main()
{
char *f();
printf("%c",*f()='A');
}
Answer:
4.
void main()
{
int count=10,*temp,sum=0;
temp=&count;
*temp=20;
temp=∑
*temp=count;
printf("%d %d %d ",count,*temp,sum);
}
Answer: 20 20 20
www.Technicalsymposium.com
5.
what is alloca()
Answer : It allocates and frees memory after use/after getting out of scope
6.
void main()
{
char *s[]={ "dharma","hewlett-packard","siemens","ibm"};
char **p;
p=s;
printf("%s",++*p);
printf("%s",*p++);
printf("%s",++*p);
}
Answer:
"harma" (p->add(dharma) && (*p)->harma)
"harma" (after printing, p->add(hewlett-packard) &&(*p)->harma)
"ewlett-packard"
. What is
while((*p++=*q++)!=0){}
is equal to
Answer:
9.
int *x[](); means
Answer:
10.
www.Technicalsymposium.com
c)jan,feb,mar,apr
d)error
Answer:
12.
main()
{
char *p='a';
int *i=100/*p;
}
what will be the value of *i= 1
1.03
cannot be defined.
13.
Answer:
15.
#include<stdio.h>
main()
{
char buff[] = "this is a test";
int i, *ptr;
ptr = (int*)buff;
for (i=0;*ptr; i++);
printf("%c",*ptr++);
}
The following will be the output
www.Technicalsymposium.com
A) This is a test
B) It'll print junk
C) Compilation error
D) None of the above
Answer:
16.
main()
{
char a[2];
*a[0]=7;
*a[1]=5;
printf("%d",&a[1]-a)
}
Answer:
may be 1.(illegal initialization)
18.
char *p="abc";
char *q="abc123";
while(*p=*q)
{
print("%c %c",*p,*q);
}
a. aabbcc
b. aabbcc123
c. abcabc123
d. infinate loop ( this may be correct)
www.Technicalsymposium.com
Answer:
19.
One question is given, long one, to find the answer U should be familiar
with the operation as follows
int *num={10,1,5,22,90};
main()
{
int *p,*q;
int i;
p=num;
q=num+2;
i=*p++;
print the value of i, and q-p, and some other operations are there.
}
how the values will change??
Answer:
MACROS
20.
#define one 0
#ifdef one
printf("one is defined ");
#ifndef one
printf("one is not defined ");
www.Technicalsymposium.com
k=MAX(i++,++j);
printf(%d %d %d %d,i,j,k);
}
Answer: 10 5 0
23.
Answer:
24.
Answer:
26.
main()
{
int x=1, y=2;
print(max(x++,y),x,y);
print(max(x++,y),x,y);
}
Answer: 3 4 2
www.Technicalsymposium.com
27.
Answer:
www.Technicalsymposium.com