Programming  Java  Variables

21. 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.;
}
}

38 43 39 44 295 300 295.04 300
Comments

Share QNo: 21

22. What is the output of this program?
class increment {
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}

25 24 32 33
Comments

Share QNo: 22

23. What is the output of this program?
class area {
public static void main(String args[])
{
double r, pi, a;
r = 9.8;
pi = 3.14;
a = pi * r * r;
System.out.println(a);
}
}

301.5656 301 301.56 301.56560000
Comments

Share QNo: 23

24. What is the numerical range of a char in Java?

-128 to 127 0 to 256 0 to 32767 0 to 65535
Comments

Share QNo: 24

25. Which of these coding types is used for data type characters in Java?

ASCII ISO-LATIN-1 UNICODE None of the mentioned
Comments

Share QNo: 25

26. Which of these values can a boolean variable contain?

True & False 0 & 1 Any integer value true
Comments

Share QNo: 26

27. Which of these occupy first 0 to 127 in Unicode character set used for characters in Java?

ASCII ISO-LATIN-1 None of the mentioned ASCII and ISO-LATIN1
Comments

Share QNo: 27

28. Which one is a valid declaration of a boolean?

boolean b1 = 1; boolean b2 = ‘false’; boolean b3 = false; boolean b4 = ‘true’
Comments

Share QNo: 28

29. What is the output of this program?
class array_output {
public static void main(String args[])
{
char array_variable [] = new char[10];
for (int i = 0; i < 10; ++i) {
array_variable[i] = i;
System.out.print(array_variable[i] + "" );
i++;
}
}
}

i i i i i 0 1 2 3 4 i j k l m None of the mentioned
Comments

Share QNo: 29

30. What is the output of this program?
class mainclass {
public static void main(String args[])
{
char a = A;
a++;
System.out.print((int)a);
}
}

66 67 65 64
Comments

Share QNo: 30

 

*Click on the QNo to display a Question.

Total Ans