WizIQ helps you learn and teach online - any subject you can think of!
Join for FREE

Test your C Programming Skills

void main() { int a=10,b=20; char x=1,y=0; if(a,b,x,y) { printf("EXAM"); } } What is the output?
XAM is printed
exam is printed
Compiler Error
Nothing is printed
#include void main() { char letter =`Z`; printf(" %c",letter); }
Z
90
Garbage value
Error
Array passed as an argument to a function is interpreted as
Address of the array
Values of the first elements of the array
Address of the first element of the array
Number of element of the array
main() { char thought[2][30]={"Don`t walk in front of me..","I am not follow"}; printf("%c%c",*(thought[0] 9),*(*(thought 0) 5)); } What is the output of this program?
k k
int **array2 = (int **)malloc(nrows * sizeof(int *)); Don`t walk in front of me
I may not follow
K
What is the output of the following code? # include # define a 10 main() { printf("%d..",a); foo(); printf("%d",a); } void foo() { #undef a #define a 50 }
10..10
10..50
Error
0
Description:

A sample test for testing your C programming Skills

Comments
raam
By: raam
882 days 11 hours 9 minutes ago

iam passed in my online test

naidu
By: naidu
866 days 9 hours 49 minutes ago

hi this naidu ,i am stding at CADC Bangalore. i got a error for the 2nd question in "Test your C Programming Skills"

naidu
By: Amar
617 days 11 hours 11 minutes ago

remove '#include', if you're not adding any header file.

naidu
By: pawan tiwari
141 days 12 hours 34 minutes ago

ERROR THE SOURCE FILE IS NOT FOUND

Soumen Mondal
By: Soumen Mondal
835 days 3 hours 34 minutes ago

ditto writing and compiling will generate error as #include generally followed by some header file.....

gowthami
By: gowthami
817 days 13 hours 1 minutes ago

hi.....could u xplain me 4th and 5th ques in test ur c programming skills....

gowthami
By: Amar
617 days 11 hours 7 minutes ago

Question no.4 has got 'print' mistakes, try with following statement:
printf("%c %c", *(thought[0] 9), *(*(thought 0) 5));
Question no. 5, the answer selected is 'WRONG' and the options provided doesn't give the correct option to choose from. Correct answer is '50..50', since its the case of pre-processor directive.

gowthami
By: preeti
488 days 3 hours 9 minutes ago

this ans of ques 5 is absolutely correct, i have checked it bye compiling and running. Global and local definition context is also associated with pre-processor.

gowthami
By: zaheer
402 days 3 hours 18 minutes ago

no the answer is right for 5th question try it once again it is 10..10

gowthami
By: Palwinder
377 days 2 hours 44 minutes ago

yes u r right i checked it

gowthami
By: vignesh
497 days 20 hours 39 minutes ago

for 5th question we define a variable like #define a 10 the value cannot be changed at any part of the program....so the answer is 10 10

gowthami
By: preeti
488 days 3 hours 6 minutes ago

#include
#include
#define a 10
void foo1();
main()
{
printf("%d..",a);
foo1();
#undef a
#define a 40
printf("%d",a);
getch();
}
ans of this code is 10..40, this means the value of a can be changed by #define used in any part of the program depends on the scope.

gowthami
By: zaheer
402 days 3 hours 14 minutes ago

no we can change the value of #define also becoz of local and global variables the value differs

gowthami
By: shivam
166 days 2 hours 35 minutes ago

5 one i can explain u.in # define the value is assigned before compilatin so every where in the program the a is changed with 10 so no matter other things answer is always 10

gowthami
By: gowthami
817 days 13 hours ago

hi this is gowthami....could u pls xplain me 4th ques in test ur c programming skills......

rajeswari
By: rajeswari
799 days 10 hours 21 minutes ago

hi this is raji could u explain the 5th question in test u r c programing skills

rajeswari
By: Amar
617 days 11 hours 7 minutes ago

Question no. 5, the answer selected is 'WRONG' and the options provided doesn't give the correct option to choose from. Correct answer is '50..50', since its the case of pre-processor directive

rajeswari
By: Tarun
231 days 1 hours 22 minutes ago

sir correct ans is 10..10
if u are getting confused then try to print "a"in foo() also . you will get 10..5010

sarabjit kaur
By: sarabjit kaur
794 days 8 hours 57 minutes ago

gt problem in 4th n 5th ques.....

shravani
By: shravani
788 days 7 hours 2 minutes ago

since the changes that are made in function doesn't reflect in main function the value of a in main function remains same i.e., 10

shravani
By: Amar
617 days 11 hours 5 minutes ago

keep in mind that '#define' is a compiler preprocessor directive. Hence the values should be altered before hand.

sountharcs
By: sountharcs
784 days 7 hours 11 minutes ago

#include generally followed by some header file.....SO IT WILL PRODUCE error ,,,,can u explain this....

KALPANA
By: KALPANA
783 days 13 hours 43 minutes ago

so nice all the test

raj
By: raj
762 days 18 hours 20 minutes ago

In 5th question the defination of function foo() shouldn't have void. since we havent declare the prototype of the function foo(),so the compiler treats the fuction call in line6 as the fuction returns and no.of arguments are same as calling function arguments.so when it jump to function header it shows error as we place wrong return type.

raj
By: raj
762 days 18 hours 16 minutes ago

i got error for 4th question.. is it correct declaration thought[1]9. i think we can access array element using [index] or adding index value to base adress i.e, (thought+1)+9 like this.. can anybody explain me...

raj
By: Amar
617 days 11 hours 4 minutes ago

You're right.
There is clear mistake in the specified question over there. Make the needed changes and test your answer :)

raj
By: darshan
214 days 17 hours 33 minutes ago

i think the program is wrong bcoz in declaration double array is used , while printing single array .

yakshendotmail.comra
By: yakshendotmail.comra
759 days 8 hours 58 minutes ago

solution to 4th problem depends upon representation of 2d array in pointer form...

sandeep
By: sandeep
756 days 17 hours 8 minutes ago

interesting test like it

sheetal lakra
By: sheetal lakra
752 days 12 hours 29 minutes ago

i want a reply...plzzzzzzzzzzzzzzzzz

sheetal lakra
By: Amit
643 days 14 hours 36 minutes ago

1-4
2-1
3-Address of the first element of the array
4-4
5-1
Amit garg
E-mail ID- logicalamit@yahoo.com
Thanks

sheetal lakra
By: rahulmali
20 days 15 hours 8 minutes ago

i abuse u

saurabh100
By: saurabh100
746 days 2 hours 31 minutes ago

any one plz explain me 5th problem....

saurabh100
By: Amar
617 days 11 hours 3 minutes ago

Question no. 5, the answer selected is 'WRONG' and the options provided doesn't give the correct option to choose from. Correct answer is '50..50', since its the case of pre-processor directive

saurabh100
By: vignesh
497 days 20 hours 41 minutes ago

we define a variable like #define a 10 the value cannot be changed at any part of the program....so the answer is 10 10

vins
By: vins
745 days 19 hours 8 minutes ago

will any one explain me 4th qn?

vins
By: vins
745 days 19 hours 8 minutes ago

plz explain me 4 th question

Bharat
By: Bharat
734 days 6 hours 15 minutes ago

very gud question, plz anyone post the answer

1234567
By: 1234567
714 days 40 minutes ago

4th test doesn't compile at all. I tried it with different c compilers.

prabhat
By: prabhat
712 days 12 hours 48 minutes ago

hi this is prabhat nice questions thank you. i think in 4th question sign is missing between pointer variable n subscript.

Your Name
By: Your Name
712 days 9 hours 46 minutes ago

i attempted all question correctly it shows that i am very sound in c....

rika
By: rika
679 days 17 hours 37 minutes ago

hi! can any body clarify 1st answer.

rika
By: kamlesh
673 days 19 minutes ago

in this prog. there is no syntactical error so there is no compilation error but in if statement there is no valid condition hence nothing is printed.

rika
By: Amar
617 days 11 hours ago

That is an incorrect explaination Kamlesh.
Its the case of 'Comma' operator. It returns the 'value'(and type) of the last operand, always. Since the value of 'y' is 0, the condition fails. Try changing the sequence and put anything other than 'y' at the last operand and see the result.

Bhaskar
By: Bhaskar
670 days 1 hours 13 minutes ago

what a rubbish test. Can any one tell me how the author gets the output 10..10 for the last question. It would defenitely give error.

Bhaskar
By: tuttu
642 days 12 hours 21 minutes ago

yes dear the answer is correct.it is because the inner loop of foo will terminate without printing anything.

Sarbjit
By: Sarbjit
667 days 14 hours 16 minutes ago

I think you fram some of the questions wrong.

Valentin
By: Valentin
667 days 9 hours 36 minutes ago

Most stupid test I ever seen
Just check by compiler and see.For ex. #include without
filename, you will get error instead print result

Valentin
By: preeti
488 days 2 hours 52 minutes ago

hey this is not a stupid test at all, #include must have a header file after it, but at the time of uploading this statement over hare, this header part is eliminated by itself that's y its not appearing in code.

dara singh
By: dara singh
666 days 10 hours 55 minutes ago

i didn't undesand the process of fouth program
just describe it

brahma chaitanya
By: brahma chaitanya
656 days 7 hours 11 minutes ago

may i know how it will print k in output in 4rth pgm

kavita sharma
By: kavita sharma
643 days 13 hours 57 minutes ago

me too get good marks in dis test.........!!!!

tuttu
By: tuttu
642 days 12 hours 24 minutes ago

dear sir,
thank u for ur effort.it is really helpful.sir i request u to kindly arrange some more questions so that we can practice more also sir u increase the no of questions and set a time barrier qithin which we have complete .
this would help us more.
by the way this effort is also appreciatiable.

"with regards"
amrit upadhyay
(student of cdac acts-chennai)

rahul
By: rahul
619 days 2 hours 51 minutes ago

fifth question is error. in hader file pls explain this.

rahul
By: Amar
617 days 10 hours 58 minutes ago

Do not use '#include' in the example.
But the answer selected is 'WRONG' and the options provided doesn't give the correct option to choose from. Correct answer is '50..50', since its the case of pre-processor directive

rahul
By: zaheer
402 days 3 hours 21 minutes ago

no the answer is right it is 10..10 only

anag
By: anag
605 days 11 hours 47 minutes ago

Question no-5 gives an error beacuse u did not declare a function prototype apart from this error also produce due header file also.

veerabhadrarao
By: veerabhadrarao
604 days 12 hours 49 minutes ago

very

rohit chatterjee
By: rohit chatterjee
598 days 6 hours 40 minutes ago

I thank Mr. Masoodi for his efforts at creating this test. However, the test needs a bit of improvement.

After a quick search I found the following:

http://www.prog2impress.com/puzzles.html

I hope this helps other future developers out there!

vamsi564
By: vamsi564
582 days 16 hours 1 minutes ago

good

dhaval
By: dhaval
567 days 15 hours 15 minutes ago

nice questions... i like it.

dfhd
By: dfhd
557 days 17 hours 47 minutes ago

Hi
correct me if im wrong. But calling the function "foo()" in main before it is declared will cause compile time error.

dfhd
By: Tarun
231 days 1 hours 24 minutes ago

hi
yes it will give you error saying function should return a variable
try to take foo as int
int foo()
{
}

Neha Sharma
By: Neha Sharma
532 days 15 hours 30 minutes ago

I gave 4 correct answers out of 5.

Neha Sharma
By: anil
246 days 17 hours 27 minutes ago

yaa u ... r

meghna sharma
By: meghna sharma
528 days 6 hours 46 minutes ago

test is simple.....bt can't understand 3 question

Nilesh Shelar
By: Nilesh Shelar
527 days 16 hours 50 minutes ago

Hi this was my first test here and i scored 2 out of 5

XITIJ_THOOL
By: XITIJ_THOOL
527 days 6 hours 9 minutes ago

cool i liked it , one of my favorites . Thank you

ANKUR SHUKLA
By: ANKUR SHUKLA
523 days 16 hours 34 minutes ago

wat is the criteria of avg marks

sonam jain
By: sonam jain
519 days 14 hours 24 minutes ago

solutons of Qu paper

vidya
By: vidya
507 days 4 hours 30 minutes ago

there is one wrong questin in the above quiz

elshan
By: elshan
506 days 1 hours 6 minutes ago

interesting test ... ('-')

Maulik Shah
By: Maulik Shah
489 days 9 hours 29 minutes ago

nice one.....

Laxminarayan Dash
By: Laxminarayan Dash
483 days 2 hours 26 minutes ago

WAH IT IS VERY EASY.I COMPLETED IN 30 SECS.

amar
By: amar
479 days 7 hours 13 minutes ago

i have passed this test
my all answers r correct

hussainy
By: hussainy
478 days 10 hours 30 minutes ago

I like this very much,
wish me luck...

jyothsna
By: jyothsna
475 days 16 hours 16 minutes ago

questions are excellent

Vidhi
By: Vidhi
445 days 14 hours 23 minutes ago

ques r very good but i want c questions so that i can practice.............

kapil
By: kapil
441 days 16 hours 16 minutes ago

nice question in test ,but there should be more wuestion with time limit.

ziya
By: ziya
433 days 15 hours 37 minutes ago

what a taff quation bt you hav many knowlege thanks

Anshul Jain
By: Anshul Jain
427 days 14 hours 46 minutes ago

nice question, put some more

koushik
By: koushik
417 days 5 hours 6 minutes ago

I think you are a begener

zaheer
By: zaheer
402 days 3 hours 24 minutes ago

Hi gowtami,
Your answer for 5th question is "define a 50" statement here the 'a' is a local variable. so its value persists inside the loop only. thatswhy in main() again 'a' value is printed as 10. icoudn't get solution for 4th sum

zaheer
By: play
395 days 4 hours 1 minutes ago

Nope... 'a' is not variable, its constant(to more precise a literals) and the macros do not ve scope...

So what exactly happens is these macros are resolved before the source file is compiled. The macro substitutions take place in the order they appear in.. i.e, the all appearance is 'a' source file is replaced by 10 first(until before #undef) and subsequent appearance of 'a' if any in source after the #undef and #define a 50 would be replaced by 50..

The point is all this happens line by line

pankaj sewalia
By: pankaj sewalia
401 days 22 hours 12 minutes ago

hey 4th ques i got prob. did anyone explain it,my compiler says" expected ")" before numric constant

vivek singh
By: vivek singh
398 days 9 hours 16 minutes ago

GOOD QUESTIONS

sana
By: sana
396 days 2 hours 53 minutes ago

Is all answers r correct?

niranjan
By: niranjan
385 days 12 hours 40 minutes ago

good skill test

vijaykumar vendra
By: vijaykumar vendra
371 days 8 hours 54 minutes ago

thanks

saurav tyagi
By: saurav tyagi
366 days 13 hours 53 minutes ago

could u just explain me the q.4.....

john abraham
By: john abraham
363 days 9 hours 15 minutes ago

i got zero because of #include(no header file)

lkjhklh
By: lkjhklh
362 days 3 hours 31 minutes ago

I'm 4/5. Quite simple questions.

vivek
By: vivek
360 days 17 hours 27 minutes ago

I GOT 5 MARKS OUT OF 5

vinod chavan
By: vinod chavan
358 days 13 hours 40 minutes ago

good demo.

naveen
By: naveen
357 days 11 hours 40 minutes ago

wt s the use of #include if there is no headerfiles......

Devendra dattatraya dahiphale
By: Devendra dattatraya dahiphale
345 days 9 hours 29 minutes ago

it was good i could solve 3 correct

jaysinhp
By: jaysinhp
302 days 8 hours 26 minutes ago

You should include The stdio.h Which is standard input/output file ! Also Don't write `Z` Because for character it is 'Z' .

adila
By: adila
278 days 17 hours 11 minutes ago

thanks

Mohit
By: Mohit
259 days 6 hours 50 minutes ago

nice test

Meena
By: Meena
255 days 6 hours 50 minutes ago

Its really help full for students...........I Need some C interview questions on inline function can give the question based on that

anil
By: anil
246 days 17 hours 25 minutes ago

what is difference btn ABCD and DCBA format ?

Rajesh
By: Rajesh
214 days 3 hours 24 minutes ago

remove '#include', if you're not adding any header file.Question no.4 has got 'print' mistakes, try with following statement:
printf("%c %c", *(thought[0] 9), *(*(thought 0) 5));
Question no. 5, the answer selected is 'WRONG' and the options provided doesn't give the correct option to choose from. Correct answer is '50..50', since its the case of pre-processor directive.

Rajesh
By: vimjet
200 days 7 hours 30 minutes ago

Question no 5 rellay compiled for you , I have tried to compile with gcc. But I got following error.

ERROR:
array1.c: In function `main':
array1.c:4: parse error before `9'
array1.c:4: parse error before `0'

saidanaik
By: saidanaik
210 days 8 hours 28 minutes ago

hey last question is very very nice... :)

saidanaik
By: saidanaik
210 days 8 hours 28 minutes ago

hey last question is very very nice... :)

mohanapriya c
By: mohanapriya c
209 days 12 hours 23 minutes ago

answer for the 5th question is error na... there is a space b/w # and define which ll cause an error..... is there any objection to my ans myfriend?????

mohanapriya c
By: anvesh
203 days 9 hours 56 minutes ago

Hi

anurag
By: anurag
206 days 8 hours 27 minutes ago

can sm1 xplain me 4th question

anvesh
By: anvesh
203 days 9 hours 58 minutes ago

I got 5 out of 5

vimjet
By: vimjet
200 days 7 hours 34 minutes ago

I don't understand the question 4.
I get compiler error... those you got wright answer for 4 can explain us... pls

vinod thete
By: vinod thete
199 days 15 hours 34 minutes ago

THANK YOU

vinod thete
By: vinod thete
198 days 15 hours 36 minutes ago

a

RAJA SINGAM
By: RAJA SINGAM
197 days 13 hours 17 minutes ago

I Like this

satishvaka
By: satishvaka
170 days 9 hours 6 minutes ago

not sufficient .i want some more questions

satishvaka
By: satishvaka
170 days 9 hours 6 minutes ago

not sufficient .i want some more questions

manish patel
By: manish patel
168 days 17 hours 57 minutes ago

gud......

vajid mulla
By: vajid mulla
146 days 15 hours 56 minutes ago

nmhkyvflufy

vajid mulla
By: vajid mulla
146 days 15 hours 55 minutes ago

m,opgvfy

asif patel
By: asif patel
139 days 16 hours 42 minutes ago

nfdbnskfnd dbfsdbfsd f d f f dfn fnm.fkldkljioermsajfkjenrjtne ghuiher ewrwenerj bdn bfdbfdn f dn dfberhr fnfndfaaldbfrmeea=ra====meera kaise ho

sanjeet kumar
By: sanjeet kumar
133 days 11 hours 12 minutes ago

All answers r right

Want to learn?

Sign up and browse through relevant courses.

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


Area code Number
Subject 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
Zubair Masoodi
Learn asp.net step by step free training
User
3 Members Recommend
132 Followers

Your Facebook Friends on WizIQ

More Tests By Author

Asp.net Online Tests
6 Questions | 3143 Attempts

Asp.net online test (Microsoft Certified Technical Specialist (MCTS)
5 Questions | 7925 Attempts

Asp.Net 2.0
5 Questions | 2346 Attempts

Test your Computer Knowledge 2
26 Questions | 2276 Attempts