[Link] will be the output of the following Java code?
class box
int width;
int height;
int length;
int volume;
box()
width = 5;
height = 5;
length = 6;
void volume()
volume = width*height*length;
class constructor_output
public static void main(String args[])
box obj = new box();
[Link]();
[Link]([Link]);
}
Ans: 150
[Link] of these can be overloaded?
a)Methods
b)Constructors
c)All of the mentioned
d)None of the mentioned
[Link] is true about constructor?
a)It can contain return type
b)It can take any number of parameters
c)It can have any non access modifiers
d)Constructor cannot throw an exception
[Link] of the following is a method having same name as that of it’s
class?
a)finalize
b)delete
c)class
d)constructor
[Link] method can be defined only once in a program?
a)main method
b)finalize method
c)static method
d)private method
[Link] 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 = [Link](a * a + b * b);
[Link](c);
Ans: sqrt(25.0)=5.0
[Link] will be the output of the following Java code?
class San
public void m1 (int i,float f)
[Link](" int float method");
public void m1(float f,int i);
[Link]("float int method");
public static void main(String[]args)
San s=new San();
s.m1(20,20);
}
}
a)int float method
b)float int method
c)compile time error
d)run time error
[Link] will be the output of the following Java program?
class box
int width;
int height;
int length;
int volume;
void volume()
volume = width*height*length;
class Output
public static void main(String args[])
box obj = new box();
[Link] = 1;
[Link] = 5;
[Link] = 5;
[Link]();
[Link]([Link]);
a)0
b)1
c)25
d)26
[Link] will be the output of the following Java code?
class overload
int x;
int y;
void add(int a)
x = a + 1;
void add(int a, int b)
x = a + 2;
class Overload_methods
public static void main(String args[])
overload obj = new overload();
int a = 0;
[Link](6);
[Link](obj.x);
a)5
b)6
c)7
d)8
[Link] will be the output of the following Java program?
class box
int width;
int height;
int length;
int volume;
void volume(int height, int length, int width)
volume = width*height*length;
class Prameterized_method
public static void main(String args[])
{
box obj = new box();
[Link] = 1;
[Link] = 5;
[Link] = 5;
[Link](3,2,1);
[Link]([Link]);
a)0
b)1
c)6
d)25
[Link] is the process of defining two or more methods within same class
that have same name but different parameters declaration?
a)Method overloading
b)method overririding
c)method hiding
d)none of the mentioned
[Link] will be the output of the following Java program?
class area
int width;
int length;
int volume;
area()
{
width=5;
length=6;
void volume()
volume = width*length*height;
class cons_method
public static void main(String args[])
area obj = new area();
[Link]();
[Link]([Link]);
a)0
b)1
c)30
d)Error
[Link] will be the output of the following Java program?
class equality
int x;
int y;
boolean isequal()
return(x == y);
class Output
public static void main(String args[])
equality obj = new equality();
obj.x = 5;
obj.y = 5;
[Link]([Link]());
a)false
b)true
c)0
d)1
[Link] will be the output of the following Java code?
class area
int width;
int length;
int area;
void area(int width, int length)
[Link] = width;
[Link] = length;
class Output
public static void main(String args[])
area obj = new area();
[Link](5 , 6);
[Link]([Link] + " " + [Link]);
a)0 0
b)5 6
c)6 5
d)5 5
[Link] is the process of defining more than one method in a class
differentiated by method signature?
a)Function overriding
b)Function overloading
c)Function doubling
d)None of the mentioned
[Link] will be the output of the following Java program?
class array_output {
public static void main(String args[])
char array_variable [] = new char[10];
for (int i = 0; i < 10; ++i) {
array_variable[i] = 'i';
[Link](array_variable[i] + "" );
i++;
a)i i i i i
b)0 1 2 3 4
c)i j k l m
d)None of the mentioned
[Link] will be the output of the following Java program?
class mainclass {
public static void main(String args[])
char a = 'A';
a++;
[Link]((int)a);
}
a)66
b)67
c)65
d)64
[Link] will be the output of the following Java code?
class increment {
public static void main(String args[])
int g = 3;
[Link](++g * 8);
a)25
b)24
c)32
d)33
[Link] of these coding types is used for data type characters in Java?
a)ASCII
b)ISO-LATIN-1
c)UNICODE
d)None of the mentioned
[Link] will be the output of the following Java code?
class booloperators {
public static void main(String args[])
boolean var1 = true;
boolean var2 = false;
[Link]((var1 & var2));
a)0
b)1
c)true
d)false
[Link] will be the output of the following Java code?
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];
[Link](result/6);
}
a)16.34
b)16.566666644
c)16.46666666666667
d)16.46666666666666
[Link] one is a valid declaration of a boolean?
a)boolean b1 = 1;
b)boolean b2 = ‘false’;
c)boolean b3 = false;
d)boolean b4 = ‘true’
[Link] will be the output of the following Java program?
class mainclass {
public static void main(String args[])
boolean var1 = true;
boolean var2 = false;
if (var1)
[Link](var1);
else
[Link](var2);
a)0
b)1
c)true
d)false
[Link] is the range of short data type(16 bits in memory) in Java?
a)-128 to 127
b)-32768 to 32767
c)-2147483648 to 2147483647
d)None of the mentioned
[Link] will be the output of the following Java code?
class asciicodes {
public static void main(String args[])
char var1 = 'A';
char var2 = 'a';
[Link]((int)var1 + " " + (int)var2);
a)162
b)65 97
c)67 95
d)66 98
[Link] is the range of byte data type(6 bits in memory) in Java?
a)-128 to 127
b)-32768 to 32767
c)-2147483648 to 2147483647
d)None of the mentioned
[Link] will be the output of the following Java code?
class area {
public static void main(String args[])
double r, pi, a;
r = 9.8;
pi = 3.14;
a = pi * r * r;
[Link](a);
a)301.5656
b)301
c)301.56
d)301.56560000
[Link] overriding is combination of inheritance and polymorphism?
a)True
b)False
[Link] is use of interpreter?
a)They convert bytecode to machine language code
b)They read high level code and execute them
c)They are intermediated between JIT and JVM
d)It is a synonym for JIT
[Link] concept of Java is achieved by combining methods and attribute
into a class?
a)Encapsulation
b)Inheritance
c)Polymorphism
d)Abstraction
[Link]("The result "+result + " is of type " +
((Object)result).getClass().getSimpleName());