Welcome Guest | Sign in | Register
Flow Control - Discussion Page For Q.2805 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Flow Control > Questions and Answers

Q: Which are correct input-output options :

public class Example6{
public static void main(String args[])
{
public int check(char a) {
if (a <= 'N') {
if (a == 'E')
return 2;
return 1;
} else if (a == 'S')
return 3;
else if (a == 'W')
return 4;
return 0; }
}
}

Options are :
A. a='A' output=1.
Compile error.
B. Compile error.
a='X' output=0,
C. a='X' output=0,
a='A' output=1.

D. a='A' output=1.
a='D' output=0.

Answer and Explanation

Answer:a='X' output=0,

a='A' output=1.

Explanation:
Since 'Ascii' value of 'D' is less than 'Ascii' value of 'N', so it's output will be 1.That's why it(4) is not correct option to choose.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.