adplus-dvertising

Welcome to the java lang and java io MCQs Page

Dive deep into the fascinating world of java lang and java io with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of java lang and java io, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of java lang and java io, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through java lang and java io. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of java lang and java io. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

java lang and java io MCQs | Page 7 of 26

Q61.
What is the output of this program?
    import java.io.*;
    class files 
    {
        public static void main(String args[]) 
        {
            File obj = new File("/java/system");
            System.out.print(obj.canWrite());
            System.out.print(" " + obj.canRead());
        }
    }
Discuss
Answer: (d).false false
Q62.
What is the output of this program?
    import java.io.*;
    class files 
    {
        public static void main(String args[]) 
        {
            File obj = new File("/java/system");
            System.out.print(obj.getParent());
            System.out.print(" " + obj.isFile());
        }
    }
Discuss
Answer: (c).\java false
Q63.
Which of these class is used to read and write bytes in a file?
Discuss
Answer: (c).FileInputStream
Q64.
Which of these method of InputStream is used to read integer representation of next available byte input?
Discuss
Answer: (a).read()
Q65.
Which of these data type is returned by every method of OutputStream?
Discuss
Answer: (d).none of the mentioned
Q66.
Which of these is a method to clear all the data present in output buffers?
Discuss
Answer: (b).flush()
Q67.
Which of these method(s) is/are used for writing bytes to an outputstream?
Discuss
Answer: (b).print() and write()
Q68.
What is the output of this program?
Note: inputoutput.java is stored in the disk.
    import java.io.*;
    class filesinputoutput 
    {
        public static void main(String args[]) 
        {
            InputStream obj = new FileInputStream("inputoutput.java");
            System.out.print(obj.available());
        }
    }
Discuss
Answer: (c).prints number of bytes in file
Q69.
What is the output of this program?
    import java.io.*;
    public class filesinputoutput 
    {
     public static void main(String[] args) 
        {
     String obj  = "abc";
           byte b[] = obj.getBytes();
           ByteArrayInputStream obj1 = new ByteArrayInputStream(b);
           for (int i = 0; i < 2; ++ i) 
           {
               int c;
               while ((c = obj1.read()) != -1) 
               {
                if(i == 0) 
                   {
                    System.out.print((char)c); 
                }
               }
           }
        }
    }
Discuss
Answer: (a).abc
Q70.
Which of these stream contains the classes which can work on character stream?
Discuss
Answer: (c).Character Stream

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!