Sign Up

Sign In

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Sorry, you do not have permission to ask a question, You must login to ask a question.

SIKSHAPATH Latest Articles

NPTEL Programming In Java Week 7 Assignment Answers 2022

Students, it’s time to reveal the hint of programming in java NPTEL week 7 assignment answers. And, identify where you can improve your marks in this assignment.

NPTEL banner to Programming in Java Assignment

NPTEL Programming In Java Week 7 Assignment Answers

Q1. Which of these is method for testing whether the specified element is a file or a directory?

a. IsFile()

b. isFile()
c. Isfile()

d. isfile()

Answer: b. isFile()

1000+ Students are taking advantage of instant notifications on telegram.


Q2. Which of the following is/are NOT Standard Stream(s)?

a. System.in

b. System.out

c. System.err

d. System.console

Answer: d. System.console


Q3. What will be the output of the Java code?

import java.io.*;
public class question 
{
  public static void main(String args[]) 
  {
  File obj = new File(" NPTEL/JULY/2022");
   System.out.print (obj.getName()); 
  }
}

a. NPTEL

b. NPTEL/JULY/2022

c. /NPTEL/JULY/2022

d. 2022

Answer: d. 2022


Q4. What will be the output if the below program is executed?

import java.io.*;
public class Question {
public static void main(String[] args)
{
try {
PrintWriter writer = new PrintWriter(System.out);
writer.write("10"+ 6);
writer.close();
}
catch (Exception e) {
System.out.println(e);
}
}
}

a. It will give compile-time error

b. It will give run-time error

c. j

d. 106

Answer: d. 106


Q5. Which method is used to write a byte to the current output stream?

a. public void write(int b) throws IOException

b. public void write(byte[] b) throws IOException

c. public void flush()throws IOException

d. public void close() throws IOException

Answer: a. public void write(int b) throws IOException


Q6. Which method of RandomAccessFile class reads a line from the file and returns it as aString?

a. WriteInt().

b. readLine()

c. readInt()

d. WriteDouble()

Answer: b. readLine()


Q7. Which of these class is not a member class of java.io package?

a. File

b. PrintStream

c. StringReader

d. Stream

Answer: d. Stream


Q8. Which of the following is/are interface(s) of java.io package?

a. FileReader

b. FileWriter

c. DataOutput

d. DataInput

Answer: c. DataOutput

d. DataInput


Q9. In which Java APIs the classes for handling all IO-streams are defined?

a. java.lang

b. java.util

c. java.io

d. java.awt

Answer: c. java.io


Q10. Consider the following program.

import java.io.*;
public class FileInfo {
public static void main(String args[]) {
File f = new File ("nptel.txt");
System.out.println("length: "+f.length());
}
}

The file nptel.txt when browse with the Notepad text editor. it shows the content, which is shown below.

__________________________nptel.txt__________________________

HELLO

____________________________________________________________

If the program is executed, then what will be the output from the execution?

a. length: 6

b. length: 5

c. length: 0

d. length: 1

Answer: b. length: 5


TELEGRAM FOR NOTIFICATIONClick Here
Follow on Google News (in one click)Click Here

Disclaimer: These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.


Also Available:

NPTEL Programming In Java Week 6 Assignment Answers

NPTEL Java Week 8 Assignment Answers

Related Posts