1. Company: Tata Infotech
1.Which of the following represents true statement either x is in the range of 10 and 50 or y is zero?
(a) x >= 10 && x <= 50 || y = = 0
(b) x<50
(c) y!=10 && x>=50
(d) x >= 10 && (x <= 50 || y = = 0)
2.What is the value of y in the following code?
x=7;
y=0;
if(x=6)
y=7;
else
y=1;
x=7;
y=0;
if(x=6)
y=7;
else
y=1;
(a) 7
(b) 0
(c) 1
(d) 6
3. Company: DE Shaw
3.What is the value of y in the following code?
x=7;
y=0;
if(x=6)
y=7;
else
y=1;
x=7;
y=0;
if(x=6)
y=7;
else
y=1;
(a) 7
(b) 0
(c) 1
(d) 6
4. Company: HCL
The type of the controlling expression of a switch statement cannot be of the type
The type of the controlling expression of a switch statement cannot be of the type
a) int
b) char
c) short
d) float
5. Company: Oracle
What is the output of the program?
int main()
{
char s[]="oracle is the best";
char t[40];
char *ss,*tt;
ss = s;
tt = t;
while(*tt++=*ss++);
printf("%s",t);
}
What is the output of the program?
int main()
{
char s[]="oracle is the best";
char t[40];
char *ss,*tt;
ss = s;
tt = t;
while(*tt++=*ss++);
printf("%s",t);
}
A. oracle is the best
B. Garbage
c. Error Message
D. Goes into infinite loop
6. Company: Cisco
int i,j=1;
for(i=0;i<10;i++)
{
j=j+1;
}
printf("%d %d",i,j);
int i,j=1;
for(i=0;i<10;i++)
{
j=j+1;
}
printf("%d %d",i,j);
a) 9 11
b) 10 11
c) 9 10
d) Compile Error
7. Company: HCL
What can be said of the following program?
main()
{
enum Months {JAN =1,FEB,MAR,APR};
enum Months X = JAN;
if(X==1)
{
printf("Jan is the first month");
}
}
What can be said of the following program?
main()
{
enum Months {JAN =1,FEB,MAR,APR};
enum Months X = JAN;
if(X==1)
{
printf("Jan is the first month");
}
}
a) Does not print anything
b) Prints : Jan is the first month
c) Generates compilation error
d) Results in runtime error
8. Company: HCL
What is the size of variable of following union.Assume that the size of int =2, size of float =4 and size of char =1.
Union Tag{int a;float b;char c;};
What is the size of variable of following union.Assume that the size of int =2, size of float =4 and size of char =1.
Union Tag{int a;float b;char c;};
a) 2
b) 4
c) 1
d) 7
9. Company: DE Shaw
int fun( int n)
{
int i;
for(i=0;i<=n;i++)
fun(n-i);
printf(" well done");
}
How many times is the printf statement executed for n=10?
int fun( int n)
{
int i;
for(i=0;i<=n;i++)
fun(n-i);
printf(" well done");
}
How many times is the printf statement executed for n=10?
a) 0
b) 9
c) 10
d) 11
10. Company: Satyam
#include
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}
#include
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}
a) Systems
b) Ramco
c) RamcoSystems
d) Rsystems
11. Company: Accenture
main(int argc, char *argv[])
{
(main(argc, argv) && argc) ? main(argc-1, NULL) : return 0;
}
main(int argc, char *argv[])
{
(main(argc, argv) && argc) ? main(argc-1, NULL) : return 0;
}
a) Runtime error.
b) Compile error. Illegal syntax
c) Gets into Infinite loop
d) None of the above
12. Company: Oracle
int func(int z)
{
if (z== 6)
return 5;
else
return 6;
}
int main ( )
{
int x,y;
y=5;
x=func(y++);
printf("%s\n",(x==5)?"true":"false");
}
int func(int z)
{
if (z== 6)
return 5;
else
return 6;
}
int main ( )
{
int x,y;
y=5;
x=func(y++);
printf("%s\n",(x==5)?"true":"false");
}
a) True
b) false
c) either a or b
d) neither a nor b
13. Company: DE Shaw
if ptr is defined as int *p;
which of the following correctly allocates 100 units memory for ptr?
if ptr is defined as int *p;
which of the following correctly allocates 100 units memory for ptr?
a) ptr = (int *)(malloc(sizeof(int));
b) ptr = (int *)(malloc(100));
c) ptr = (int *)(malloc(100*sizeof(int));
d) None
14. Company: HCL
What is the output of the following program?
swap(int x,int y)
{
int temp;
temp =x;
x=y;
y=temp;
}
main()
{
int x=20;
int y=10;
swap(x,y);
printf("%d %d",y,x+2);
}
What is the output of the following program?
swap(int x,int y)
{
int temp;
temp =x;
x=y;
y=temp;
}
main()
{
int x=20;
int y=10;
swap(x,y);
printf("%d %d",y,x+2);
}
a) 10 20
b) 20 12
c) 22 10
d) 10 22
>Note ur Answer to questions.
then send your answers to me,i will send u answers with explanation.
mail: rajesh.mca134@gmail.com
OR
see the blog after a week for answers
Rajesh.A
president.
gateact.
0 comments:
Post a Comment