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

Q31.
Which of these methods can be used to output a string in an applet?
Discuss
Answer: (c).drawString()
Q32.
Which of these methods is a part of Abstract Window Toolkit (AWT) ?
Discuss
Answer: (b).paint()
Q33.
Which of these modifiers can be used for a variable so that it can be accessed from any thread or parts of a program?
Discuss
Answer: (b).volatile
Q34.
Which of these operators can be used to get run time information about an object?
Discuss
Answer: (c).instanceof
Q35.
What is the Message is displayed in the applet made by this program?
    import java.awt.*;
    import java.applet.*;
    public class myapplet extends Applet
    {
        public void paint(Graphics g)
        {
            g.drawString("A Simple Applet", 20, 20);    
        }
    }
Discuss
Answer: (a).A Simple Applet
Q36.
What is the length of the application box made by this program?
    import java.awt.*;
    import java.applet.*;
    public class myapplet extends Applet
    {
        public void paint(Graphics g)
        {
            g.drawString("A Simple Applet", 20, 20);    
        }
    }
Discuss
Answer: (a).20
Q37.
What is the length of the application box made by this program?
    import java.awt.*;
    import java.applet.*;
    public class myapplet extends Applet
    {
        Graphic g;
        g.drawString("A Simple Applet", 20, 20);    
    }
Discuss
Answer: (c).Compilation Error
Q38.
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
Q39.
What is the output of this program?
    class output
    {
        public static void main(String args[])
        { 
           StringBuffer s1 = new StringBuffer("Hello");
           s1.setCharAt(1,x);
           System.out.println(s1);
        }
    }
Discuss
Answer: (c).Hxllo
Q40.
What is the output of this program if input given is “abc’def/’egh”?
    class Input_Output
    {
        public static void main(String args[]) throws IOException
        {	 
            char c;
            BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
            do
            {
                c = (char) obj.read();
	        System.out.print(c);
            } while(c != '\'');
        }
    }
Discuss
Answer: (a).abc’
Page 4 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!