Q201
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
11/16
Page
Pick an option on a question to see the right answer and solution.
Q201
Open questionSelect an option to see the answer and solution.
Q202
Open questionimport java.io.*;
class filesinputoutput
{
public static void main(String args[])
{
InputStream obj = new FileInputStream("inputoutput.java");
System.out.print(obj.available());
}
}Select an option to see the answer and solution.
Q203
Open questionSelect an option to see the answer and solution.
Q204
Open questionSelect an option to see the answer and solution.
Q205
Open questioninterface calculate
{
void cal(int item);
}
class displayA implements calculate
{
int x;
public void cal(int item)
{
x = item * item;
}
}
class displayB implements calculate
{
int x;
public void cal(int item)
{
x = item / item;
}
}
class interfaces
{
public static void main(String args[])
{
displayA arr1 = new displayA;
displayB arr2 = new displayB;
arr1.x = 0;
arr2.x = 0;
arr1.cal(2);
arr2.cal(2);
System.out.print(arr1.x + " " + arr2.x);
}
}Select an option to see the answer and solution.
Q206
Open questionimport java.io.*;
class files
{
public static void main(String args[])
{
File obj = new File("/java/system");
System.out.print(obj.getParent());
System.out.print(" " + obj.isFile());
}
}Select an option to see the answer and solution.
Q207
Open questionSelect an option to see the answer and solution.
Q208
Open questionclass Output
{
public static void main(String args[])
{
Double y = new Double(257.57812);
Double i = new Double(257.578123456789);
try
{
int x = i.compareTo(y);
System.out.print(x);
}
catch(ClassCastException e)
{
System.out.print("Exception");
}
}
}Select an option to see the answer and solution.
Q209
Open questionpublic class BoxDemo
{
public static <U> void addBox(U u, java.util.List<Box<U>> boxes)
{
Box<U> box = new Box<>();
box.set(u);
boxes.add(box);
}
public static <U> void outputBoxes(java.util.List<Box<U>> boxes)
{
int counter = 0;
for (Box<U> box: boxes)
{
U boxContents = box.get();
System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]");
counter++;
}
}
public static void main(String[] args)
{
java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>();
BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes);
BoxDemo.outputBoxes(listOfIntegerBoxes);
}
}Select an option to see the answer and solution.
Q210
Open questionimport java.util.*;
class LOCALE_CLASS
{
public static void main(String args[])
{
Locale obj = new Locale("HINDI", "INDIA") ;
System.out.print(obj.getCountry());
}
}Select an option to see the answer and solution.
Q211
Open questionimport java.lang.System;
class Output
{
public static void main(String args[])
{
byte a[] = { 65, 66, 67, 68, 69, 70 };
byte b[] = { 71, 72, 73, 74, 75, 76 };
System.arraycopy(a, 2, b, 3, a.length - 4);
System.out.print(new String(a) + " " + new String(b));
}
}Select an option to see the answer and solution.
Q212
Open questionSelect an option to see the answer and solution.
Q213
Open questionSelect an option to see the answer and solution.
Q214
Open questionSelect an option to see the answer and solution.
Q215
Open questionSelect an option to see the answer and solution.
Q216
Open questionSelect an option to see the answer and solution.
Q217
Open questionSelect an option to see the answer and solution.
Q218
Open questionSelect an option to see the answer and solution.
Q219
Open questionSelect an option to see the answer and solution.
Q220
Open questionSelect an option to see the answer and solution.