Telegram Web
✍️✍️......🍃🍃🍃......✍️✍️
Q:) Exception generated in try block is caught in ........... block.
Anonymous Quiz
16%
A. throw
32%
B. throws
44%
C. catch
8%
D. finally
👍5👏2
✍️✍️.......🍃🍃🍃.......✍️✍️
Q:)At runtime, error is recoverable.
Anonymous Quiz
64%
A. True
36%
B. False
👍1👏1😁1
✍️✍️......🍃🍃🍃......✍️✍️
Q:) Which exception is thrown when divide by zero statement executes?
Anonymous Quiz
31%
A. ArithmeticException
36%
B. NullPointerException
27%
C. NumberFormatException
6%
D. None of these
👍6🥰2
✍️✍️......🍃🍃🍃......✍️✍️
Q:) Which exception is thrown when an array element is accessed beyond the array size?
Anonymous Quiz
25%
A. ArrayIndexOutOfBounds
34%
B. ArrayElementOutOfBounds
35%
C. ArrayIndexOutOfBoundsException
6%
D. None of these
👍11👏2🥰1
✍️✍️......🍃🍃🍃......✍️✍️
Q:) In which condition will the finally block will not be executed?
Anonymous Quiz
17%
A. When some Error occurs
29%
B. When Exception is raised
34%
C. When System.Exit(1) is called
20%
D. In all the cases
👍18😁2
✍️✍️......🍃🍃🍃......✍️✍️
Q:) Which of the following statements is correct?
1. The exception is unrecoverable 2. The error is recoverable by debugging.
Anonymous Quiz
12%
A. 1
35%
B. 2
42%
C. 1 and 2
11%
D. neither 1 nor 2
👍151🥰1👏1😁1
👍7
networkmcq.pdf
829.2 KB
networkmcq.pdf
👍10
✍️✍️......🍃🍃🍃......✍️✍️
Java String indexOf()
There are four variants of indexOf() method. This article depicts about all of them, as follows:
1.int indexOf() : This method returns the index within this string of the first occurrence of the specified character or -1, if the character does not occur.
2. int indexOf(char ch, int strt ) : This method returns the index within this string of the first occurrence of the specified character, starting the search at the specified index or -1, if the character does not occur.
3.int indexOf(String str) : This method returns the index within this string of the first occurrence of the specified substring. If it does not occur as a substring, -1 is returned.
4. int indexOf(String str, int strt) : This method returns the index within this string of the first occurrence of the specified substringstarting at the specified index. If it does not occur, -1 is returned. 
 
Join us :-@Compu
👍13
✍️✍️......🍃🍃🍃......✍️✍️
Q: Which of these methods return description of an exception?
Anonymous Quiz
29%
A. getException()
32%
B. getMessage()
30%
C. obtainDescription()
9%
D. obtainException()
👍7🥰4
✍️✍️.....🍃🍃🍃......✍️✍️
Q: Which of these methods is used to print stack trace?
Anonymous Quiz
18%
A. getStackTrace()
37%
B. displayStackTrace()
19%
C. obtainStackTrace()
26%
D. printStackTrace()
👍83
✍️✍️......🍃🍃🍃......✍️✍️
Q: Which of these methods return localized description of an exception?
Anonymous Quiz
20%
A. getMessage()
45%
B. getLocalizedMessage()
26%
C. printLocalizedMessage()
9%
D. obtainLocalizedMessage()
👍12👏41🥰1
✍️✍️......🍃🍃🍃......✍️✍️
In Java, the try-with-resources statement is a try statement that declares one or more resources. The resource is as an object that must be closed after finishing the program. The try-with-resources statement ensures that each resource is closed at the end of the statement execution.

Benefits of using try-with-resources:
More readable code and easy to write.
Automatic resource management.
Number of lines of code is reduced.
No need of finally block just to close the resources.
When multiple resources are opened in try-with-resources, it closes them in the reverse order to avoid any dependency issue.

Join us @Compu
👍12
✍️✍️......🍃🍃🍃......✍️✍️
Q) Which of the following option leads to the portability and security of Java?
Anonymous Quiz
26%
Bytecode is executed by JVM
45%
The applet makes the Java code secure and portable
20%
Use of exception handling
9%
Dynamic binding between objects
👍5👏2😁2
✍️✍️......🍃🍃🍃......✍️✍️
Q) _____ is used to find and fix bugs in the Java programs.
Anonymous Quiz
36%
JVM
33%
JDK
20%
JRE
12%
JDB
👍135👏4🔥1
✍️✍️......🍃🍃🍃......✍️✍️
Q) What is the return type of the hashCode() method in the Object class?
Anonymous Quiz
32%
Object
30%
int
22%
long
16%
void
👍93👏2👎1
Please open Telegram to view this post
VIEW IN TELEGRAM
👍11
👍142🥰2
2025/07/14 10:52:52
Back to Top
HTML Embed Code: