Core Java Assignment 1
Core Java Assignment 1
a) -128 to 127
b) -32768 to 32767
c) -2147483648 to 2147483647
a) -128 to 127
b) -32768 to 32767
c) -2147483648 to 2147483647
1. int w = (int)888.8;
2. byte x = (byte)100L;
a) 1 and 2
b) 2 and 3
c) 3 and 4
d) All statements are correct.
4. An expression involving byte, int, and literal numbers is promoted to which of these?
a) int
b) long
c) byte
d) float
a) -1.7e+308
b) -3.4e+038
c) +1.7e+308
d) -3.4e+050
int
b) float
c) double
d) long
main(String args[]) {
System.out.print(result/6);
a) 16.34
b) 16.566666644
c) 16.46666666666667
d) 16.46666666666666
main(String args[])
{
double a, b,c;
a = 3.0/0;
b = 0/4.0;
c=0/0.0;
System.out.println(a);
System.out.println(b);
System.out.println(c);
a) Infinity
b) 0.0
c) NaN
main(String args[])
int g = 3;
System.out.print(++g * 8);
a) 25
b) 24
c) 32
d) 33
args[])
double r, pi, a;
r = 9.8; pi =
3.14;
a = pi * r * r;
System.out.println(a);
}
}
a) 301.5656
b) 301
c) 301.56
d) 301.56560000
a) -128 to 127
b) 0 to 256
c) 0 to 32767
d) 0 to 65535
12. Which of these coding types is used for data type characters in Java?
a) ASCII
b) ISO-LATIN-1
c) UNICODE
b) 0 & 1
d) true
14. Which of these occupy first 0 to 127 in Unicode character set used for characters in
Java?
a) ASCII
b) ISO-LATIN-1
a) boolean b1 = 1;
b) boolean b2 = ‘false’;
c) boolean b3 = false;
d) boolean b4 = ‘true’
.