0% found this document useful (0 votes)
12 views2 pages

STD 10 - Q Ans

The document discusses exceptions in Java, including the use of keywords like 'throws', 'try', 'catch', and 'finally' for exception handling. It explains the concept of streams, differentiating between character and byte streams, and introduces library classes and wrapper classes in Java. Additionally, it lists common exceptions and emphasizes the importance of revising previous topics for exam preparation.

Uploaded by

shauryabihany
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

STD 10 - Q Ans

The document discusses exceptions in Java, including the use of keywords like 'throws', 'try', 'catch', and 'finally' for exception handling. It explains the concept of streams, differentiating between character and byte streams, and introduces library classes and wrapper classes in Java. Additionally, it lists common exceptions and emphasizes the importance of revising previous topics for exam preparation.

Uploaded by

shauryabihany
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Exceptions : “Exceptions” are anomalies Q> What is the use of “throws”?

that occur at run-time. Run-time


anomalies include conditions like Ans> The “throws” keyword is used by a
division by zero, falling short of memory, function to i nform the program that a
exceeding the bounds of an array, run-time error has occurred . It is applied
inability to open a file etc. with the function signature.

Exception Handling : E xception -Handling Q> What is the use of “try”?


involves mechanisms to detect the Ans> The “try” block is used to specify
occurrences of run-time anomalies and such statements that may cause an
report them to the prog ram so that the exception at run-time.
program may guard itself from the
anomalies by taking appropriate
measures.

* Java provides the foll owing keywords Q> What is the use of the “finally”
for performing exception - handling block?
operations : - Ans> The “finally” block is used to
(a) try (b) catch (c) throws specify such statements that are to be
(d) finally executed by the JVM irrespective of
whether an exceptio n has occurred or
not.

Q> What is an exception handler? Common Exceptions defined in Java


Ans> An Exception Handler is a block of
code which is used to tack le a particular IOException
exception that may be generated during
ArithmeticException
the executio n of a pro gram.
OutOfMemo ryError
The Exception Han dler i.e. the “catch”
block immediately follow s the “try” ArrayIndexOutOfBoundsException
block.
NullPointerExceptio n

StringIndexOutOfBoundsException

FileNotFoundExceptio n

MethodNotFoundException

NumberFormatException

InputMismatchException

1
Q> What are streams in Java?
Ans> A stream implies a flow of data between the RAM, CPU and I/O devices.
Java has three stream s : -
(a) System.in, which is related to the keybo ard and is used for accepting data at run -
time.
(b) System.o ut, which is related to the VDU and is used to display th e output.
(c) System.out, which is also related to the VDU and is used to display error -messages.

Q> What are Character and Byte Streams in Java?


Ans> Character streams are streams that allow users to avail character -encoding
facilities. They are also referred to as Reader and Writer streams.
Byte streams are streams that allow any type of data to be processed in terms of bytes.
Byte streams are used when character -encoding is not required.

Q> What are library classes? Give two examples.


Ans> The in-built classes available as part of the Java language system are referred to
as Library Classes. Ex: Math, Scanner.

Q> What are wrapper -classes?


Ans> Wrapper -classes are in -built classes o f the Java language system and provide a
mechanism to s tore a primitive value as an object.

Every primitive data -type has a corresponding wrapper -class wherein the primitive
data-type always begins with a lower -case letter while its correspo nding wrapper -class
begins with an upper -case letter.
Data-Type Wrapper-Class

char Character

byte Byte

short Short

int Integer

long Long

float Float

double Double

The wrapper -classes are defined in the ‘java.lang’ package and are used to : -
i> Represent primitive values as objects.
ii> To perform conversions between strings and primitive data -types.

Students must also thoroughly revise the topics covered in Std -IX
as part of their Board-Exam preparations.

You might also like