Vidyalelo
Java Programming · all questions

Interfaces and Abstract Classes
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

309

Questions

16/16

Page

Pick an option on a question to see the right answer and solution.

Which of these is a method can generate a boolean output?

Select an option to see the answer and solution.

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]));
    }
}

Select an option to see the answer and solution.

Which of these keywords is used to define packages in Java?

Select an option to see the answer and solution.

Which of the following reference types cannot be generic?

Select an option to see the answer and solution.

What will be the output of the following Java code snippet?
int a = random.nextInt(7) + 4;

Select an option to see the answer and solution.

Which of these classes is not included in java.lang?

Select an option to see the answer and solution.

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());
    }
}

Select an option to see the answer and solution.

What will be the output of the following Java program?
class Output
{
    public static void main(String args[]) 
    {
 String x = Boolean.toString(false);
    }
}

Select an option to see the answer and solution.

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));
    }
}

Select an option to see the answer and solution.