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?
A
f1.setClear(true);
B
f1.setVisible(true);
C
f1.setlook(true);
D
f1.setclean(true);
Question 2
Match the following types of variables with the corresponding programming languages:



 
A
(a)-(i), (b)-(iii), (c)-(iv), (d)-(ii)
B
(a)-(iv), (b)-(i), (c)-(iii), (d)-(ii)
C
(a)-(iii), (b)-(i), (c)-(iv), (d)-(ii)
D
(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

Question 3
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 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
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 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
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 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?
A
Remove Method Invocation (RMI)
B
Remote Procedure Calls (RPC)
C
Multicast sockets
D
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?
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