Programming - Type Casting
You Are Here :: Home > JAVA > Type Casting - General Questions
7.
_______________ is incompatible for conversion
A.
Boolean
B.
Integer
C.
Float
D.
String
Answer: Option A
Explanation:
8.
___________________ A boolean value cannot be assigned to any other data type. Except boolean, all the remaining 7 data types can be assigned to one another either implicitly or explicitly; but boolean cannot.
A.
Implicit casting (widening conversion)
B.
Explicit
C.
Boolean Casting
D.
None
Answer: Option C
Explanation:
9.
byte can be assigned to short implicitly but shortto byte requires _____________ casting.
A.
Implicit casting (widening conversion)
B.
Explicit
C.
Both
D.
None
Answer: Option A
Explanation:
10.
___________________ discusses casting between objects of different classes involved in inheritance.
A.
Implicit casting (widening conversion)
B.
Explicit
C.
object
D.
None
Answer: Option C
Explanation:
11.
How many ways you can copy one object properties to another?
A.
3 ways –â Shallow copying
B.
Deep copying
C.
Cloning
D.
All the above
Answer: Option D
Explanation:
12.
How to convert a string into string form?
A.
byte
B.
Integer
C.
long
D.
All the above
Answer: Option D
Explanation:
String to data type conversions –â byte,â short,â int,â long,â float,â double,â charâ andboolean.
« prev
next »