JAVA

Question 1
In Java, when we implement an interface method, it must be declared as:
A
Private
B
Protected
C
Public
D
Friend
Question 2
Which one of the following is correct?
A
Java applets can not be written in any programming language
B
An applet is not a small program
C
An applet can be run on its own
D
Applets are embedded in another applications
Question 3
Which of the following statements is/are TRUE regarding JAVA ? (a) Constants that cannot be changed are declared using the ‘static’ keyword. (b) A class can only inherit one class but can implement multiple interfaces.
A
Only (a) is TRUE.
B
Only (b) is TRUE.
C
Both (a) and (b) are TRUE.
D
Neither (a) nor (b) are TRUE.
Question 3 Explanation: 
FALSE: Constants that cannot be changed are declared using the ‘static’ keyword.
TRUE: A class can only inherit one class but can implement multiple interfaces.
Question 4
Which of this process occur automatically by JAVA run time system?
A
Serialization
B
Garbage collection
C
File Filtering
D
All the given options
Question 4 Explanation: 
Serialization and deserialization occur automatically by java runtime system, Garbage collection also occur automatically but is done by CPU or the operating system not by the java runtime system
Question 5
The ‘new’ operator in JAVA
A
Returns a pointer to a variable
B
Creates a variable called new
C
Obtains memory for a new variable
D
Tells how much memory is available
Question 5 Explanation: 
“new” operator in java is used to create a new object. And an object is nothing but an instance of a class. Some memory is allocated to each object for its execution. Hence option(C) is the correct answer.
Question 6
“this” keyword in JAVA is used to
A
Refer to current class object
B
Refer to static method of the class
C
Refer to parent class object
D
Refer to static variable of the class
Question 6 Explanation: 
“this” is a reference variable that refers to the current object of the class.
Question 7
Which of the following features is the best to support JAVA application development distributed across a network of Java Virtual machines?
A
Remove Method Invocation (RMI)
B
Remote Procedure Calls (RPC)
C
Multicast sockets
D
Remote Method Invocation (RMI) or Remote Procedure Calls (RPC)
Question 8
Java Virtual Machine (JVM) is used to execute architectural neutral byte code. Which of the following is needed by the JVM for execution of Java Code?
A
Class loader only
B
Class loader and Java Interpreter
C
Class loader, Java Interpreter and API
D
Java Interpreter only
Question 9
If a constructor 'Date' is declared explicitly and has to be defined outside the class, which of the following is correct?
A
Date::Date(int dd) {/*...*/}
B
explicit Date::Date(int dd) {/*...*/}
C
Such a constructor cannot be defined
D
Constructor always has to be defined inside the class
Question 9 Explanation: 
Defining a Constructor Outside of the Class :Although the constructor can be defined outside of the class, it must be declared inside class. Use the scope resolution operator while defining a constructor outside of the class.
class class_name {
public:
class_name();
};

// Defining a Constructor Outside of the Class by using :: operator
class_name::class_name()
{
}
There are 9 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access