Q181
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
309
Questions
10/16
Page
Pick an option on a question to see the right answer and solution.
Q181
Open questionSelect an option to see the answer and solution.
Q182
Open questionclass X
{
int a;
double b;
}
class Y extends X
{
int c;
}
class Output
{
public static void main(String args[])
{
X a = new X();
Y b = new Y();
Class obj;
obj = b.getClass();
System.out.print(obj.getSuperclass());
}
}Select an option to see the answer and solution.
Q183
Open questionclass Output
{
public static void main(String args[])
{
int x = 3.14;
int y = (int) Math.abs(x);
System.out.print(y);
}
}Select an option to see the answer and solution.
Q184
Open questionSelect an option to see the answer and solution.
Q185
Open questionSelect an option to see the answer and solution.
Q186
Open questionSelect an option to see the answer and solution.
Q187
Open questionSelect an option to see the answer and solution.
Q188
Open questionSelect an option to see the answer and solution.
Q189
Open questionSelect an option to see the answer and solution.
Q190
Open questionclass newthread implements Runnable
{
Thread t;
newthread()
{
t = new Thread(this,"My Thread");
t.start();
}
public void run()
{
System.out.println(t.getName());
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}Select an option to see the answer and solution.
Q191
Open questionSelect an option to see the answer and solution.
Q192
Open questionclass exception_handling
{
public static void main(String args[])
{
try
{
int a = args.length;
int b = 10 / a;
System.out.print(a);
try
{
if (a == 1)
a = a / a - a;
if (a == 2)
{
int c = {1};
c[8] = 9;
}
}
catch (ArrayIndexOutOfBoundException e)
{
System.out.println("TypeA");
}
catch (ArithmeticException e)
{
System.out.println("TypeB");
}
}
}Select an option to see the answer and solution.
Q193
Open questioninterface calculate
{
void cal(int item);
}
class display implements calculate
{
int x;
public void cal(int item)
{
x = item * item;
}
}
class interfaces
{
public static void main(String args[])
{
display arr = new display;
arr.x = 0;
arr.cal(2);
System.out.print(arr.x);
}
}Select an option to see the answer and solution.
Q194
Open questionSelect an option to see the answer and solution.
Q195
Open questionSelect an option to see the answer and solution.
Q196
Open questionpackage pkg;
class output
{
public static void main(String args[])
{
StringBuffer s1 = new StringBuffer("Hello World");
s1.insert(6 , "Good ");
System.out.println(s1);
}
}Select an option to see the answer and solution.
Q197
Open questionimport java.io.*;
public class filesinputoutput
{
public static void main(String[] args)
{
String obj = "abc";
byte b[] = obj.getBytes();
ByteArrayInputStream obj1 = new ByteArrayInputStream(b);
for (int i = 0; i < 2; ++ i)
{
int c;
while ((c = obj1.read()) != -1)
{
if (i == 0)
{
System.out.print(Character.toUpperCase((char)c));
}
}
}
}
}Select an option to see the answer and solution.
Q198
Open questionOptions are not available for this question.
Select an option to see the answer and solution.
Q199
Open questionSelect an option to see the answer and solution.
Q200
Open questionclass Output
{
public static void main(String args[])
{
double x = 102;
double y = 5;
double z = Math.IEEEremainder(x, y);
System.out.print(z);}
}
}Select an option to see the answer and solution.