Java MCQ - English
What is the output of this program?
class mainclass
{
Home | Discussion Forum
{
What is the output of this program?
class mainclass
{
public static void main(String args[])
{
char a = 'A';
a++;
System.out.print((int)a);
}
}
Answer : A
View More Related Question
1) What is the output of this program?
class average
{
public static void main(String args[])
{
double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
double result;
result = 0;
for (int i = 0; i < 6; ++i)
result = result + num[i];
System.out.print(result/6);
}
}
2) What will be the output of these statement?
class output
{
public static void 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);
}
}
3) What is the output of this program?
class evaluate
{
public static void main(String args[])
{
int a[] = {1,2,3,4,5};
int d[] = a;
int sum = 0;
for (int j = 0; j < 3; ++j)
sum += (a[j] * d[j + 1]) + (a[j + 1] * d[j]);
System.out.println(sum);
}
}
4) What will the output of the following program?
public class Test{
public static void main(String args[])
{
float f = (1 / 4) * 10;
int i = Math.round(f);
System.out.println(i);
}
}
5) What is the output of this program?
class dynamic_initialization
{
public static void main(String args[])
{
double a, b;
a = 3.0;
b = 4.0;
double c = Math.sqrt(a * a + b * b);
System.out.println(c);
}
}