Subscribe Us

Core Java - Interview Questions and Answers

471. 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.
True / False.

Ans : True.

472. If a frame uses its default layout manager and does not contain any panels, then all the components within the frame are the same width and height.
True / False.

Ans : FALSE.

473. With a Border layout manager, the component at Center gets all the space that is left over, after the components at North and South have been considered.
True / False

Ans : False.

474. An Applet has its Layout Manager set to the default of FlowLayout. What code would be the correct to change to another Layout Manager?
a) setLayoutManager(new GridLayout());
b) setLayout(new GridLayout(2,2));
c) setGridLayout(2,2,))
d setBorderLayout();

Ans : b.

475. 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

Ans :d.

476. How do you change the current layout manager for a container?
a) Use the setLayout method
b) Once created you cannot change the current layout manager of a component
c) Use the setLayoutManager method
d) Use the updateLayout method

Ans :a.

477. When using the GridBagLayout manager, each new component requires a new instance of the GridBagConstraints class. Is this statement true or false?
a) true
b) false

Ans : b.

478. Which of the following statements 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

Ans : a and d.ss

479. Which method does display the messages whenever there is an item selection or deselection of the CheckboxMenuItem menu?

Ans : itemStateChanged method.

480. Which is a dual state menu item?

Ans : CheckboxMenuItem.

Post a Comment

0 Comments