GeekInterview.com
Series: Subject: Topic:
Question: 461 of 587

What would be the output of the following program?
main()
{
int y=128;
const int x=y;
printf("%d",x);
}
a) 128 b) Garbage value c) Error d) 0

This question is related to Sonata Interview
Asked by: Interview Candidate | Asked on: Aug 13th, 2005
Showing Answers 1 - 7 of 7 Answers
pallavi

Answered On : Aug 13th, 2005

ans)a

  
Login to rate this answer.
Sudheshna.p

Answered On : Jul 7th, 2006

the answer is :128(a)

Yes  1 User has rated as useful.
  
Login to rate this answer.
anik

Answered On : Aug 31st, 2011

It should have been (a) because constant always needs to be initialized where it declared.

  
Login to rate this answer.
ragav

Answered On : Sep 11th, 2011

Error, because we cannot change the value of the const variable.

  
Login to rate this answer.
GIRIJA

Answered On : Aug 1st, 2012

(a).128

Yes  1 User has rated as useful.
  
Login to rate this answer.
Ashok Kumar Orupalli

Answered On : Sep 4th, 2012

Answer is a)128. Here we are not modifying const value. We are just assigning value to const variable.

  
Login to rate this answer.
...uzma...

Answered On : Oct 4th, 2012

View all answers by ...uzma...

128

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.