puzzle on C programming language---part 2 online Test

#define SQR(x) x * x

main()

{

printf("%d", 225/SQR(15));

}


main()

{

int i = 0xff ;

printf("\n%d", i<<2);

}


main(int argc, char *argv[])

{

(main && argc) ? main(argc-1, NULL) : return 0;

}


main()

{

int i, j, *p;

i = 25;

j = 100;

p = &i; // Address of i is assigned to pointer p

printf("%f", i/(*p) ); // i is divided by pointer p

}


const int perplexed = 2;

#define perplexed 3

main()

{

#ifdef perplexed

#undef perplexed

#define perplexed 4

#endif

printf("%d",perplexed);

}


main()

{

char *a = "Hello ";

char *b = "World";

clrscr();

printf("%s", strcat(a,b));

}


void func1(int (*a)[10])

{

printf("Ok it works");

}

void func2(int a[][10])

{

printf("Will this work?");

}

main()

{

int a[10][10];

func1(a);

func2(a);

}


main()

{

int c = 5;

printf("%d", main||c);

}


main()

{

int i =10, j = 20;

clrscr();

printf("%d, %d, ", j-- , --i);

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

}


main()

{

int x=5;

clrscr();

for(;x==0;x--) {

printf("x=%d\n”", x--);

}

}












































































Description:

hi there..here i have added some more problems....if u have any doubts please ask ...i will give a well defined explanation ....in case if u know the reason for any particular puzzle please post that too..so that other may get benefits from u..thank you all
with regards
sana

Comments
pooja
By: pooja
679 days 21 hours 33 minutes ago

can u explain q7 of this test??

Gethzia
By: Gethzia
639 days 5 hours 31 minutes ago

can u explain 2nd que..?

Gethzia
By: vallisha
598 days 18 hours 42 minutes ago

i=10,j=20
in the first printf statement, the value of j is first printed and later decremented coz of post decrement, the value of i initially decremented and later printed.

therefore output will be 20 , 9

and value of i=9, j=19

in the second printf statement, j value is first printed and later incremented, i value is incremented and then printed.


output of the second printf 19,10


overall output

20,9,19,10

saobang972
By: saobang972
518 days 3 hours 52 minutes ago

Plz write you code more clearly. thank your

abhinav
By: abhinav
487 days 22 hours 1 minutes ago

ur answer of ques no 7 is wrong.u r dividing the i by *p not p(careful look)divide operation is prohibited on pointers not its value.so the answer would be 1.000000.

sai
By: sai
326 days 9 minutes ago

Hi,
Can u explain q10 of part -2

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


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


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

Your Facebook Friends on WizIQ

More Tests By Author

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

puzzle in C Programming Language
8 Questions | 3345 Attempts

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect