ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
what will be the output:
main(){char ch;int a=10;printf("%d",ch);}
 Question Submitted By :: Sandipan
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 1
ans ch=0
if we print a it wil be 10
 
Is This Answer Correct ?    2 Yes 2 No
Reddy
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 2
It'll give a warnin tat "a is never used...If u Continue 
executing...it will the memory addres that is currently 
used.
 
Is This Answer Correct ?    3 Yes 0 No
Paul
 
 
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 3
The answer is Garbage value... 
The answer willbe lik -113...Depending upon the compailer
If we declare as.. 
 static char ch;
Then Answer is 0.....
 
Is This Answer Correct ?    8 Yes 0 No
Bharath S
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 4
it will print 64
 
Is This Answer Correct ?    0 Yes 4 No
Ruth
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 5
error will be occur because a is not in use in output 
statement
 
Is This Answer Correct ?    0 Yes 3 No
A.dinesh Kumar
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 6
  There will be no output

  because,in printf statement the integer variable is

declared but 'ch' is assinged.it should be 'a' insted 
of 'ch'.
 
Is This Answer Correct ?    0 Yes 2 No
Kalpana.y
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 7
garbage value will be given
 
Is This Answer Correct ?    4 Yes 0 No
Uttama
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 8
0
 
Is This Answer Correct ?    0 Yes 2 No
Siraj
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 9
It gives compilation warning but not Error.
While running ,gives Run time check error and prints some
garbage value.
 
Is This Answer Correct ?    1 Yes 0 No
Sadasiva
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 10
I think it will not give any error and it will print some 
garbage value.
 
Is This Answer Correct ?    0 Yes 0 No
Anu
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 11
error
 
Is This Answer Correct ?    1 Yes 0 No
Sabari
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 12
it will give a warning " that a is assigned a value that is 
never used"......
 
Is This Answer Correct ?    0 Yes 0 No
Ranjani
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 13
It Will print garbage value i.e. 
-113
 
Is This Answer Correct ?    1 Yes 0 No
Raj
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 14
The correct and verified answer is 8.
 
Is This Answer Correct ?    0 Yes 0 No
Manju
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 15
The answer is garbage value because ch is not initialised
 
Is This Answer Correct ?    1 Yes 0 No
Manju
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 16
variable ch is of character type and nothing is assigned
to it where as 'a' is of interger type.

In the printf statement we are placing variable 'ch' along 
with %d which will display a garbage value.
 
Is This Answer Correct ?    2 Yes 0 No
Sirajuddin
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 17
I think it prints some garbage value. if ch was initialised 
then it would have printed the ASCII value of that charecter
 
Is This Answer Correct ?    0 Yes 0 No
Raghu
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 18
error. you cant get the answer
 
Is This Answer Correct ?    0 Yes 0 No
Uma
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 19
warning! "a" is assigned a value that is never used
 
Is This Answer Correct ?    0 Yes 0 No
Balaji
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 20
I think this program produce some garbage value.
 
Is This Answer Correct ?    0 Yes 0 No
Kanmani
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 21
what will be the output of printf("%d")
ans-
the outpot is 0
 
Is This Answer Correct ?    0 Yes 0 No
Sulagna Samapika
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 22
answer is some garbage  value.
like in my case -53
becaus ch is not beeen initialized.
plz try n execute the programs before posting ur answers
 
Is This Answer Correct ?    1 Yes 0 No
Maruti
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 23
it will print the ascii value of the characters..
or some garbage values..
 
Is This Answer Correct ?    1 Yes 0 No
Shruti
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 24
garbage ascii value corresponding to the characterr present
in the memory location ch;
 
Is This Answer Correct ?    1 Yes 0 No
Vignesh1988i
 
  Re: what will be the output: main(){char ch;int a=10;printf("%d",ch);}
Answer
# 25
it will give some garbage value.........
 
Is This Answer Correct ?    0 Yes 0 No
Viji
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is the differnce between AF_INET and PF_INET? Wipro2
how to generate the length of a string without using len funtion?  3
2. What is the function of ceil(X) defined in math.h do? A)It returns the value rounded down to the next lower integer B)it returns the value rounded up to the next higher integer C)the Next Higher Value D)the next lower value Accenture2
What are bit fields? What is their use? Adobe1
void main() { int i=5; printf("%d",i+++++i); } ME12
Explain the differences between public, protected, private and internal.  1
Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?  6
Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa.  1
i want to have a program to read a string and print the frequency of each character and it should work in turbo c  2
what is array? HCL22
main() { int a=0; if(a=0) printf("Ramco Systems\n"); printf("India\n"); } output? Ramco6
enum day = { jan = 1 ,feb=4, april, may} what is the value of may? a)4 b)5 c)6 d)11 e)none of the above HCL2
Write code for atoi(x) where x is hexadecimal string. Adobe2
wt is d full form of c Wipro1
Struct(s) { int a; long b; } Union (u) {int a; long b; } Print sizeof(s)and sizeof(u) if sizeof(int)=4 and sizeof(long)=4 Mascot2
main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }the o/p is morning and e...how someone explain  1
what is memory leak?  3
What is external and internal variables What is dynamic memory allocation what is storage classes in C  2
When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?  2
how to find string length wihtout using c function?  4
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com