JAVA
Question 1 |
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 2 |
Match the following types of variables with the corresponding programming languages:
(a)-(i), (b)-(iii), (c)-(iv), (d)-(ii) | |
(a)-(iv), (b)-(i), (c)-(iii), (d)-(ii) | |
(a)-(iii), (b)-(i), (c)-(iv), (d)-(ii) | |
(a)-(ii), (b)-(i), (c)-(iii), (d)-(iv)
|
Question 2 Explanation:
Static variables→ Fortran 77
Stack dynamic→ Local variables in Pascal
Explicit heap dynamic→ All objects in JAVA
Implicit heap dynamic→ All variables in APL
Stack dynamic→ Local variables in Pascal
Explicit heap dynamic→ All objects in JAVA
Implicit heap dynamic→ All variables in APL
Question 3 |
Which of this process occur automatically by JAVA run time system?
Serialization | |
Garbage collection | |
File Filtering | |
All the given options |
Question 3 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 4 |
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 4 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 5 |
“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 5 Explanation:
“this” is a reference variable that refers to the current object of the class.
Question 6 |
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 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.
There are 9 questions to complete.
