puzzle in C Programming Language online Test

what will be the output of the following question?

main()

{

char far *s1,*s2;

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

}


point out the error , if any, in the while loop.

main()

{

int i=1;

while()

{

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

if(i>10)

break;

}

}


are the following two statements same?

a<=20?b=30:c=30;

(a<=20)?b:c=30;


what would be the output of the following?

main()

{

printf("%f",sqrt(36.0));

}


how many times the following program would print 'sana'?

main()

{

printf("\nsana");

main();

}


what would be the output ?

#define SQR(x) (x*x)

main()

{

int a,b=3;

a=SQR(b+2);

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

}


what would be the output of the program?

main()

{

int arr[]={12,13,14,15,16};

printf("\n%d%d%d",sizeof(arr),sizeof(*arr),sizeof(arr[0]));

}


what would be the output of the following?

main()

{

struct a

{

category:5;

scheme:4;

};

printf("size=%d",sizeof(struct a));

}

























































Description:

this test is based on c language.with more interesting puzzle.
Each question is having 4 option and u can choose one correct answer...

Comments
mamta rana
By: mamta rana
1058 days 2 hours 23 minutes ago

hmm.....gud one but i confused in one thing that the answer of 4 question must be 6.000000 becoz i already run this progarm in tc but the answer u given in this is differnt ........and i enjoyed while doing the test.....thnks

mamta rana
By: Sonu
363 days 4 hours 42 minutes ago

yes...i do agree...it must be 6.000000

aditya
By: aditya
1053 days 17 hours 22 minutes ago

easy test i got 7 correct and 1 incorrect...

pooja
By: pooja
1045 days 8 hours 48 minutes ago

can any 1 explain q3 of this test? why they are not same?

pooja
By: vallisha
959 days 8 hours 26 minutes ago

it is coz of the precedence and associativity.

sharda sharma
By: sharda sharma
1034 days 12 hours 33 minutes ago

no comment

Anurag Sharma
By: Anurag Sharma
1015 days 16 hours 29 minutes ago

This is Low level test for enthusiastic C programmer.......If u wanna check yourself that how good you are in C then take my test......

Lahuraj
By: Lahuraj
972 days 16 hours 10 minutes ago

great feeling while solving test, I was so excited............!!!

shobana
By: shobana
966 days 10 hours 20 minutes ago

can any one explain qn.1,6,8 plz.........

raheesa
By: raheesa
945 days 15 hours 19 minutes ago

can u explain Q6

raheesa
By: Raja
570 days 8 hours 47 minutes ago

the macro expanded as
b 2*b 2

GANESH KAMATH
By: GANESH KAMATH
935 days 12 hours 44 minutes ago

i think in the exam review there should be a proper explaination of how the answer was arrived for the better understanding of someone like me.

PRAVEEN
By: PRAVEEN
861 days 7 hours 26 minutes ago

ya good.........

but still i expect some depth concepts with clear explanation
if possible

ojom pandey
By: ojom pandey
850 days 4 hours 12 minutes ago

its great feeling to give the test.A must for an enthusiastic programmer.

M Kula Shekar
By: M Kula Shekar
828 days 14 hours 22 minutes ago

thanks for providing such opportunity to prove ourself.
thanks to WIZIQ.

ms
By: ms
801 days 5 hours 52 minutes ago

what will be the output of
main()
{
int a=5,c;
int ptr;
ptr=

pottabathiniusha
By: pottabathiniusha
760 days 4 hours 22 minutes ago

first question answer is wrong.........

lalbahadur
By: lalbahadur
733 days 10 hours 37 minutes ago

Very easy got 8/8

darshan
By: darshan
682 days 18 hours 13 minutes ago

answer for first 1st question is wrong i think .... pointers always allocated by the size 2 bytes or 4...

vimjet
By: vimjet
668 days 8 hours 37 minutes ago

Comments to Authors
please specify the processor architecture.

Windows based machine will have int size 2;
unix based int 4;

vimjet
By: vimjet
668 days 8 hours 37 minutes ago

Comments to Authors
please specify the processor architecture.

Windows based machine will have int size 2;
unix based int 4;

Virkayade Jitendra
By: Virkayade Jitendra
629 days 13 hours 10 minutes ago

nice...test...but did u will create some questions on pointers...

naveenkumar
By: naveenkumar
629 days 11 hours 58 minutes ago

answer for this question is wrong . the answer is 6.000000

venkat
By: venkat
622 days 11 hours 31 minutes ago

any one explain question no 6 please

siva
By: siva
612 days 14 hours 43 minutes ago

nice..i enjoyed while taking this test

Want to learn?

Sign up and browse through relevant courses.

or fill this simple form
Name:
Your Email:
Password:
Country:
Contact no.:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as shown in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
58 Followers

Your Facebook Friends on WizIQ

More Tests By Author

puzzle on C Programming language--Part 3
5 Questions | 394 Attempts

puzzle on C programming language---part 2
10 Questions | 422 Attempts

Connect