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

18 comments:

for ict 99 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

Unknown 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

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

gowsalya 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

cynthiawilliams 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

saranya 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

preetha said...

Have you been thinking about the power sources and the tiles whom use blocks I wanted to thank you for this great read!! I definitely enjoyed every little bit of it and I have you bookmarked to check out the new stuff you post
Data Science course in Indira nagar
Data Science course in marathahalli
Data Science Interview questions and answers
Data science training in tambaram
Data Science course in btm layout
Data science course in kalyan nagar
Data science course in bangalore

Sugantha Raja said...


Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging !!
Java Training in Chennai | Java Training Institute in Chennai

unknown said...

Informative post indeed, I’ve being in and out reading posts regularly and I see alot of engaging people sharing things and majority of the shared information is very valuable and so, here’s my fine read.
click here png
click here to download (link 1)
click here animated gif
click here animation
click here accessibility

Anonymous said...

С сумкой которой пользуются девушек всё намного сложнее. Для девушки на основное место становиться то, как выглядит девайс. Дама согласна израсходовать свое время, чтобы втянуться к исключительной для себя сумке в гардеробчике, но при этом произвести первое впечатление на коллег. В аксессуаре женщины можно зафиксировать парфюм, медикаменты, визитки. Реестр иногда гораздо больше, всё зависит от масштаба выбранного аксессуара. В гардеробе леди параллельно несколько сумочек разных принадлежностей и видов. Для посещения на прогулок или рутинных будней женщина избирает маленькую сумку или сумку-портфель, для аудиенции с родственниками на закате. Любопытно, что леди иногда одаривают клатч. Атрибуты дама избирает единолично, а когда есть необходимость, то указывает коллегам то, что она хочет в атрибуте желаемого подарка. Сюрпризы и спонтанные покупки здесь будут ненужны. Покупка новой аксессуара – это ответственное событие, но черезмерно увлекательное. Не смотря не на что осуществляйте это как можно чаще тут сумка баленсиага !

Anonymous said...

Вспоминает ли меня, гадание считается самым верным способом нагадать будущее человека. Синоптические происшествия или ритуальные убийства животных по прошествии длительного времени основали точное объяснение обнаруженного. Основные варианты ворожбы образовались тысячелетия тому назад до Н.Э.

Anonymous said...

Достойный и проверенный реализатор всегда может предоставить большой сортамент керамогранитного покрытия для уборной. Предприятие sotni.ru реализует dual gres chic collection roy в течение 10 лет.

Anonymous said...

Занять необходимую сумму на дебетовую карту вполне просто. Онлайн сервис выбора микрофинансовых продуктов разрешает утвердить необходимый кредит. Займы за 15 минут – это надежный метод взять бабки в минимальные сроки.

Anonymous said...

Дополнительный счет даст возможность срубить больше денег. Нужно отметить, что сервис игровые автоматы на деньги казино х начисляет всем геймерам специальные бонусы. Зарегистрируйтесь на в приложении и получите полезные вознаграждения в своей учетке.

Anonymous said...

Казино x вход – воспользуйтесь преимуществом безопасной игры и выигрывайте серьезные суммы. Интернет-игры имеют огромную доступность во всех странах мира. Модернизация современных процессов позволило игорным ресурсам конкретно усовершенствовать предоставляемые сервисы.

Anonymous said...

Кафель gayafores tribeca производят в огромном количестве, и каждая фирма планирует запустить собственный неповторимый проект. Огромный ассортимент оттенков и размеров. Цена керамики опять же различается.

Twitter Delicious Facebook Digg Stumbleupon Favorites More

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