Java MCQ in (English)
Java Type Casting MCQ Questions and Answers
Home | Java | Type CastingJava Type Casting MCQ Questions and Answers: Here learn quiz questions and answers for competitive exam and test your answer each questions and download pdf of objective type questions on Java Type Casting.
1) Which of the following are legal lines of Java code?
2) An expression involving byte, int, and literal numbers is promoted to which of these?
3) Which of the following automatic type conversion will be possible?
4) Which of these is necessary condition for automatic type conversion in Java?
Answer : B Discuss
5) What is the prototype of the default constructor of this class? public class prototype { }
Note: Dear Student, I request to you please search our site on google with study2online or study2online.com
6) What is the error in this code? byte b = 50;
b = b * 50;
Answer : B Discuss
7) If an expression contains double, int, float, long, then whole expression will promoted into which of these data types?
8) What is Truncation is Java?
Answer : A Discuss
9) What is the output of this program? class char_increment {
public static void main(String args[])
{
char c1 = 'D';
char c2 = 84;
c2++;
c1++;
System.out.println(c1 + " " + c2);
}
}
10) What is the output of this program? class conversion {
public static void main(String args[])
{
double a = 295.04;
int b = 300;
byte c = (byte) a;
byte d = (byte) b;
System.out.println(c + " " + d);
}
}
Download MCQ PDF
Online Practice Set
Latest PDF




