1. Which of these is a method can generate a boolean output?
2. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
char a[] = {'a', '5', 'A', ' '};
System.out.print(Character.isDigit(a[0]) + " ");
System.out.print(Character.isWhitespace(a[3]) + " ");
System.out.print(Character.isUpperCase(a[2]));
}
}
class Output
{
public static void main(String args[])
{
char a[] = {'a', '5', 'A', ' '};
System.out.print(Character.isDigit(a[0]) + " ");
System.out.print(Character.isWhitespace(a[3]) + " ");
System.out.print(Character.isUpperCase(a[2]));
}
}
3. Which of these keywords is used to define packages in Java?
4. Which of the following reference types cannot be generic?
5. What will be the output of the following Java code snippet?
int a = random.nextInt(7) + 4;
int a = random.nextInt(7) + 4;
6. Which of these classes is not included in java.lang?
7. What will be the output of the following Java program?
import java.util.*;
class LOCALE_CLASS
{
public static void main(String args[])
{
Locale obj = new Locale("INDIA") ;
System.out.print(obj.getCountry());
}
}
import java.util.*;
class LOCALE_CLASS
{
public static void main(String args[])
{
Locale obj = new Locale("INDIA") ;
System.out.print(obj.getCountry());
}
}
8. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
String x = Boolean.toString(false);
}
}
class Output
{
public static void main(String args[])
{
String x = Boolean.toString(false);
}
}
9. What will be the output of the following Java program?
class 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.isInstance(a));
}
}
class 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.isInstance(a));
}
}
Read More Section(Interfaces and Abstract Classes)
Each Section contains maximum 100 MCQs question on Interfaces and Abstract Classes. To get more questions visit other sections.