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 5 of 6

Q41.
What is the output of this program?
    import java.io.*;
    class Chararrayinput
    {
        public static void main(String[] args)
        {
	    String obj  = "abcdef";
            int length = obj.length();
            char c[] = new char[length];
            obj.getChars(0, length, c, 0);
            CharArrayReader input1 = new CharArrayReader(c);
            CharArrayReader input2 = new CharArrayReader(c, 0, 3);
            int i;
            try
            {
		while((i = input2.read()) != -1)
                {
                    System.out.print((char)i);
                }
       	    } 
            catch (IOException e)
            {
                e.printStackTrace();
	    }
	}
    }
Discuss
Answer: (a).abc
Q42.
What is the output of this program?
    import java.io.*;
    class Chararrayinput
    {
        public static void main(String[] args)
        {
	    String obj  = "abcdefgh";
            int length = obj.length();
            char c[] = new char[length];
            obj.getChars(0, length, c, 0);
            CharArrayReader input1 = new CharArrayReader(c);
            CharArrayReader input2 = new CharArrayReader(c, 1, 4);
            int i;
            int j;
            try 
            {
		while((i = input1.read()) == (j = input2.read()))
                {
                    System.out.print((char)i);
                }
       	    } 
            catch (IOException e)
            {
                e.printStackTrace();
	    }
	}
    }
Discuss
Answer: (d).none of the mentioned
Q43.
An applet is a Java class that extends the
Discuss
Answer: (d).java.applet.Applet class
Q44.
Applets are designed to be embedded within an __________.
Discuss
Answer: (c).HTML
Q45.
Which of the following is required to view an applet?
Discuss
Answer: (c).JVM
Q46.
Which method is automatically called after the browser calls the init method?
Discuss
Answer: (a).start
Q47.
Which method is only called when the browser shuts down normally?
Discuss
Answer: (c).destroy
Q48.
Which method causes the audio clip to replay continually?
Discuss
Answer: (b).public void loop()
Q49.
paint() is an abstract method defined in AWT.
Discuss
Answer: (a).True
Q50.
___________ method is defined in Graphics class, it is used to output a string in an applet.
Discuss
Answer: (c).drawString()
Page 5 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!