71. If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?
72. What will be the output of the following Java 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);
}
}
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);
}
}
73. Which of these can be returned by the operator &?
74. Which data type value is returned by all transcendental math functions?
75. What is the prototype of the default constructor of this Java class?
public class prototype { }
public class prototype { }
76. What will be the output of the following Java program, if we run as "java main_arguments 1 2 3"?
class main_arguments
{
public static void main(String [] args)
{
String [][] argument = new String[2][2];
int x;
argument[0] = args;
x = argument[0].length;
for (int y = 0; y < x; y++)
System.out.print(" " + argument[0][y]);
}
}
class main_arguments
{
public static void main(String [] args)
{
String [][] argument = new String[2][2];
int x;
argument[0] = args;
x = argument[0].length;
for (int y = 0; y < x; y++)
System.out.print(" " + argument[0][y]);
}
}
77. Which of these literals can be contained in float data type variable?
78. What will be the output of the following Java code?
class A
{
final public int calculate(int a, int b) { return 1; }
}
class B extends A
{
public int calculate(int a, int b) { return 2; }
}
public class output
{
public static void main(String args[])
{
B object = new B();
System.out.print("b is " + b.calculate(0, 1));
}
}
class A
{
final public int calculate(int a, int b) { return 1; }
}
class B extends A
{
public int calculate(int a, int b) { return 2; }
}
public class output
{
public static void main(String args[])
{
B object = new B();
System.out.print("b is " + b.calculate(0, 1));
}
}
79. What will be the output of the following Java code snippet?
enum Levels
{
private TOP,
public MEDIUM,
protected BOTTOM;
}
enum Levels
{
private TOP,
public MEDIUM,
protected BOTTOM;
}
80. How to format date from one form to another?
Read More Section(Data Types and Variables)
Each Section contains maximum 100 MCQs question on Data Types and Variables. To get more questions visit other sections.