A Learning Portal from Recruitment India
Automatic type conversion in Java takes place when
Two type are compatible and size of destination type is shorter than source type.
Two type are compatible and size of destination type is larger than source type.
All of the above
Answer with explanation
Answer: Option CExplanation
Two type are compatible and size of destination type is larger than source type.
Workspace
An expression involving byte, int, and literal numbers is promoted to which of these?
int
long
float
byte
Answer with explanation
Answer: Option AExplanation
An expression involving bytes, ints, shorts, literal numbers, the entire expression is promoted to int before any calculation is done.
Workspace
How many primitive data types are there in Java?
6
7
8
9
Answer with explanation
Answer: Option CExplanation
Primitive types are the most basic data types available within the Java language. There are 8: boolean , byte , char , short , int , long , float and double .
Workspace
Java object oriented programming concepts is/are
Encapsulation
Inheritance
polymorphism
All of the above.
Answer with explanation
Answer: Option DExplanation
Encapsulation polymorphism Inheritance these are all Java objectoriented programming concepts
Workspace
Java does not support _______________?
Inheritance
Multiple inheritance for classes
multiple inheritance of interfaces
compile time polymorphism
Answer with explanation
Answer: Option BExplanation
Java does not support multiple inheritance for classes but in java multiple inheritance behavior is implemented using interfaces.
Workspace
Which of the following statements is/are TRUE regarding JAVA ?
(a) Constants that cannot be changed are declared using the ‘static’ keyword.
(b) A class can only inherit one class but can implement multiple interfaces.
Only (a) is TRUE.
Only (b) is TRUE.
Both (a) and (b) are TRUE.
Neither (a) nor (b) are TRUE
Answer with explanation
Answer: Option BExplanation
In JAVA, constant are not declared using ‘static’ keyword and a class can implement multiple interfaces but class can inherit one class only. So, option (B) is correct.
Workspace