JAVA
Question 1 |
Which of the following features is the best to support JAVA application development distributed across a network of Java Virtual machines?
Remove Method Invocation (RMI) | |
Remote Procedure Calls (RPC) | |
Multicast sockets | |
Remote Method Invocation (RMI) or Remote Procedure Calls (RPC) |
Question 2 |
Which of this process occur automatically by JAVA run time system?
Serialization | |
Garbage collection | |
File Filtering | |
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
Returns a pointer to a variable
| |
Creates a variable called new | |
Obtains memory for a new variable | |
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
Refer to current class object | |
Refer to static method of the class
| |
Refer to parent class object | |
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 ______.
Symmetric | |
Asymmetric | |
Synchronous | |
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.
→ 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?
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?
f1.setClear(true); | |
f1.setVisible(true); | |
f1.setlook(true); | |
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?
Date::Date(int dd) {/*...*/} | |
explicit Date::Date(int dd) {/*...*/} | |
Such a constructor cannot be defined | |
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()
{
}
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:
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)-(I), (B)-(II), (C)-(III), (D)-(IV) | |
(A)-(II), (B)-(I), (C)-(III), (D)-(IV) | |
(A)-(III), (B)-(I), (C)-(II), (D)-(IV) | |
(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?
switch(x)
{
default;
system.out.println(“Hello”);
}
Which of the following data types are acceptable for x?
Byte and char | |
Long and char | |
Char and float | |
Byte and float |
Question 9 Explanation:
The possible values are either integer constant or character constant.No other data type values are allowed.