adplus-dvertising

Welcome to the IO and Applets MCQs Page

Dive deep into the fascinating world of IO and Applets with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of IO and Applets, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of IO and Applets, 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 IO and Applets. 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 IO and Applets. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

IO and Applets MCQs | Page 3 of 6

Explore more Topics under Java Programming

Q21.
What is the output of this program?
    class output
    {
        public static void main(String args[])
        { 
           StringBuffer s1 = new StringBuffer("Hello");
           StringBuffer s2 = s1.reverse();
           System.out.println(s2);
        }
    }
Discuss
Answer: (b).olleH
Q22.
Which of these class contains the methods used to write in a file?
Discuss
Answer: (b).FileInputStream
Q23.
Which of these exception is thrown in cases when the file specified for writing is not found?
Discuss
Answer: (c).FileNotFoundException
Q24.
Which of these methods are used to read in from file?
Discuss
Answer: (b).read()
Q25.
Which of these values is returned by read() method is end of file (EOF) is encountered?
Discuss
Answer: (c).-1
Q26.
Which of these exception is thrown by close() and read() methods?
Discuss
Answer: (a).IOException
Q27.
Which of these methods is used to write() into a file?
Discuss
Answer: (c).write()
Q28.
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
Q29.
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(Character.toUpperCase((char)c));
                       obj2.write(1); 
                }
               }
               System.out.print(obj2);
           }
        }
    }
Discuss
Answer: (d).AaBaaCaaa
Q30.
Which of these functions is called to display the output of an applet?
Discuss
Answer: (b).paint()
Page 3 of 6

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!