C Language Quiz 2012

Posted by Stephen thangaraj at 18:28

Quiz 2012 C Quiz


#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

int i=5;

clrscr();

printf("\t%d\t %d \t %d\t%d",++i,i,i--,i);

getch();

}



void main()

{

char c='0';

printf("%d %d",sizeof(char),sizeof(c));

}



void main()

{

printf("\the \backwater \is very \famous");

}

void main()

{

int *p,b[3]={10,20,30};

p=b;

clrscr();

printf("\n%d %d",sizeof(p),sizeof(*p));

printf("\n%d",b[0]);

printf("\n%d %d %d",*p,*(p++),++(*p));

getch();

}



void main()

{
printf("main:");

if(main)

{

printf("display");

}

main();

}



void main()

{

char s1='1';

clrscr();

if(1==s1)

printf("both are Same()");

}



void main()

{

clrscr();

if(printf("hello")=="hello")

printf("If condition is checked");

}



void main()

{

int a=64;

clrscr();

a=a>>3>>1;

printf("%d",a);

getch();

}



void main()

{

int dec,j,c,bit[16];

clrscr();

// printf("Decimal:");

// scanf("%d",&dec);

dec=256;

for(c=0;dec>=1;c++)

{

bit[c]=dec%2;

dec=dec/2;

}

c=c-1;

for(;c>=0;--c)

printf("%d ",bit[c]);

getch();

}



void main()

{

int square(int);

int binary=111;

char binary1;

int count,i,sum=0,t=0;

clrscr();

strcpy(binary1,binary);

count=strlen(binary1);

for(i=count-1;i>=0;i--)

{

t=binary/2;

printf(" %d",t);

if(t)

sum+=square(count);
}

printf("Decimal value %d",sum);

getch();

}

int square(int c)

{

int s=0;

for(;c>=1;--c)

{

s+=2*2;

}

return(s);

}




void main()

{

long double far *s1,*s2,*s3,*s4;

clrscr();

printf("%d %d %d",sizeof(s1),sizeof(s2),sizeof(s3),sizeof(s3));

}




void main()

{

int x=40;

{

int x=20;

printf("\n %d",x);

}

printf("%d",x);

}



void main()

{

extern int i;

i=20;

printf("%d",sizeof(i));

}





extern int fun(int);

void main()

{

 int a ;

a=fun(3);

printf("%d",a);

}

int fun(aa)

int aa;

{

return(aa);

}




f(struct emp);

struct emp

{

char name[20];

int age;

};

main()

{

struct emp e={"ste",13};

f(e);

}

f(struct emp ee)

{

printf("\n %s %d",ee.name,ee.age);

}



void fun()

{

there:

printf("ddsdf");

}

void main()

{

int i=1;

while(i<=5)

if(i<=5)

goto there;

}



void main()

{

int i=2;

switch(i)

{}

}



void main()

{

int i=1;

switch(i)

{

printf("hello");

case 1:

printf("Stev");

break;

case 2:

printf("Dong lee");

break;

}

}


If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!


Kindly Bookmark and Share it:

YOUR ADSENSE CODE GOES HERE

0 comments:

Have any question? Feel Free To Post Below:

 

© 2011. All Rights Reserved | Interview Questions | Template by Blogger Widgets

Home | About | Top