447). Which of these exceptions is thrown by methods of System class?
[A]IOException
[B]SystemException
[C]SecurityException
[D]InputOutputException
Show Answer
Correct Answer: SecurityException
Notes:
Answer: c
Explanation: System class methods throw SecurityException.
448). Which of these methods initiates garbage collection?
[A]gc()
[B]garbage()
[C]garbagecollection()
[D]Systemgarbagecollection()
Show Answer
Correct Answer: gc()
Notes:
Answer: a
Explanation: None.
449). Which of these methods loads the specified dynamic library?
[A] load()
[B]library()
[C] loadlib()
[D] loadlibrary()
Show Answer
Correct Answer: load()
Notes:
Answer: a
Explanation: load() methods loads the dynamic library whose name is specified.
450). Which of these method can set the out stream to OutputStream?
[A]setStream()
[B]setosteam()
[C]setOut()
[D]streamtoOstream()
Show Answer
Correct Answer: setOut()
Notes:
Answer: c
Explanation: None.am()
451). Which of these values are returns under the case of normal termination of a program?
Show Answer
Correct Answer: 0
Notes:
Answer: a
Explanation: None.
452). What will be the output of the following Java program?
import java.lang.System;
class Output
{
public static void main(String args[])
{
long start, end;
start = System.currentTimeMillis();
for (int i = 0; i < 10000000; i++);
end = System.currentTimeMillis();
System.out.print(end - start);
}
}
[A]0
[B]1
[C]1000
[D]System Dependent
Show Answer
Correct Answer: System Dependent
Notes:
Answer: d
Explanation: End time is the time taken by loop to execute it can be any non zero value depending on the System.
Output:$ javac Output.java
$ java Output
78
453). What will be the output of the following Java program?
import java.lang.System;
class Output
{
public static void main(String args[])
{
byte a[] = { 65, 66, 67, 68, 69, 70 };
byte b[] = { 71, 72, 73, 74, 75, 76 };
System.arraycopy(a, 0, b, 0, a.length);
System.out.print(new String(a) + " " + new String(b));
}
}
[A]ABCDEF ABCDEF
[B]ABCDEF GHIJKL
[C] GHIJKL ABCDEF
[D]GHIJKL GHIJKL
Show Answer
Correct Answer: ABCDEF ABCDEF
Notes:
Answer: a
Explanation: System.arraycopy() is a method of class System which is used to copy a string into another string.
Output:
$ javac Output.java
$ java Output
ABCDEF ABCDEF
454). What will be the output of the following Java program?
import java.lang.System;
class Output
{
public static void main(String args[])
{
byte a[] = { 65, 66, 67, 68, 69, 70 };
byte b[] = { 71, 72, 73, 74, 75, 76 };
System.arraycopy(a, 0, b, 3, a.length - 3);
System.out.print(new String(a) + " " + new String(b));
}
}
[A] ABCDEF ABCDEF
[B] ABCDEF GHIJKL
[C]ABCDEF GHIABC
[D]GHIJKL GHIJKL
Show Answer
Correct Answer: ABCDEF GHIABC
Notes:
Answer: c
Explanation: System.arraycopy() is a method of class System which is used to copy a string into another string.
Output:
$ javac Output.java
$ java Output
ABCDEF GHIABC
455). What will be the output of the following Java program?
import java.lang.System;
class Output
{
public static void main(String args[])
{
byte a[] = { 65, 66, 67, 68, 69, 70 };
byte b[] = { 71, 72, 73, 74, 75, 76 };
System.arraycopy(a, 2, b, 3, a.length - 4);
System.out.print(new String(a) + " " + new String(b));
}
}
[A]ABCDEF ABCDEF
[B] ABCDEF GHIJKL
[C] ABCDEF GHIABC
[D]ABCDEF GHICDL
Show Answer
Correct Answer: ABCDEF GHICDL
Notes:
Answer: d
Explanation: System.arraycopy() is a method of class System which is used to copy a string into another string.
Output:
$ javac Output.java
$ java Output
ABCDEF GHICDL
456). What will be the output of the following Java program?
import java.lang.System;
class Output
{
public static void main(String args[])
{
System.exit(5);
}
}
Show Answer
Correct Answer: 5
Notes:
Answer: d
Explanation: None.