13/11/2024, 15:26 Programming in Java - - Unit 8 - Week 5 :
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
vinamrasrivastava112@gmail.com
NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Programming in Java (course)
Course Week 05: Assignment 05
outline The due date for submitting this assignment has passed.
Due on 2024-08-28, 23:59 IST.
About
NPTEL ()
Assignment submitted on 2024-08-28, 21:35 IST
How does an 1) Which exception will be thrown by parseInt() method in Java? 1 point
NPTEL
online a. IntegerOutOfBoundException
course b. IntegerFormatException
work? ()
c. ArithmeticException
Week 0 : () d. NumberFormatException
Yes, the answer is correct.
Week 1 : () Score: 1
Accepted Answers:
d. NumberFormatException
Week 2 : ()
Week 3 : () 2) What will be the output of the following program? 1 point
Week 4 : ()
Week 5 : ()
Lecture 21 :
Interface-II
(unit?
unit=50&lesso
n=51)
Lecture 22 :
Demonstration
-IX (unit?
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=50&assessment=432 1/5
13/11/2024, 15:26 Programming in Java - - Unit 8 - Week 5 :
unit=50&lesso
n=52)
Lecture 23 :
Exception
Handling-I
(unit?
unit=50&lesso
n=53)
Lecture 24 :
Exception
Handling-II
(unit?
unit=50&lesso
n=54)
Lecture 25 :
Exception
Handling-III
(unit?
unit=50&lesso
n=55)
a.
Feedback
Form (unit?
unit=50&lesso
b.
n=56)
Week 05 :
Programming c.
Assignment 1
(/noc24_cs105
/progassignme d. Compilation error
nt?name=381)
Yes, the answer is correct.
Week 05 : Score: 1
Programming Accepted Answers:
Assignment 2
a.
(/noc24_cs105
/progassignme
nt?name=382)
3) What will be the output of the following code? 1 point
Week 05 :
Programming
Assignment 3
(/noc24_cs105
/progassignme
nt?name=383)
Week 05 :
Programming
Assignment 4
(/noc24_cs105
/progassignme
nt?name=384)
Week 05 :
Programming
Assignment 5
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=50&assessment=432 2/5
13/11/2024, 15:26 Programming in Java - - Unit 8 - Week 5 :
(/noc24_cs105 a. 4
/progassignme
nt?name=385)
b. 6
c. 2
Quiz: Week
05: d. 8
Assignment Yes, the answer is correct.
05 Score: 1
(assessment? Accepted Answers:
name=432) a. 4
Week 05 : 4) A method that potentially generates a checked exception must include this keyword 1 point
Assignment in its method signature:
Solution (unit?
unit=50&lesso a. throw
n=438)
b. extend
Week 6 : () c. throws
d. extends
Week 7 : ()
Yes, the answer is correct.
Score: 1
Week 8 : () Accepted Answers:
c. throws
Week 9 : ()
5) Which of the following statements is true about Java's finally block? 1 point
Week 10 : ()
a. The finally block is only executed if an exception is thrown in the try block
Week 11 : () b. The finally block is only executed if an exception is thrown in the catch block
c. The finally block is only executed if an exception is not thrown in the try or catch block
Week 12 : ()
d. The finally block is executed regardless of whether an exception is thrown in the try or
catch block
Books ()
Yes, the answer is correct.
Score: 1
Text
Transcripts () Accepted Answers:
d. The finally block is executed regardless of whether an exception is thrown in the try or catch
block
6) Which of the following statements is true about exception handling in Java: 1 point
a. A try block can have many catch blocks but only one finally block
b. A try block can have many catch blocks and many finally blocks
c. A try block must have one finally block for each catch block
d. A try block must have at least one catch block to have a finally block
Yes, the answer is correct.
Score: 1
Accepted Answers:
a. A try block can have many catch blocks but only one finally block
7) What will be the output of the following program? 1 point
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=50&assessment=432 3/5
13/11/2024, 15:26 Programming in Java - - Unit 8 - Week 5 :
a. Hello
b. World
c. HelloWOrld
d. WorldWorld
Yes, the answer is correct.
Score: 1
Accepted Answers:
d. WorldWorld
8) What will be the output of the following Java code? 1 point
a. Hello
b. World
c. HelloWOrld
d. Compilation Error
Yes, the answer is correct.
Score: 1
Accepted Answers:
c. HelloWOrld
9) What will be the output of the following Java program? 1 point
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=50&assessment=432 4/5
13/11/2024, 15:26 Programming in Java - - Unit 8 - Week 5 :
a. 0 0
b. 2 2
c. 4 1
d. 1 4
Yes, the answer is correct.
Score: 1
Accepted Answers:
c. 4 1
10) Which of the following exceptions is not a subclass of the RuntimeException class? 1 point
a. NullPointerException
b. ArrayIndexOutOfBoundsException
c. IOException
d. ArithmeticException
Yes, the answer is correct.
Score: 1
Accepted Answers:
c. IOException
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=50&assessment=432 5/5