Menu
Popular Courses
Search

MCQs


Total Questions : 9
Question 1. Which of these methods can be used to output a sting in an applet?
  1.    display()
  2.    print()
  3.    drawString()
  4.    transient()
 Discuss Question
Answer: Option C. -> drawString()


drawString() method is defined in Graphics class, it is used to output a string in an applet.


Question 2. Which of these functions is called to display the output of an applet?
  1.    display()
  2.    print()
  3.    displayApplet()
  4.    PrintApplet()
 Discuss Question
Answer: Option B. -> print()


Whenever the applet requires to redraw its output, it is done by using method paint().


Question 3. Which of these methods is a part of Abstract Window Toolkit (AWT) ?
  1.    display()
  2.    print()
  3.    drawString()
  4.    transient()
 Discuss Question
Answer: Option B. -> print()


paint() is an abstract method defined in AWT.


Question 4. What does AWT stands for?
  1.    All Window Tools
  2.    All Writing Tools
  3.    Abstract Window Toolkit
  4.    Abstract Writing Toolkit
 Discuss Question
Answer: Option C. -> Abstract Window Toolkit


AWT stands for Abstract Window Toolkit, it is used by applets to interact with the user.


Question 5. Which of these modifiers can be used for a variable so that it can be accessed from any thread or parts of a program?
  1.    transient
  2.    volatile
  3.    global
  4.    No modifier is needed
 Discuss Question
Answer: Option B. -> volatile


The volatile modifier tells the compiler that the variable modified by volatile can be changed unexpectedly by other part of the program. Specially used in situations involving multithreading.


Question 6. Which of these operators can be used to get run time information about an object?
  1.    getInfo
  2.    Info
  3.    instanceof
  4.    getinfoof
 Discuss Question
Answer: Option C. -> instanceof


instanceof


Question 7. 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);    }
  1.    20
  2.    Default value
  3.    Compilation Error
  4.    Runtime Error
 Discuss Question
Answer: Option C. -> Compilation Error


To implement the method drawString we need first need to define abstract method of AWT that is paint() method. Without paint() method we can not define and use drawString or any Graphic class methods.


Question 8. 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);    }}
  1.    20
  2.    50
  3.    100
  4.    System dependent
 Discuss Question
Answer: Option A. -> 20


the code in pain() method “ g.drawString("A Simple Applet,20,20); draws a applet box of length 20 and width 20.


Question 9. 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);    }}
  1.    A Simple Applet
  2.    A Simple Applet 20 20
  3.    Compilation Error
  4.    Runtime Error
 Discuss Question
Answer: Option A. -> A Simple Applet


A Simple Applet


Share this page with your friends!

Share this page with your friends!

Latest Videos

Chapter 1 - GLOBAL STEEL SCENARIO & INDI Part 1 : (13-04-2024) INDUSTRY AND COMPANY AWARENESS (ICA)
Direction Sense Test Part 1 Reasoning (Hindi)
Chapter 1 - RMHP / OHP / OB & BP Part 1 : (14-02-2024) GPOE
Cube & Cuboid Part 1 Reasoning (Hindi)
Data Interpretation (DI) Basic Concept Reasoning (Hindi)
Counting Figures Part 1 Counting Of Straight Lines Reasoning (Hindi)
Real Numbers Part 7 Class 10 Maths
Real Numbers Part 1 Class 10 Maths
Polynomials Part 1 Class 10 Maths

Latest Test Papers

Chapter 3.1 : Overview of Finance & Acco Chapter 3 : Finance & Accounts SAIL E0 - GFM 2024
Chapter 2.1 : Overview Chapter 2 : Materials Management SAIL E0 - GFM 2024
Chapter 1.1 : Personnel Functions- An ov Chapter 1 : Personnel Management SAIL E0 - GFM 2024
GPOE / GPA Combined 1 Free CBT Mock Test SAIL E0 2024
CBT Mixed Test 1 GPOE/GPA SAIL E0 2024