JAVA

Question 1
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 2
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 2 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 3
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 3 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 4
“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 4 Explanation: 
“this” is a reference variable that refers to the current object of the class.
Question 5
Java uses threads to enable the entire environment to be ______.
A
Symmetric
B
Asymmetric
C
Synchronous
D
Asynchronous
Question 5 Explanation: 
→ Java uses threads to enable the entire environment to be asynchronous.
→ Synchronous (or) Synchronized means "connected", or "dependent" in some way. In other words, two synchronous tasks must be aware of one another, and one task must execute in some way that is dependent on the other, such as wait to start until the other task has completed.
→ Asynchronous means they are totally independent and neither one must consider the other in any way, either in initiation or in execution.
Question 6
In the given Program:
class Dialog1
{
public static void main(String args[])
{
Frame f1=new Frame("INDIA");
f1.setSize(300,300);
f1.setVisible(true);
FileDialog d=new FileDialog(f1, "MyDialog");
d.setVisible(true);
String fname=d.getDirectory()+d.getFile();
System.out.println("The Selection is"+fname);
}
}
To make the Frame visible, which of the following statements are true?
A
f1.setClear(true);
B
f1.setVisible(true);
C
f1.setlook(true);
D
f1.setclean(true);
Question 7
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 7 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()
{
}
Question 8
Match List I with List II:
List I                                                             List II
(A) Localization                                        (I) Encapsulation
(B) Packaging or binding of a collection of items (II) Abstraction
(C) Mechanism that enables designer to focus on essential details of a program component (III) Characteristics of software that indicate the manner in which information is concentrated in a program.
(D) Information hiding                                           (IV) Suppressing the operational details of a program component
Choose the correct answer from the options given below:
A
(A)-(I), (B)-(II), (C)-(III), (D)-(IV)
B
(A)-(II), (B)-(I), (C)-(III), (D)-(IV)
C
(A)-(III), (B)-(I), (C)-(II), (D)-(IV)
D
(A)-(III), (B)-(I), (C)-(IV), (D)-(II)
Question 9
Consider the following code segment in JAVA
switch(x)
{
default;
system.out.println(“Hello”);
}
Which of the following data types are acceptable for x?
A
Byte and char
B
Long and char
C
Char and float
D
Byte and float
Question 9 Explanation: 
The possible values are either integer constant or character constant.No other data type values are allowed.
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