0% found this document useful (0 votes)
18 views

AJP MCQ (Unit 1 To 6)

Advance java MCQs

Uploaded by

ktavish31
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
18 views

AJP MCQ (Unit 1 To 6)

Advance java MCQs

Uploaded by

ktavish31
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 20
2, By extending Frame class (inheritance) (ajtrue E [b] False Q.26 The title of the frame can be set in AWT using the method. [a] settHeading 1b] setTitle [c]CreateTitle dl Settitle Q27 Which are passive controls that do not support any interaction with the user ? [al choice b]List [e]Labels d] Checkbox Q.28 How many ways can we align the label in a container ? fala (b]2 (ds dé Q.29 By which method we can set or change the text ina Label in AWT? [a] setrexty) b] getText() [q adatexte) [a] all of these Q.30 The various controls supported by AWT are : [a] Labels, push buttons |Checkboxes, choice list Q.34 Default layout manager window is [a] cardlayout b] GridBaglayout [cFrame d] BorderLayout Q.35 Each menu is associated with a list of menu items : [a] checkbox [b) Drop-down [e] Choice [A] None of these Q.36 Which class can be used to represent a checkbox with a textual label that can appear in. amenu ? [a] MenuBar b] Menultem [c] CheckboxMenultem ‘d]Menu Q.37 Which abstract class is menu related classes ? [a] MenuComponent [e]Menuttem Q.38 Menu items are added t co frame Q.39 Dialog box does not maximize button {a]true the super class of all b] MenuBar d] CheckboxMenultem 0 b] menubar [d]both a and b have minimize and [b] false 1 rT Technical Publications An up trust fr knowidge SS 000 Le} s] [2] =] =| [<1 | 6S) S| ¥1 6] ail os Ls|=|=|sls|s[-[ ele eD | “| od) s| a elects ‘ . Ohad if p = : a Pi You-See-Is-What- 1e raw tagged form. But there button for which it is not views for the same model. then the controller calls in order to handle the tells the view to update the desired result. For the view reads the Thus model-view and n order to accomplish the Q4 The Java Foundation Classes (FC) is a set of GUI components which simplify the development of desktop applications. [a] True b] False Q5 Following letter used as a prefix to swing component. alA bs e]G JJ Q6 ____ is one of the features of object oriented programming that allows the creation of hierarchical classifications. Polymorphism [6] Class Inheritance [d] Object -Q.7 In Swing JButton class is derived from __. - [a] AbstractButton [b ]JToggleButton = le ¢ |JComponent d | None of these Q8 The JTextComponent derives two components JTextBield and __ a}JComboBox —_~[b] JTextArea {c]JSlider d] All of the above -Q.9_ In Swing class hierarchy the class present at the rootis___. a]Component b] Window [e]Container . __ [d] Object 2.10 pane can be used to add component to container a}Glass b} Content c} Container d] All of above Q.14 Select the correct source code using swing for generating lowing output. two arcs Sw re one aren one ean four circles Etec dries and one arc M 43 To represent Icon file in ss a [B] seticon [a] none of this following component: 2 JComboBox All of the above (b) (a) Public class AppletDemo ‘extends JApplet { Public void paint(Graphics 9) { To generate above output we need ___—* fw aoa zo [a] List, choiceButton,Imagelcon =o ComboBox, Image Icon, Label ¢] List and Image Icon 4) ComboBox and Image Icone Container contentPane = getContentPane(); -ContentPane.setLayout(new BorderLayout()) final String|] th = { "Name*, 'City’, ‘Salary’,"Designation’ }; Object{][] mytable = { Beer *5000',"Accountant’}, ; "Archana", "Mumbai", "7000°,"Executive'}, fps "Banglore", "10000","Manager’}, Panel, TabbedPane, Radio button, TabbedPane, List TabbedPane,Panel Label, TabbedPane, ‘Checkbox 29 MVC stands for Model Version Control Model View Controller Mini View Controller Major View Controller .30 MVC architecture is used by swing rue [B] False EEE? eee 2 [B)Eventciass [a] temEvent provides many event classes and Listener interfaces for event handling ? [eJiavaawt [6] java.awt.Graphics [eljavaawtevent [Zi] None of the above 205 Which of these interfaces handles the event when a component is added to a container ? [a] ComponentL istener b] ContainerListener [c]FocusListener ‘d] InputListener actionPerformed() ? [2] ComponentListener b | ContainerListener [ce] ActionListener d | InputListener Q7 Which of these interfaces define four methods ? [2] ComponentListener b) ContainerListener [c] ActionListener d] InputListener Q8 Which of these events will be generated if we close an applet’s window ? [a] ActionEvent b] ComponentEvent c] AdjustmentEvent [d] WindowEvent -Q9 Which of these events is generated when a button is pressed ? a | ActionEvent | KeyEvent — [e]WindowEvent id ] AdjustmentEvent Q.10 Which of these methods can be used to obtain the command name for invoking ActionEvent B WINDOW_DEICONIFIED All of the mentioned -Q.14 Which of these events is generated by sq bar? a] ActionEvent b ]KeyEvent ic | WindowEvent ‘d | AdjustmentEvent Q.15 Which of these constant value will cha when the button at the end of scroll bar4 clicked to increase its value ? [2] BLOCK_DECREMENT [b] BLOCK_INCREMENT [c] UNIT_DECREMENT <4] UNIT_INCREMENT Q.46 Which of these methods is MouseMotionAdapter class ? mouseDragged() mousePressed() mouseReleased() mouseClicked() 7 Which of these methods will respond you click any button by mouse ? ‘mouseClicked() [b] mouseEntered() mousePressed() [d] All of the mentioned. 48 Which of these is superclass of all A defined | elle == 2 1 EF) classes ? a | Applet [b_]ComponentEvent pe Byene [a }inputevent 0.19 Which of these methods can be used to ob the coordinates of a mouse ? getPoint() b | getCoordinates() ie BetMouseXY() [ad ] getMouseCordinates() recognize when a component is added to from a container. d]javaawt Which methods are commonly used in ServerSocket class? Public OutputStream getOutputStream() Public Socket accept() Public synchronized void close() [d] none of the above Q.3 Which class is used to create servers that listen for either local client or remote client programs ? [a] ServerSockets b] httpServer [c]httpResponse d] none of the above Q4 Which methods are commonly used in ServerSocket class ? Public OutputStream getOutputStream() public Socket accept() Public synchronized void close() none of the above @.5 Which of these is a protocol for breaking and sending Packets to an address across a network ? [a] 7cPAP b]DNS m [c]Socket [d] Proxy server @.6 How many ports of TCP/IP are reserved for specific protocols ? [a}10 b] 1024 [c]2088 [a]si2 Q.7 How many bits are in a single IP address ? [b]i6 oe a ERE static void main(String|] args) throws UnknownHostException { d ‘obj1 = InetAddress.getByName(‘www.google.com’) 38 obj2 = InetAddress.getByName( www facebook.com’); obj1.equals(obj2); -print(x); b]1 dj False programming must [b] Port number ‘d] None of the above Datagram is basically an information but [b} False is the output of this program? ort java.net."; networking { static void main(String|] InetAddress obj1 = InetAddress.getByName TnetAddress obj2 = InetAddress.getByName('www nx = obj1.equals(obj2): System.out.print(x); know which informations ? there is no guarantee of its content, arrival or arrival time. args) throws ‘UnknownHostException { ‘www .google.com"); ‘google.com’); ib} 1 Falnateo d onis deleted from ‘not from the database, get a compile error : The method does ‘because you can not delete rows from JPBC-ODBC bridge supports multiple ent open statements per connection ? b| False for instance-data for "imag and uploaded to the database as an array of lite [Blin [eJbootean a] char (028 Are prepared statements actually compiled ? [alYes, they compiled [BINo, they are bound by the JDBC driver 32 To execute a statement, we invoke method__- fa) executeUpdate method J executeRel method [e) (dj executeStmt method executeConn method .33 Method on resultset that tests whether or not there remains at least one unfetched tuple in result set, is said to be [a] fetch method [b) current method [e]next method J access method Q.34 The ResultSet:next method is used to move to the next row of the ResultSet, making it the current row. [b] False [a] True 2.35 ResultSet object can be moved forward only and it is updatable. [b] False [alte Q.36 Which JDBC drivers will run your program ? [a] The JDBC-ODBC bridge. [b] The JDBC driver manager. [c] The JDBC driver test suite. [d] None of the above. Q.37 JDBC is a Java API that is used to connect and Q29When the message “No Suitable Driver” cq eee pas? faltrue [b] False [f) When the driver is not registered by Class.forname() method. Answers : [B] When the user name, password and the database 1, fal2 [b/s [e]4 Ja oes not match. 5. fale |alz [als |b [f] When the JDBC database URL passed is not 9, |alio|b/11./a|12]¢ constructed properly J13. [a] 14. |b | 15. | a | 16.| 4 [i] When the type 4 driver is used. lav. [al 1s.]a]19. Ja} 20] 30 Database system compiles query when itis — lo fale [ola lalen la — [b] initialized 25. |b | 26. [a | 27. [a] 28] a iesepared [a]invoked 29. [c | 30.[¢ | 31. |b | 32a 31 __is an open source DBMS product that runs sa Te [site oli in window as well as Linux. a7. a se [bp] Myst. ogo Access [d] SOL Server