Programming  Java  Variables

31. What is the output of this program?
class mainclass {
public static void main(String args[])
{
boolean var1 = true;
boolean var2 = false;
if (var1)
System.out.println(var1);
else
System.out.println(var2);
}
}

0 1 true false
Comments

Share QNo: 31

32. What is the output of this program?
class booloperators {
public static void main(String args[])
{
boolean var1 = true;
boolean var2 = false;
System.out.println((var2 & var2));
}
}

0 1 true false
Comments

Share QNo: 32

33. 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);
}
}

162 65 97 67 95 66 98
Comments

Share QNo: 33

34. Which of these is data type long literal?

0x99fffL ABCDEFG 0x99fffa 99671246
Comments

Share QNo: 34

35. Which of these can be returned by the operator & ?

Integer Boolean Character Integer or Boolean
Comments

Share QNo: 35

36. Literals in java must be preceded by which of these?

L l D L and l
Comments

Share QNo: 36

37. Literal can be of which of these data types?

integer float boolean all of the mentioned
Comments

Share QNo: 37

38. Which of these can not be used for a variable name in Java?

identifier keyword identifier & keyword None of the mentioned
Comments

Share QNo: 38

39. 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);
}
}

38 39 40 41
Comments

Share QNo: 39

40. Which of these is incorrect string literal?

“Hello World” “Hello” “World” ab12
Comments

Share QNo: 40

 

*Click on the QNo to display a Question.

Total Ans