Hi, I took the Sarga test simulator mock exam yesterday. The simulator is not too good. It has radio buttons in some places, where there should be check boxes. There are a few questions, the answers of which I'm not sure about: 1. Which cannot be added to a Container? A.an Applet B.a Component C.a Container D.a Menu E.a Panel My answer: A. Answer given: D
2. What tags are mandatory when creating HTML to display an applet. Select most appropriate answer.
a) name, height, width b) code, name c) codebase, height, width d) code, height, width e) None of the above My answer: d. Answer given: c
I know that the second answer has been discussed somewhere, but I couldn't find it !!. Could somebody help me with both of these qns? Thanks in advance, Aman
1.For first Question the 'Given Answer is correct'. Menu can not be added to container and so menu can only be added to menu bar. 2. For second question your answer is correct. The mandatory tags are 'Code,width and height'. To get more info,you can refer 'Cram book' or JLS. You can give your jusfication for your answers. So it will be helpful for us to answer. Hope this helps. Nirmala
Hi Nirmala, Do you mean that we CAN add an applet to a Container? How can we do this? I thought that answer A (applet) is right and D (menu) is not right, because according to Exam Cram Ch.11 p.220: Adding menus to an application requires a class that implements the MenuContainer interface. The classes in the java.awt package that implement MenuContainer are Component, Frame, Menu, and MenuBar, so practically anything on the screen can host a menu.
Now, Container is a subclass of Component. So, shouldn't Container be capable of hosting a menu? Thanks, Aman
I am not sure what the correct answer is, but here's my two cents: A: Applet is subclass of Panel, and a Panel cannot stand by itself, it has to be added to other Containers (corret me if I am wrong), in the case of an Applet, it's the browser window, or maybe appletviewer. D: If Menu means normal pull-down menu then it can only be added to a MenuBar. However, a PopupMenu can be added to any Components.