Java MCQ - English
What is the output of this program?
class evaluate
{
Home | Discussion Forum
{
Home | Discussion Forum
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);
}
}
Answer : C
View More Related Question
1) What is the output of this program?
class asciicodes
{
public static void main(String args[])
{
char var1 = 'A';
char var2 = 'a';
System.out.println((int)var1 + " " + (int)var2);
}
}
2) 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);
}
}
3) What is the output of this program?
class increment
{
public static void main(String args[])
{
double var1 = 1 + 5;
double var2 = var1 / 4;
int var3 = 1 + 5;
int var4 = var3 / 4;
System.out.print(var2 + " " + var4);
}
}
4) What is the output of this program?
class increment
{
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
5) What will be the output?
public class Test
{
public static void main(String args[])
{
int a = 42;
double b = 42.25;
System.out.print((a%10)+" "+(b%10));
}
}