Office Document APIs for .NET
ITIL Career Advice
PMP Career Advice
Android Intel XDK
Welcome Guest !
Will the Following code compile ? double d = 5689.56; int i = d;
on 3/24/2011 | Category:
C# Interview questions
| Views: 7169 |
Select from following answers:
Yes, It Will Compile without an error
No, It will not Compile
No the above code will not compile since Double is a larger data type than integer.Here the Implicit conversion is not done since there would be a data loss.
It should be written like this which is an Explicit conversion.
double d = 5689.56;
int i = (int)d;
Show Correct Answer
Many Interviews |
< Previous :
What will be the output of the following code ? ...
Next > :
In which situations would you use HTML controls in ...
Comments or Responses
on: 6/7/2011 |
it will not compile
Error 1 Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)
on: 6/7/2011 |
Hi Muralik.it ,
Thanks for your response. Thats what exactly i have mentioned in the justification part also mentioned how succesfully it can be done.
Login to post response
More Interview Questions by Chvrsri
Explain two different scenarios where the Static Constructors can be u ...
Why is it not a good programming practice to use empty Destructors ?
Can we force Garbage Collector to run ?
What are the advantages of JQuery ?
In what scenarios we should not use Design Patterns ?
What does the assert() method do in debug compilation ?
What are the different Debugging tools come with .Net SDK ?
What are the different Name Spaces that are used to create a localized ...
Latest Interview Questions
In which situations would you use HTML controls in an ASP.NET web sit ...
What are the disadvantages of AJAX?
Which parameters define the database server in the connection string?
What is Code Instrumentation?
Write the difference between Group box control and Panel control?
What is the difference between "Convert" class and "Par ...
Write the difference between Stack and Heap?
What is "Content Type" for a FileUpload control?