IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C++ Programming C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Civil Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C# Programming - Datatypes - Discussion

@ : Home > C# Programming > Datatypes > General Questions - Discussion

Read more:

"In the middle of difficulty lies opportunity."
- Albert Einstein
15. 

Which of the following statement correctly assigns a value 33 to a variable c?

byte a = 11, b = 22, c;

[A]. c = (byte) (a + b);
[B]. c = (byte) a + (byte) b;
[C]. c = (int) a + (int) b;
[D]. c = (int)(a + b);
[E]. c = a + b;

Answer: Option A

Explanation:

No answer description available for this question.


Abi said: (Tue, Oct 4, 2011 07:38:26 PM)    
 
Because the arithmetic expression on the right-hand side of the assignment operator evaluates to int by default.

Jiten said: (Sun, Sep 9, 2012 01:36:18 AM)    
 
For short and byte types compiler asks for explicit conversion.
The reason is its rule but with common sense that any mathematical calculations can go beyond byte and short types.

Write your comments here:
Name *:     Email:


© 2008-2013 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Contact us: info@indiabix.com     Follow us on twitter!