in Programming in C
3,448 views
2 votes
2 votes

printf(“%c”, 100);

  1. prints 100
  2. prints ASCII equivalent of 100
  3. prints  garbage
  4. None of the above
in Programming in C
3.4k views

2 Answers

2 votes
2 votes
Best answer

Printf("%c",100);

Here %c is a format specifier which prints the ASCII equivalent of the value.

It will Print ASCII value of 100.

But ASCII is not mandated by C Language.

Hence,Option(D)None of these.

edited by

11 Comments

Yes, but I don't think ASCII is mandated by C language. For me D is a better answer though official key says B.
0
0
yes Sir, Answer can be none of these here but sir i considered it a normal case.
0
0
edited by
@Arjun sir If you think  here none of above is correct answer.Then

what should be the correct answer here ?Means what should be in place of 'None of above'

Because in almost all C compiler when we run such program then simply print ascii equivalent 100 which is 'd'.
0
0

it is not mentioned anywhere that this piece of code anyway related to C language.

0
0

Printf function is not related to Csurprise

0
0

@manoj

thare are four diffrent set-up box for T.V sets showing diffrent channels at diffrent number...

TATA SKY

DISH TV

SUN TV

BIG TV

the question is at   what number is "TEN SPORTS" channel Displayed

1) TEN SPORTS

2)DISH T.V channel no.41(assume tensports is 41 on dist t.v)

3)garbage..channel does not exist

4)none of above

the best answer is none of above...becoz it is not mandatory...that u can only install DISH T.V...it can be anyone..."TEN SPORTS"  can be at any number...

u r asking what could be in place of none of above.

there are many character encoding schemes...it is not neccessary c utilizes ASCII..cheeky hope u will get

0
0

@chauhan

the subject was EPICS and UPNISHADS

question asked

who is father of ram ?

and you are saying it is not mentioned anywhere it is related to RAMAYANAsmiley. hope u wil get

0
0

@Tauhin

Arjun sir said

Yes, but I don't think ASCII is mandated by C language. For me D is a better answer though official key says B.

He said  I don't think ram is mandated in Ramayana .there was some other important  character in ramayana for me ram was not in Ramayan was better choice.

I said

it is not mentioned anywhere that this piece of code anyway related to C language.

Means it is not mentioned anywhere that ram was the only one in ramayana it can be in mahabharat in the form of krishna.

0
0
first of all my intension was 2 make u ..understand not argue.

second of all ..u cannot intermix... arjun sir statement and ur statement...wat u said is totally different from arjun sir..and i knw wat arjun said

third of all..."Means it is not mentioned anywhere that ram was the only one in ramayana it can be in mahabharat in the form of krishna."....is true.

   but u cannot relate it to printf statement in c ....so that it can be cout in c++, ///print in python

as it was ram in ramayana & krishna in mahabharta.....

////////printf means "c" language...till now..i think no other language has same printing commanad...yet

fourth of all...accept it...if u committed mistakes..u will grow higher

fifth of all...m sorry if it hearted u...
0
0

Don't take it serious I am just kidding okay laugh and my comment was not on question or any answer i commented on arjun sir comment as they said in their comment " I don't think ASCII is mandated by C language " 

I just commented on it that 

it is not mentioned anywhere that this piece of code anyway related to C language.

because they did not say in question that Consider C-Language to answer this question.

1
1
It prints 'd'. so option B is the correct answer.
0
0
0 votes
0 votes

printf(“%c”, 100);

Prints ASCII value of 100

Option B


Extra stuff:-

printf(“%c”, '100');

Gives warning because 100 are three characters.


printf(“%c”, '1');

Prints 1


printf(“%c”, "1");

error (This is because single quotes are used for char literals, and double quotes are used for string literals)


printf(“%s”, 100);

error


printf(“%s”, '100');

error (This is because single quotes are used for char literals, and double quotes are used for string literals)


printf(“%s”, "100");

Prints 100


 

Answer:

Related questions