Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

search topic

Monday, August 11, 2008

Java AWT Tutorials / Technical Interview Question Solutions 2008 IMP interview questions

Java AWT interview questions

1.

What is meant by Controls and what are different types of controls? - Controls are componenets that allow a user to interact with your application. The AWT supports the following types of controls:
*

Labels
*

Push buttons
*

Check boxes
*

Choice lists
*

Lists
*

Scroll bars
*

Text components

These controls are subclasses of Component.
2.

Which method of the component class is used to set the position and the size of a component? - setBounds(). The following code snippet explains this:

txtName.setBounds(x,y,width,height);

places upper left corner of the text field txtName at point (x,y) with the width and height of the text field set as width and height.
3.

Which TextComponent method is used to set a TextComponent to the read-only state? - setEditable()
4.

How can the Checkbox class be used to create a radio button? - By associating Checkbox objects with a CheckboxGroup.
5.

What methods are used to get and set the text label displayed by a Button object? - getLabel( ) and setLabel( )
6.

What is the difference between a Choice and a List? - Choice: A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. List: A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.
7.

What is the difference between a Scollbar and a Scrollpane? - A Scrollbar is a Component, but not a Container. A Scrollpane is a Container and handles its own events and performs its own scrolling.
8.

Which are true about the Container class?
*

The validate( ) method is used to cause a Container to be laid out and redisplayed.
*

The add( ) method is used to add a Component to a Container.
*

The getBorder( ) method returns information about a Container’s insets.
*

getComponent( ) method is used to access a Component that is contained in a Container.

Answers: a, b and d
9.

Suppose a Panel is added to a Frame and a Button is added to the Panel. If the Frame’s font is set to 12-point TimesRoman, the Panel’s font is set to 10-point TimesRoman, and the Button’s font is not set, what font will be used to display the Button’s label?
*

12-point TimesRoman
*

11-point TimesRoman
*

10-point TimesRoman
*

9-point TimesRoman

Answer: c.
10.

What are the subclasses of the Container class? - The Container class has three major subclasses. They are:
*

Window
*

Panel
*

ScrollPane
11.

Which object is needed to group Checkboxes to make them exclusive? - CheckboxGroup.
12.

What are the types of Checkboxes and what is the difference between them? - Java supports two types of Checkboxes:
*

Exclusive
*

Non-exclusive.

In case of exclusive Checkboxes, only one among a group of items can be selected at a time. I f an item from the group is selected, the checkbox currently checked is deselected and the new selection is highlighted. The exclusive Checkboxes are also called as Radio buttons. The non-exclusive checkboxes are not grouped together and each one can be selected independent of the other.
13.

What is a Layout Manager and what are the different Layout Managers available in java.awt and what is the default Layout manager for the panel and the panel subclasses? - A layout Manager is an object that is used to organize components in a container. The different layouts available in java.awt are:
*

FlowLayout: The elements of a FlowLayout are organized in a top to bottom, left to right fashion.
*

BorderLayout: The elements of a BorderLayout are organized at the borders (North, South, East and West) and the center of a container.
*

CardLayout: The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.
*

GridLayout: The elements of a GridLayout are of equal size and are laid out using the square of a grid.
*

GridBagLayout:
The elements of a GridBagLayout are organized according to a grid.However, the elements are of different sizes and may occupy more
than one row or column of the grid. In addition, the rows and columns may have different sizes.

The default Layout Manager of Panel and Panel sub classes is FlowLayout.
14.

Can I add the same component to more than one container? - No. Adding a component to a container automatically removes it from any previous parent (container).
15.

How can we create a borderless window? - Create an instance of the Window class, give it a size, and show it on the screen.

Frame aFrame = new Frame();
Window aWindow = new Window(aFrame);
aWindow.setLayout(new FlowLayout());
aWindow.add(new Button(\"Press Me\"));
aWindow.getBounds(50,50,200,200);
aWindow.show();

16.

Can I create a non-resizable windows? If so, how? - Yes. By using setResizable() method in class Frame.
17.

Which containers use a BorderLayout as their default layout? Which containers use a FlowLayout as their default layout? - The Window, Frame and Dialog classes use a BorderLayout as their default layout. The Panel and the Applet classes use the FlowLayout as their default layout.
18.

How do you change the current layout manager for a container?
*

Use the setLayout method
*

Once created you cannot change the current layout manager of a component
*

Use the setLayoutManager method
*

Use the updateLayout method

Answer: a.
19.

What is the difference between a MenuItem and a CheckboxMenuItem?- The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked

Free download online recent and current year solved placement question papers 2008 of leading companies in India and Abroad. See More Latest and previous expert, common, basic, important, advanced questions asked in college admission, entrance tests and technical interviews for 2007, 2008 january, february, march, april, may, june, july, august, september, october, november, december for leading IT Companies in India, USA, UK, Norway, China. Reputed MNCs testing job interview questions for Wipro, Infosys, TCS, Satyam Computers, HCL, IBM, Cisco, Microsoft, Keane, Flextronics, Accenture, Cognizant, T Systems, SAP, Oracle, Texas Instruments, Quark, Patni Computer Systems, Mastek, BT, Dell, BPO, ITES companies, Software Companies. Freshers and on campus interview held in delhi, mumbai, bangalore, chennai, madurai, noida, gurgaon, chandigarh, mohali, pune, hyderabad, kolkata, thane, ahmedabad, etc. Recent, latest reasoning, multiple choice questions, verbal, non verbal, mathematics questions with solutions / solved / answer keys, booklet. GD topics for leading campus placement interview, placement drive, HR Interview Questions and answers, how to behave, Tips, preparation, most recently asked / important software testing interview, free tutorials for java, oracle, c, c++, networking, web designing, windows 2000, vista, etc. questions. Keep Watching Previouspapers.blogspot.com for more stuff!

No comments: