Syvum Home Page

Home > Quiz Games > Java Programming > Print Preview

Java Programming : Flash Cards I

Formats Info Page Worksheet / Test Paper Quiz Review
Table | List

Try the Quiz : Java Programming : Flash Cards I

About Button apid Just what you need to know!
eview

CODEOUTPUT
What will be the output of the following code?
byte x = 64, y;
y = (byte) (x << 2);
System.out.println(y);
0
What will be the output of the following code?
byte b;
double d = 417.35;
b = (byte) d; System.out.println(b);
161
Given the value of a variable, write a statement, without using if construct, which will produce the absolute value of the variable.x = x<0?-x:x;
What is wrong with the following code?
switch (x)
{
case 1:
n1 = 10;
n2 = 20;
case 2:
n3 = 30;
break;
n4 = 40;
}
n4 = 40; is unreachable
What will be the output of the following program code?
int m = 100;
int n = 300;
while(++m < --n);
System.out.println(m)
;
200
What does the following fragment display?
String s = "six:" + 3 + 3;
System.out.println(s);
six:33
What is the output of the following code?
String s;
System.out.println("s = " + s);
null
What is the output of the following code?
String s = new String();
System.out.println("s = " + s);
s =
What is the problem with the following snippet?
class Q9

(i=10) is the problem
What will be the output of the following code snippet?
int x = 10;
int y = 20;
if((x||(x=5)>10)
System.out.println(x);
else
System.out.println(y);
10
Show the output of the following code:
int a, b;
a = 5;
b = 10;
if(a > 5)
if(b > 5)
{
System.out.println("b is " +b);
}
else
System.out.println("a is " +a);
a is 5
State the output of the following code:
int a = 10;
int b = 5;
if(a > b)
{
if(b > 5)
System.out.println("b is " +b);
}
else
System.out.println("a is " +a);
No output
What is the output of the following code:
int m = 100;
while(true)
{
if(m < 10)
break;
m = m - 10;
}
System.out.println("m is " +m);
m is 0
What is the output of the following code:
int m = 100;
while(true)
{
if(m < 10)
continue;
m = m - 10;
}
System.out.println("m is " +m);
No output; Infinite loop
Use a single line of code, complete the following class so that it returns x+y if the value of x is equal to y, otherwise returns 0:
Public class XY

return(x == y)?x+y:0;

Try the Quiz : Java Programming : Flash Cards I


Contact Info © 1999-2024 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright
Previous
-
Next
-