Introduction to the Abstract Windowing Toolkit (AWT) and Swings (24 Marks) ADVANCED JAVA PROGRAMMING MCQ I scheme


CHAPTER 1  : Introduction to the Abstract Windowing Toolkit (AWT) and Swings (24 Marks)


Q1. Which of the following class is derived from the container class?
  (a) Component                     (b) Panel
  (c) MenuComponent                (d) List


Q2.Name of the class used to represent a GUI application window, which is optionally     resizable and can have a title bar, an icon, and menus.
  (a)Window                           (b)Panel
  (c)Dialog                             (d)Frame

Q3.Which abstract class is the super class of all menu related classes?
  (a) MenuComponent         (b )MenuBar
  (c )MenuItem               (d) CheckboxMenuItem

Q4. Which of these classes can be added to a Frame component?
     (a)Menu            (b)Button
     (c)Window          (d)Applet
Q.5 Which can be used to represent a checkbox with a textual label that can appear       in a menu?
      (a)MenuBar                             (b)Menuitem
      (c) CheckboxMenuItem                    (d)Menu

Q.6 Which of these classes can be added to any Container class, using the add method         defined in Container class?
       (a)Button             (b) CheckboxMenuItem
       (c)Menu             (d) MenuBar

Q.7 Package of drawString() method is________
       (a)java.applet           (b)java.io
       (c)javax.swing           (d)java.awt


Q.8 Which methods executes only once?
       (a)start() method       (b)init() method
       (c) stop() method       (d)java.awt

Q.9 Object which can store group of other object is called______
       (a)Collection object        (b)Java object
       (c)Package               (d)Wrapper

Q.10 All collection classes are available in_______
        (a) java.io package          (b)java.lang package
        (c) java.awt package         (d) java.util package

Q.11 Thread class is available in_______
        (a) java.io package          (b)java.lang package
        (c) java.awt package        (d) java.util package

Q. 12 Minimum threads in a program are
     (a)1          (b)2
     (c)5          (d)Many
   
Q. 13 JIT meaning______
     (a)Java In Time     (b)Just In Time
     (c)Join In Time     (d)None of the Above
Q. 14 Program which executes applet is known as_____

     (a)Applet Engine   (b)Virtual machine
     (c)JVM           (d) None of the Above
             
Q. 15 In main()method, data type of parameter is_____
     (a)int         (b)char
     (c)String       (d)double
              
Q. 16 How many keywords (approximately) are available in java?  
(May vary from version to version)  
            (a) 32  (b) 39 
            (c) 48         (d) 115  

Q. 17 Smallest individual unit in java program is known as_____
      (a)String     (b)Literal
      (c)Token     (d)Operator
   
Q. 18 What does A WT stands for? 
      (a)All Writing Tools              (b)Abstract Window Toolkit
      (c) Abstract Writing Toolkit        (d)All Window Tools
      
Q. 19 Which of these methods can be used to know which key is pressed? 
                (a) getModifier()          (b)getActionKey     
(c) getActionEvent()   (d)getKey()

Q. 20 Which of the following statements about GUI components    is wrong? 
(a)  Swing exists since version 1.2 of the jdk 
(b)  You cannot place AWT components on Swing      containers 
(c)  A WT stands for Abstract Window Toolkit     (
d) The AWT classes are deprecated. 

Q. 21 Package is the first program in java. 

    (a) True   (b) False 

Q. 22 What do you mean by javap ? 
             (a) Java disassemble  (b) Java interpreter 
            (c) Java compiler         (d) Java debugger 

Q.  23 JVM is a __ for byte code. 
            (a) Interpreter (b) Disassemble 
             (c) Compiler        (d) Debugger

Q.24 In applet, which of the following is used for accepting user defined parameter?     
   (a) Body        (b)Centre
      (c) Applet       (d)Param
                                                                                  
Q. 25 What is runnable from following: 
                (a) Class               (b) Method 
                (c) Interface       (d) Variable 

Q. 26 Which of the following applet class displays the result of  the applet code on the screen? 
                (a) paintO            (b) voidO 
                (c) stringO          (d) getkeyO 


Q. 27 On which side applet always executed? 
                 (a) Server side  (b) Client side 


Q. 28 Which of the following file is API document? 
                (a) Html               (b) Java  
                (c) Text  (d) Doc 

Q. 29 What is another code for java intermediate code?                 (a) Java code      (b) Byte code 
                (c) Referenee code          (d) None of the above 

Q.  30 Which stage language java is known as ? 
                (a) Zero                (b) Two 
                (c) Four                 (d) Eight  

Q.31 Which keyword is used to implement interface in the class? 
                (a) implements  (b) implement 
                (c) interface             (d) extends  

Q. 32 In java, gc()(i.e. garbage collector) method is available in which package? 
   (a) java.lang      (b)java.io
   (c) java.util       (d)java.awt

Q. 33 Vector class is available in_____
(a) java.io pacakage    (b) java.util package 
 (c) java.lang package  (d) java.sql package  

Q. 34 Which of the following terms are included inside the  package? 
  (a) Classes      (b) Methods 
  (c)Interfaces    (d) All ofthe above. 

Q. 35 Is it possible to write nested try ? 
 (a) Yes  (b) No  

Q. 36 Which method cannot be overridden ? 
  (a) println    (b) printf 
  (c)scanf      (d) final 

Q.37 In which package, thread class is available? 
  (a) Java.util       (b) Java.io 
  (c) Java.lang     (d) Java.awt 

Q.38 Swing components that don’t rely on Native GUI are reffered to as __________
(a)Ligthweight component  (b)heavy weight component
( c) GUI component       ( d) Non GUI component

Q. 39 What is jdb ? 
 (a) Java debugger  (b) Java interpreter
 (c) Java compiler   (d) Java disassemble 

Q. 40 Is it possible to declare method of the interface as private? 
  (a) Yes  (b) No 






Q. 41 Why we need to write static keyword to main method ?  
(a)   It gives access to other methods 
(b)  It is in syntax 
(c)   To create single copy  
(d)  None of the above  


Q.42 "All methods of the interface are public and abstract." 
 (a) True  (b) False 

Q. 43 What is the latest version of jdk ? 
 (a) 1.9  (b)1.7
 (c) 2.0  (d) 1.6 

Q. 44 If a class contains one or more abstract methods then it is  declared as 
  (a) Final      (b)Static
  (c) Abstract   (d) Any of the above 

Q.45 Which of the following command is used to compile java program?
        (a) Java          (b) Javap
        (c) Javaq         (d) Javac

Q46. It is possible to create object of interface?
(a) Yes         (b) No


Q.47. When applet is dead, it automatically invokes the_____method when             We quit the browser.
       (a)Paint()                (b) Stop()
       (c) Destroy()            (d) Final()

Q.48 In which process we create exact copy of the existing object?
         (a) Overriding       (b) Overloading
      (c) Cloning               (d) Cloping


Q.49 Jar stands for______
          (a) Java archived          (b) Java array
          (c) Java architecture     (d) None of the above




Q.50 API stands for______
(a)   Application Programming Infrastructure
(b)  Application Programming Interface
(c)   Advanced Programming Interface
(d)  None of the above 

Q.51.What layout manager should You use so that every component occupies the same size in the container?
(a) a Flow Layout  (b) Grid Layout
( c) Border Layout  (d) any Layout

Q. 52 Executable applet is nothing but __ file of the applet. 
            (a) .txt  (b) .java 
            (c) .class           (d) .html 

Q.53.can you use setBackground() method to set the background color for ____?
(a) Component  (b) Container 
(c ) JComponent  (d) All three

Q. 54 In which package, exception class is available? 
(a) java.lang     (b)java.util
(c) java.io       (d)java.awt

Q.55  Arguments passed via command line are stored as __ data type. 
             (a) argument  (b) double 
            (c) string          (d) integer 

Q. 56 Object which can store group of other object is known  
as 
 (a) Java object       (b) Package 
 (c) Collection object   (d) None of the above


Q. 57 A GUI         _ 
 (a) uses buttons, menus, and icons 
 (b) should be easy for a user to manipulate
 (c) stands for Graphic Use Interaction. 
 (d) Both (a) and (b).  


Q. 58 An object is composed of :  
(a) Properties   (b)Methods
 (c) Events      (d)All of the above


Q. 59 Which is a component in A WT that can contain another  components like buttons, textfields, labels etc. ? 
 (a) Window    (b)Container
 (c) Panel      (d)Frame

Q.60 The Swing component classes that are used in encapsulate  a mutually exclusive set of buttons ?  
(a) AbstractButton     (b) ButtonGroup 
(c)    JButton                (d) ImegeIcon 


Q.61 The Java Foundation Classes (JFC) is a set of GUI  components which simplify the development of desktop  applications?  (a) True    (b)False

Q62.To specify font to be Bold and Italic use font style value
(a) Font .PLAIN   (b) Font. BOLD  
(c) Font.ITALIC     (d) Font.BOLD +Font.ITALIC

Q.63 In Graphics class, Which method is used to set the graphics current color     To the specified color?
a Public abstract void setFont(Font font)
b Public abstract void setColor(Color c) 
c Public abstract void drawString(String str,int x,int y)
d None of the above

Q.64  In Graphics class,which method is used to draws a rectangle with the specified     Width and height?
    (a)public void draw Rect(int x, int y, int width, int height)
    (b)public abstract void fillRect (int x, int y, int width, int height)
    (c)public abstract void drawLine(int x1, int y1, int x2, int y2)
    (d)public abstract void drawOval(int x, int y, int width, int height)

Q.65  Which of the following is used to interpret and execute Java Applet Classes     Hosted by HTML?
    (a)Appletviewer      (b)Appletscreen
    (c)Appletwatcher     (d)Appletshow

Q.66  Which of these classes encapsulate run-time state of an object?
    (a)Class      (b)System
    (c)Runtime   (d)Cache



Q.67  The relationship between a parent class and a child class is referred to     As a(n)_____relationship.
     (a) is-a       (b )was-a
     (c) has-a      (d )instance-of    (e) alias

Q.68 Java does not support multiple inheritance, but some of the abilities of multiple    inheritance are available by________ 
a implementing interfaces 
b creating aliases 
c importing classes 
d using public rather than protected or private modifiers


Q.69 Java applet are used to create_______applications.
    (a)graphical       (b)user interactive
    (c)both (a) and (b)   (d)none of the above

Q.70. The various controls supported by AWT are:
    (a)Labels, push buttons
    (b)Checkboxes, choice list
    (c)Scroll bars, text fields, text area
(d)   All of these

Comments