JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Java interview questions part 8
Java interview questions part 8
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is the use of Observable class?
A. It is used to create global subclasses
B. It is used to create classes that other part of the program can observe
C. It is used to create classes that can be accessed by other parts of program
D. It is used to create methods that can be accessed by other parts of program
Show Correct Answer
Correct Answer is :
It is used to create classes that other part of the program can observe
2. Which of these methods is used to notify observer the change in observed object?
A. update()
B. notify()
C. check()
D. observed()
Show Correct Answer
Correct Answer is :
update()
3. Which of these methods calls update() method?
A. notify()
B. observeObject()
C. updateObserver()
D. notifyObserver()
Show Correct Answer
Correct Answer is :
notifyObserver()
4. Which of these methods is called when observed object has changed?
A. setChanged()
B. update()
C. notifyObserver()
D. all of the mentioned
Show Correct Answer
Correct Answer is :
all of the mentioned
5. Which of these classes can schedule task for execution in future?
A. Thread
B. Timer
C. System
D. Observer
Show Correct Answer
Correct Answer is :
Timer
6. Which of these interfaces is implemented by TimerTask class?
A. Runnable
B. Thread
C. Observer
D. ThreadCount
Show Correct Answer
Correct Answer is :
Runnable
7. Which of these package provides the ability to read and write in Zip format?
A. java.lang
B. java.io
C. java.util.zip
D. java.util.zar
Show Correct Answer
Correct Answer is :
java.util.zip
8. Random is a final class?
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
FALSE
9. How many bits are used for generating random numbers?
A. 32
B. 64
C. 48
D. 8
Show Correct Answer
Correct Answer is :
48
10. Math.random() guarantees uniqueness?
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
FALSE
11. Which class is used to generate random number?
A. java.lang.Object
B. java.util.randomNumber
C. java.util.Random
D. java.util.Object
Show Correct Answer
Correct Answer is :
java.util.Random
12. Which method is used to generate boolean random values in java?
A. nextBoolean()
B. randomBoolean()
C. previousBoolean()
D. generateBoolean()
Show Correct Answer
Correct Answer is :
nextBoolean()
13. What is the return type of Math.random() method?
A. Integer
B. Double
C. String
D. Boolean
Show Correct Answer
Correct Answer is :
Double
14. What is the range of numbers returned by Math.random() method?
A. -1.0 to 1.0
B. -1 to 1
C. 0 to 100
D. 0.0 to 1.0
Show Correct Answer
Correct Answer is :
0.0 to 1.0
15. What would be the output of following code snippet? int a = random.nextInt(15) + 1;
A. Random number between 1 to 15, including 1 and 15
B. Random number between 1 to 15, excluding 15
C. Random number between 1 to 15, excluding 1
D. Random number between 1 to 15, excluding 1 and 15
Show Correct Answer
Correct Answer is :
Random number between 1 to 15, including 1 and 15
16. What would be the output of following code snippet? int a = random.nextInt(7) + 4;
A. Random number between 4 to 7, including 4 and 7
B. Random number between 4 to 7, excluding 4 and 7
C. Random number between 4 to 10, excluding 4 and 10
D. Random number between 4 to 10, including 4 and 10
Show Correct Answer
Correct Answer is :
Random number between 4 to 10, including 4 and 10
17. What is the signature of Math.random() method?
A. public static double random()
B. public void double random()
C. public static int random()
D. public void int random()
Show Correct Answer
Correct Answer is :
public static double random()
18. Which of these packages contains all the event handling interfaces?
A. java.lang
B. java.awt
C. java.awt.event
D. java.event
Show Correct Answer
Correct Answer is :
java.awt.event
19. Which of these interfaces handles the event when a component is added to a container?
A. ComponentListener
B. ContainerListener
C. FocusListener
D. InputListener
Show Correct Answer
Correct Answer is :
ContainerListener
20. Which of these interfaces define a method actionPerformed()?
A. ComponentListener
B. ContainerListener
C. ActionListener
D. InputListener
Show Correct Answer
Correct Answer is :
ActionListener
Similar Interview Questions
Search for latest jobs
Find Jobs