JAVA QUIZ
1 .
Which class is used to generate random number?

Correct Answer : Option (B)

java.util.Random
  Show Answer
2 .
Which method is used to generate boolean random values in java?

Correct Answer : Option (A)

nextBoolean()
  Show Answer
3 .
What will be the output of the following Java code snippet?
 
int a = random.nextInt(15) + 1;

Correct Answer : Option (D)

Random number between 1 to 15, including 1 and 15
  Show Answer
4 .
What is the signature of Math.random() method?

Correct Answer : Option (C)

public static double random()
  Show Answer
5 .
Which of these class produce objects with respect to geographical locations?

Correct Answer : Option (B)

Locale
  Show Answer
6 .
Which of these method of Locale class can be used to obtain country of operation?

Correct Answer : Option (D)

getDisplayCountry()
  Show Answer
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("HINDI", "INDIA") ;
            System.out.print(obj.getCountry());
        }
    }

Correct Answer : Option (B)

INDIA
  Show Answer
8 .
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("HINDI") ;
            System.out.print(obj.getDisplayLanguage());
        }
    }

Correct Answer : Option (C)

HINDI
  Show Answer
9 .
Which of these is a mechanism for naming and visibility control of a class and its content?

Correct Answer : Option (B)

Packages
  Show Answer
10 .
Which of the following is the correct way of importing an entire package ‘pkg’?

Correct Answer : Option (C)

import pkg.*
  Show Answer