13/11/2024, 15:27 Programming in Java - - Unit 10 - Week 7 :
(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 07: Assignment 07
outline The due date for submitting this assignment has passed.
Due on 2024-09-11, 23:59 IST.
About As per our records you have not submitted this assignment.
NPTEL ()
1) Which of these exception is thrown in cases when the file specified for writing is not 1 point
found?
How does an
NPTEL
a. IOException
online
course b. FileException
work? () c. FileNotFoundException
d. FileInputException
Week 0 : ()
No, the answer is incorrect.
Score: 0
Week 1 : () Accepted Answers:
c. FileNotFoundException
Week 2 : ()
2) Which of these values is returned by read() method is end of file (EOF) is 1 point
Week 3 : () encountered?
Week 4 : () a. 0
b. 1
Week 5 : ()
c. -1
d. Null
Week 6 : ()
No, the answer is incorrect.
Week 7 : () Score: 0
Accepted Answers:
Lecture 31 : I- c. -1
O Stream-II
(unit? 3) What will be the output of the following Java program? 1 point
unit=66&lesso
n=67)
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=66&assessment=436 1/5
13/11/2024, 15:27 Programming in Java - - Unit 10 - Week 7 :
Lecture 32 : I-
O Stream-III
(unit?
unit=66&lesso
n=68)
Lecture 33 :
Demonstration
-XII (unit?
unit=66&lesso
n=69)
Lecture 34 :
Applet
Programming -
I (unit?
unit=66&lesso
n=70)
Lecture 35 : a. abc
Applet
b. abcd
Programming -
II (unit? c. abcde
unit=66&lesso d. abcdef
n=71)
No, the answer is incorrect.
Feedback Score: 0
Form (unit? Accepted Answers:
unit=66&lesso a. abc
n=72)
4) What is the purpose of a ByteArrayOutputStream in Java? 1 point
Quiz: Week
07: a. To write binary data to an output stream
Assignment
b. To read binary data from an input stream
07
(assessment? c. To convert characters to bytes
name=436) d. To store binary data in memory
Week 07 : No, the answer is incorrect.
Programming Score: 0
Assignment 1 Accepted Answers:
(/noc24_cs105 d. To store binary data in memory
/progassignme
nt?name=387) 5) Which method is used to read b length bytes from the input stream into an array? 1 point
Week 07 :
a. public void read(int b)throws IOException{{
Programming
Assignment 2 b. public int read(byte[ ] b)throws IOException{}
(/noc24_cs105 c. public void read(byte[ ] b)throws IOException{}
/progassignme
d. public int read(int b)throws IOException{}
nt?name=398)
No, the answer is incorrect.
Week 07 : Score: 0
Programming Accepted Answers:
Assignment 3 b. public int read(byte[ ] b)throws IOException{}
(/noc24_cs105
/progassignme
6) Which method is used to create a directory with fileattributes? 1 point
nt?name=399)
a. Path.create()
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=66&assessment=436 2/5
13/11/2024, 15:27 Programming in Java - - Unit 10 - Week 7 :
Week 07 : b. Path.createDirectory()
Programming
c. Files.createDirectory(path, fileAttributes)
Assignment 4
(/noc24_cs105 d. Files.create(fileAttributes)
/progassignme No, the answer is incorrect.
nt?name=400) Score: 0
Accepted Answers:
Week 07 :
c. Files.createDirectory(path, fileAttributes)
Programming
Assignment 5 7) What will be the output of the following Java program? 1 point
(/noc24_cs105
/progassignme
nt?name=401)
Week 07 :
Assignment
Solution (unit?
unit=66&lesso
n=441)
Week 8 : ()
Week 9 : ()
Week 10 : ()
Week 11 : () a. 20
b. 100
Week 12 : ()
c. 1000
Books () d. 2
No, the answer is incorrect.
Text Score: 0
Transcripts () Accepted Answers:
a. 20
8) Which class is used to write primitive data types to an output stream in Java? 1 point
a. DataOutputStream
b. ObjectOutputStream
c. OutputStream
d. PrintWriter
No, the answer is incorrect.
Score: 0
Accepted Answers:
a. DataOutputStream
9) What will be the output of the following code? 1 point
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=66&assessment=436 3/5
13/11/2024, 15:27 Programming in Java - - Unit 10 - Week 7 :
a. It will give compile-time error
b. It will give run-time error
c. j
d. 106
No, the answer is incorrect.
Score: 0
Accepted Answers:
c. j
10) What will be the output of the following code. 1 point
file.txt contain "This is Programming in Java online course." (without quotes)
a. 42
b. 35
c. 7
d. 0
No, the answer is incorrect.
Score: 0
Accepted Answers:
a. 42
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=66&assessment=436 4/5
13/11/2024, 15:27 Programming in Java - - Unit 10 - Week 7 :
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=66&assessment=436 5/5