Saturday, October 29, 2011

Java Interview Questions Part-8(AWT,Event Handling)





Q1.       When we invoke repaint() for a java.awt.Component object, the AWT invokes the method:

A.    update()
B.     draw()
C.    show()
D.    paint()

Q2.       What does the following line of code do?

TextField text = new TextField(10);

A.    Creates text object that can hold 10 rows of text.
B.     Creates the object text and initializes it with the value 10.
C.    Creates text object that can hold 10 columns of text.
D.    The code is illegal.

Q3.       Which of the following applet tags is legal to embed an applet class named Test into a Web page?

A.    < applet class = Test width = 200 height = 100>
B.     < applet> code = Test.class width = 200 height = 100>
C.    < applet code = Test.class width = 200 height = 100>
D.    < applet code = Test.class width = 200 height = 100
E.     < applet param = Test.class width = 200 height = 100>

Q4.       Which of the following methods can be used to draw the outline of a square within a java.awt.Component object?

(A) fillRect()       (B) drawLine()               (C) drawRect()               (D) drawString()         (E) drawPolygon()

A.    (A), (B), (C) & (E)
B.     (A), (B) & (C)
C.    (C), (D) & (E)
D.    (B), (C) & (E)
E.     (B) & (C)

Q5.       Which of the following methods can be used to change the size of a java.awt.Component object?

(A)  dimension() (B)  setSize()                 (C)  area()                     (D)  size()               (E)  resize()

A.    (A), (B), (C) & (E)
B.    (B) & (E)
C.    (A), (B) & (E)
D.    (B), (D) & (E)
E.     (D) & (E)

Q6.       Which of the following methods can be used to remove a java.awt.Component object from the display?

A.    delete()                   B.   remove()                 C.   disappear()                D.   hide()             E.   move()

Q7.       The setBackground() method is part of the following class in java.awt package:

A.     Graphics                 B.   Component                        C.   Applet                       D.   Container         E.   Object

Q8.       Which one of the following is a valid declaration of an applet?

A.    public class MyApplet extends java.applet.Applet {
B.     public Applet MyApplet {
C.    public class MyApplet extends applet implements Runnable {
D.    abstract class MyApplet extends java.applet.Applet {
E.     class MyApplet implements Applet {

Q9.       Which is the method that starts the applet?

A.    main()                     B.   destroy()                 C.  init()                       D.   repaint()

Q10.     What is the difference between a TextArea and a TextField?

A.    A TextArea can handle multiple lines of text
B.     A textarea can be used for output
C.    TextArea is not a class
D.    TextAreas are used for displaying graphics

Q11.     What tags are mandatory when creating HTML to display an applet?

A.     name, height, width
B.      code, name
C.     codebase, height, width
D.     code, height, width

Q12.     What are the Applet’s life cycle methods?

A.   init(), start() and destroy()
B.   init(), start() and paint()
C.   init(), start(), paint(), stop() and destroy()
D.   init(), start() and stop()

Q13.     All Applets must import java.applet and java.awt.

A.    True                       B.   False

Q14.     What are the interfaces to deal with Applet applications?

A.   AppletContext, AppletConfig
B.   AppletContext, AppletStub, AudioClip
C.   AppletConfig, AppletStub, AudioClip
D.   AppletConfit, AppletStub, VideoClip

Q15.     Which of the following objects are input to the paint() method?

A.     Canvas                   B.   Graphics                C.   Paint                       D.   Image

Q16.     Which of the following methods set the frame surface color to pink?

A.    setBackground(Color.pink);                      C.   setColor(PINK);
B.     Background(pink);                            D.   None of the above

Q17.     How to create TextArea with 80 character-width wide and 10 character-height tall?

A.    new TextArea(80, 10)                       B.   new TextArea(10, 80)

Q18.     What is the immediate super class of Applet class?

A.    Object                     B.  Window                    C.   Panel                     D.   Component

Q19.     Which Component method is used to access a component's immediate Container?

A.    getVisible()              B.   getImmediate()        C.   getParent()                       D.  getContainer()

Q20.     Which of the following creates a List with 3 visible items and multiple selection disabled?

A.    new List(3, false)  B.   new List(true, 3)       C.   new List(3, True)     D.   new List(false,3)

Q21.     Window, Panel and ScrollPane are the subclasses of

A.    Container class     B.  Component class       C.   Frame class             D.  None of the above

Q22.     Which of the following components allow multiple selections?

A.     Non-exclusive Checkboxes                       B.  Radio buttons            C.   Choice                     D.   Text Boxes

Q23.     Which layout is used as their default layout by Window, Frame and Dialog classes?

A.     CardLayout             B.   BorderLayout        C.   FlowLayout              D.   GridLayout

Q24.       Which of the following statement(s) are true?

A.   The default layout manager for an Applet is FlowLayout
B.   The default layout manager for an application is FlowLayout
C.   A layout manager must be assigned to an Applet before the setSize method is called
D.   The FlowLayout manager attempts to honor the preferred size of any components

Q25.     What class is the top of the AWT event hierarchy?

A.   java.awt.AWTEvent
B.   java.awt.Event
C.   java.util.eventObject
D.   javax.swing.Object

Q26.       What is the result of executing the following Java class:

import java.awt.*;

public class FrameTest extends Frame {
            public FrameTest() {
                        add (new Button("First"));
                        add (new Button("Second"));
                        add (new Button("Third"));
                        pack();
                        setVisible(true);
            }
                       
            public static void main(String args []) {
                        new FrameTest();
            }
}

Select from the following options:

A.  Only the "third" button is displayed.
B.  A runtime exception is generated (no layout manager specified).
C.  Only the "first" button is displayed.
D.  Only the "second" button is displayed.

Q27.     If a frame uses a Grid layout manager and does not contain any panels, then all the components within the frame are the same width and height.

A.  True                                   B.   False

Q28.     An application has a frame that uses a Border layout manager. Why is it probably not a good idea to put a vertical scroll bar at North in the frame?

A.  The scroll bar’s height would be its preferred height, which is not likely to be enough.
B.  The scroll bar’s width would be the entire width of the frame, which would be much wider than
     necessary.
C.  Both a and b.
D.  Neither a nor b. There is no problem with the layout as described.

Q29.       How do you indicate where a component will be positioned using FlowLayout?

A.   North, South, East, West
B.   Assign a row/column grid reference
C.   Pass a X/Y percentage parameter to the add method
D.   Do nothing, the FlowLayout will position the component

Q30.     Which of the following options are correct regarding the organization of layouts (Select Multiple)

            A.   FlowLayout           :           The elements of a FlowLayout are organized in a top to bottom,      left to right
Fashion.
B.   BorderLayout:       The elements of a BorderLayout are organized at the borders (North, South, East and West) and the center of a container.
C.   CardLayout             :         The elements of a CardLayout are stacked, one on top of the other, like a deck of
cards.
D.   GridBagLayout :        The elements of a GridLayout are of equal size and are laid out using the square
of a grid

22 comments:

for IT the said...

Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

Naviya Nair said...

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

jazz said...

Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your..
Vmware Training in Chennai

jazz said...

Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
CCNA Training in Chennai

john brito said...

This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.
rpa training in chennai
rpa training in bangalore
rpa course in bangalore
best rpa training in bangalore
rpa online training

johnsy sai said...

Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
excel advanced excel training in bangalore
Devops Training in Chennai

Mounika said...

Thanks Admin for sharing such a useful post, I hope it’s useful to many individuals for developing their skill to get good career.
python training Course in chennai
python training in Bangalore
Python training institute in bangalore

afiah ahamed said...

The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
Java interview questions and answers

Core Java interview questions and answers

Java training in Chennai | Java training in Tambaram

Java training in Chennai | Java training in Velachery

sai said...

I am really impressed with your efforts and really pleased to visit this post.
python course in pune
python course in chennai
python course in Bangalore

janani said...

That was a great message in my carrier, and It's wonderful commands like mind relaxes with understand words of knowledge by information's.

Java training in Bangalore | Java training in Indira nagar

Java training in Bangalore | Java training in Rajaji nagar

Java training in Bangalore | Java training in Marathahalli

Java training in Bangalore | Java training in Btm layout

jeyanthi said...

Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
Data Science Training in Chennai | Best Data science Training in Chennai
Data Science training in kalyan nagar
Data science training in Bangalore | Data Science training institute in Bangalore
Data Science training in marathahalli | Data Science training in Bangalore
Data Science interview questions and answers
Data science training in jaya nagar | Data science Training in Bangalore

ais a said...

Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
Online DevOps Certification Course - Gangboard
Best Devops Training institute in Chennai

geetha sridhar said...

From your discussion I have understood that which will be better for me and which is easy to use. Really, I have liked your brilliant discussion. I will comThis is great helping material for every one visitor. You have done a great responsible person. i want to say thanks owner of this blog.
Data Science course in kalyan nagar | Data Science Course in Bangalore
Data Science course in OMR | Data Science Course in Chennai
Data Science course in chennai | Best Data Science training in chennai
Data science course in velachery | Data Science course in Chennai
Data science course in jaya nagar | Data Science course in Bangalore
Data Science interview questions and answers

SRI said...

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

best rpa training in chennai
rpa training in chennai
rpa interview questions and answers
automation anywhere interview questions and answers
blueprism interview questions and answers
uipath interview questions and answers
rpa training in bangalore

SRI said...

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

best rpa training in chennai
rpa training in chennai
rpa interview questions and answers
automation anywhere interview questions and answers
blueprism interview questions and answers
uipath interview questions and answers
rpa training in bangalore

SANDY said...

Howdy, would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 completely different web browsers, and I must say this blog loads a lot quicker than most. Can you suggest a good internet hosting provider at a reasonable price?
Best AWS Amazon Web Services Training in Chennai | Best AWS Training and Certification for Solution Architect in Chennai
Amazon Web Services Training in Tambaram, Chennai|Best AWS Training in Tambaram, Chennai

anushri v said...

Your very own commitment to getting the message throughout came to be rather powerful and have consistently enabled employees just like me to arrive at their desired goals.
Selenium Training in Chennai Tamil Nadu | Selenium Training Institute in Chennai anna nagar | selenium training in chennai velachery
Selenium Training in Bangalore with placements | Best Selenium Training in Bangalore marathahalli
java training in chennai | java training in chennai Velachery |java training in chennai anna nagar

cynthia williams said...

Thanks for sharing this java interview questions admin, really helpful. Waiting for more like this.
RPA Training in Chennai
RPA course in Chennai
Blue Prism Training in Chennai
UiPath Training in Chennai
AngularJS Training in Chennai
AWS Training in Chennai
Data Science Course in Chennai

Sadhana Rathore said...

I am glad that I came across your post. Looking forward to learn more. Keep posting.
Python Classes in Chennai
Python Training Institute in Chennai
ccna Training in Chennai
ccna course in Chennai
R Training in Chennai
R Programming Training in Chennai
Python Training in T Nagar
Python Training in OMR

haripriya said...

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
Data Science course in rajaji nagar
Data Science with Python course in chenni
Data Science course in electronic city
Data Science course in USA
Data science course in pune | Data Science Training institute in Pune

Inigo joseph said...

This is a good post. This post give truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. thank you so much. Keep up the good works.
Python Online training
python Training in Chennai
Python training in Bangalore

ragul ragul said...

This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
Best Devops online Training
Online DevOps Certification Course - Gangboard
Best Devops Training institute in Chennai

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Vamshi krishnam raju | Bloggerized by Vamshi krishnam raju - Vamshi krishnam raju | Vamshi krishnam raju