1. Who founded Java Programming?
a) Guido van Rossum
b) James Gosling
c) Dennis Ritchie
d) Bjarne Stroustrup
Answer: b
Solution: The Java program was developed by James Gosling at Sun Microsystems in 1995.
James Gosling is known as the father of Java.
2. What part is used to compile, debug and execute java programs?
a) JRE
b) JIT
c) JDK
d) JVM
Answer: c
Solution: JDK is an integral part of the Java Area and provides all the tools, binary needed to
integrate, debug and launch the Java Program.
3. What difference does it make when java is out of memory?
a) MemoryError
b) OutOfMemoryError
c) MemoryOutOfBoundsException
d) MemoryFullException
Answer: b
Solution: The Xms flag has no default value, and Xmx typically has a default value of
256MB. A common use of these flags is when you encounter java.lang.OutOfMemoryError.
4. Which of these selection statements in Java do you have?
a) a break
b) continue
c) for ()
d) if ()
Answer: d
Solution: Continue and break comes under the jump statements, and for falls under the
looping statement.
5. Which of these keywords is used to define interfaces in Java?
a) intf
b) Intf
c) interface
d) Interface
Answer: c
Solution: interface keyword is used to define interfaces in Java.
6. Which of the following is the superclass of all Java classes?
a) Array List
b) Abstract Class
c) Object class
d) String
Answer: c
Definition: The object class is the superclass of all Java classes.
7. Which of the following is not a Java Profiler?
a) JProfiler
b) Eclipse Profile
c) JVM
d) JConsole
Answer: c
Solution: A leak in memory is like holding a solid reference in an object though it will no
longer be needed. Accessible but inanimate objects are considered memory leaks. Various
tools help us to detect memory loss.
8. Which of these packages contains the stack overflow variant in Java?
a) java.io
b) java.system
c) java.lang
d) java.util
Answer: c
Definition: java.lang packages contains the stack overflow variant in Java
9. Which of these statements are wrong about Thread?
a) start () method is used to start a thread function
b) run () method is used to start a thread process before start the () method in special cases
c) The thread can be created using only the runnable interface
d) The thread can be made of a class that extends to the Thread class
Answer: b
Solution: The run () method used to define a code that forms a new string, contains the code
to be used. start () method is used to start the release of the running series (). run () itself has
never been used for series implementation.
10. Which of these keywords is used to block an exception?
a) check
b) throw
c) catch
d) try
Answer: d
Solution: a try is applied to a block that needs to be checked to be different
11. Which of the following is not an access modifier?
a) Protected
b) Void
c) Public
d) Confidential
Answer: b
Solution: Public, private, protected and default by all access controllers.
12. What is the range for the type of char data in Java?
a) 0 to 256
b) -128 to 127
c) 0 to 65535
d) 0 to 32767
Answer: c
Solution: Char takes 16-bit memory, so it supports 216, that is from 0 to 65535.
13. Which section provides for the implementation of the private server side of the
system?
a) Server
b) ServerReader
c) Socket
d) ServerSocket
Answer: d
Solution: ServerSocket is a component of java.net that provides a standalone system
launcher for a third party socket server connection.
14. Which of the following is true of servers?
a) Resources can use the full functionality of Java class libraries
b) The resources operate within the web server's domain, private domain and use the
functionality of the java category libraries
c) Applications run within the web server address area
d) The servlets are independent in one place because they are labeled with java
Answer: b
Solution: Applications run within the web server address area. As it is written in java
independent. Full functionality is available through libraries.
15. What is the expansion of the compiled java classes?
a) .txt
b) .js
c) .class
d) .java
Answer: c
Solution: A compact java file with the extension .class.
16. Arrays in java are-
a. Object References
b. Objects
c. Primitive Data type
d. None
Answer: b. Objects
Solution: Arrays are objects in java. It is a container that holds a fixed number of items
of a single type.
17. Total constructor string class have?
a. 3
b. 7
c. 13
d. 20
Answer: 13
Solution: String class has 13 constructors.
18. Where does the system stores parameters and local variables whenever a method is
invoked?
a. Heap
b. Stack
c. Array
d. Tree
Answer: b. Stack
Solution: The system stores parameters and local variables in a stack.
19. When is the finalize() method called?
a. Before Garbage Collection
b. Before an object goes out of scope
c. Before a variable goes out of scope
d. None
Answer: a. Before Garbage Collection
Solution: finalize() method is called before garbage collection.
20. What is Runnable?
a. Abstract class
b. Interface
c. Class
d. Method
Answer: b. Interface
Solution: Runnable is an interface.