Thursday, February 14, 2008

Latest C Aptitude Questions

Latest Aptitude Questions with Explanations


Aptitude Question no.1

main()
{
int i=1;
while (i<=5) { printf("%d",i); if (i>2)
goto here;
i++;
}
}
fun()
{
here:
printf("PP");
}


ANSWER WITH EXPLANATION


Aptitude Question no.2

main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
}

ANSWER WITH EXPLANATION


Aptitude Question No.3

main()
{
int i=400,j=300; 21
printf("%d..%d");
}

ANSWER WITH EXPLANATION




Aptitude Question No.4


void main()
{
char far *farther,*farthest;
printf("%d..%d",sizeof(farther),sizeof(farthest));
}

ANSWER WITH EXPLANATION


Aptitude Question No.5


enum colors {BLACK,BLUE,GREEN}
main()
{
printf("%d..%d..%d",BLACK,BLUE,GREEN);
return(1);
}

ANSWER WITH EXPLANATION


Aptitude Question No.6

main()
{
clrscr();
}
clrscr();

ANSWER WITH EXPLANATION


Aptitude Question No.7


25. main()
{
printf("%p",main);
}

ANSWER WITH EXPLANATION

Aptitude Question No.8

#define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
}

ANSWER WITH EXPLANATION

Aptitude Question No.9

main()
{

int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++) j="0;j<5;j++){" href="http://placementtips4u.blogspot.com/2008/02/aptitude-question-no9.html">ANSWER WITH EXPLANATION

Aptitude Question No.10


#if something == 0
int some=0;
#endif
main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
}

ANSWER WITH EXPLANATION

Aptitude Question No.11


void main()
{
int i=5;
printf("%d",i+++++i);
}

ANSWER WITH EXPLANATION


Aptitude Question No.12

void main()
{
int i=5;
printf("%d",i++ + ++i);
}

ANSWER WITH EXPLANATION

Aptitude Question No.13

main()
{
static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
int i;
char *t;
t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i<=4;i++) printf("%s",names[i]); }

ANSWER WITH EXPLANATION

Aptitude Question No.14

main()
{

int c=- -2;
printf("c=%d",c);
}

ANSWER WITH EXPLANATION

Aptitude Question No.15

main()
{

char string[]="Hello World"; 15
display(string);
}
void display(char *string)
{
printf("%s",string);
}

ANSWER WITH EXPLANATION

Aptitude Question No.16


main()
{

printf("%x",-1<<4);

ANSWER WITH EXPLANATION


Aptitude Question No.17


main()
{

int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
}

ANSWER WITH EXPLANATION

Aptitude Question No.18


main()
{
14
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}

ANSWER WITH EXPLANATION

Aptitude Question No.19


main()
{

int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}

ANSWER WITH EXPLANATION

1 comment:

Unknown said...
This comment has been removed by the author.

2008 Placement papers of Top MNC companies

eXTReMe Tracker