100% found this document useful (4 votes)
13K views9 pages

Msbte News: 22517 Advance Java Programming MCQ PDF

This document contains 30 multiple choice questions related to Java programming and JDBC concepts. The questions cover topics like event handling, GUI components, layout managers, graphics, databases, and JDBC architecture. Correct answers are provided for each question to test understanding of key Java and JDBC APIs and concepts.

Uploaded by

Ayushi Japsare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
13K views9 pages

Msbte News: 22517 Advance Java Programming MCQ PDF

This document contains 30 multiple choice questions related to Java programming and JDBC concepts. The questions cover topics like event handling, GUI components, layout managers, graphics, databases, and JDBC architecture. Correct answers are provided for each question to test understanding of key Java and JDBC APIs and concepts.

Uploaded by

Ayushi Japsare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Msbte News

22517 Advance Java Programming Mcq Pdf

1) Which class can be used to represent a checkbox with a


textual label that can appear in a menu. Select the one correct
answer.

a. MenuBar
b. MenuItem
c. CheckboxMenuItem Answer
d. Menu

2) Which is/are used to create a Frame? i. By creating the object


of Frame Class(association) ii. By extending Frame
class(inheritance)

a. Only i
b. Only ii
c. Both Answer
d. None

3) Which of the following sets the frame, say frame to 300 pixels
wide by 200 high?

a. fram.setSize( 300, 200 ); Answer


b. fram.setSize( 300, 200 );
c. fram.paint( 300, 200 );
d. fram.setVisible( 300, 200 );

4) Which of the following is/ are not related with keyboard event?
a. ClassKeyEvent is used to notify if any key pressed occurs or
not.
b. The KeyListener should be added either in init() or the main
method.
c. RequestFocus should be added either in init() or the main
method.
d. The class InputEvent should be imported explicitly in the
program. Answer

5) Which of the following packages supports the event handling


routine, when we use Swing components in GUI programs?

a. javax.swing Answer
b. java.awt
c. java.util
d. Java.applet

6) Which of the following displays components row-by-row in


the order in which they were added to the JFrame?

a. CardLayout
b. FlowLayout Answer
c. BorderLayout
d. GridLayout

7) Using a FlowLayout manager, which is the correct way to add


elements to a container?
a. add (component); Answer
b. add("Center", component);
c. add(x, y, component);
d. set(component);
8) Which layout manager places components in one of five
regions: north, south, east, west, and center?

a. CardLayout
b. FlowLayout
c. BorderLayout Answer
d. GridLayout

9) The MouseListener interface specifies the following methods:


mouseClicked, mouseEntered, mouse-Exited, mousePressed,
and mouseReleased. In order to use a MouseListener in your
code, you must provide an implementation for which of the
following?

a. None of the MouseListener methods.


b. All MouseListener methods. Answer
c. At least the mouseClicked method
d. Any one MouseListener method

10) Where are the following four methods commonly used? 1)


public void add(Component c) 2) public void setSize(int width,int
height) 3) public void setLayout(LayoutManager m) 4) public void
setVisible(boolean)

a. Graphics class
b. Component class Answer
c. Both A & B
d. None of the above

11) Which is the container that doesn't contain title bar and
MenuBars but it can have other components like button, textfield
etc?
a. Window
b. Frame
c. Panel Answer
d. Container

12) Which method is used to set the graphics current color to


the specified color in the graphics class?

a. public abstract void setFont(Font font)


b. public abstract void setColor(Color c) Answer
c. public abstract void drawString(String str, int x, int y)
d. None of the above

13) In Graphics class, which method is used to draw a rectangle


with the specified width and height?

a. public void drawRect(int x, int y, int width, int height) Answer


b. public abstract void fillRect(int x, int y, int width, int height)
c. public abstract void drawLine(int x1, int y1, int x2, int y2)
d. public abstract void drawOval(int x, int y, int width, int height)

14) Which object can be constructed to show any number of


choices in the visible window?

a. Labels
b. Choice
c. List Answer
d. Checkbox

15) Which class is used for this Processing Method


processActionEvent( )?
a. Button,List,MenuItem Answer
b. Button,Checkbox,Choice
c. Scrollbar,Component,Button
d. None of the above

16) Which method can set or change the text in a Label?

a. setText() Answer
b. getText()
c. All the above
d. None of the above

17) The following


a) It is lightweight.
b) It supports pluggable look and feel.
c) It follows MVC (Model View Controller) architecture are the
advantages of _____ .

a. Swing Answer
b. AWT
c. Both A & B

18) The ActionListener interface is not used for handling action


events.

a. True
b. False Answer

19) Which package provides many event classes and Listener


interfaces for event handling?
a. java.awt
b. java.awt.Graphics
c. java.awt.event Answer
d. None of the above

20) Which of the following types of JDBC driver should be used


if your Java application is accessing multiple types of databases
at the same time?

a. Type 1
b. Type 2
c. Type 3 Answer
d. Type 4

21) Which of the following is correct about JDBC?

a. JDBC architecture decouples an abstraction from its


implementation.
b. JDBC follows a bridge design pattern.
c. Both of the above. Answer
d. None of the above.

22) Which of the following steps establishes a connection with a


database?

a. Import packages containing the JDBC classes needed for


database programming.
b. Register the JDBC driver, so that you can open a
communications channel with the database.
c. Open a connection using the DriverManager.getConnection ()
method. Answer
d. Execute a query using an object of type Statement
23) Which of the following is true about JDBC?

a. The JDBC API is an API to access different relational


databases.
b. You use it to access relational databases without embedding a
dependency on a specific database type in your code.
c. JDBC stands for Java DataBase Connectivity.
d. All of the above. Answer

24) Which of the following is the advantage of using the JDBC


connection pool?

a. Slow performance
b. Using more memory
c. Using less memory
d. Better performance Answer

25) How many Result sets are available with the JDBC 2.0 core
API?

a. 2
b. 3 Answer
c. 4
d. 5

26) Which method is used to establish the connection with the


specified url in a Driver Manager class?

a. public static void registerDriver(Driver driver)


b. public static void deregisterDriver(Driver driver)
c. public static Connection getConnection(String url) Answer
d. public static Connection getConnection(String url,String
userName,String password)

27) Which driver Network connection is indirect that a JDBC


client makes to a middleware process that acts as a bridge to the
DBMS server?

a. JDBC-Net Answer
b. JDBC-ODBC bridge
c. Native API as basis
d. Native protocol as basis

28) JDBC RowSet is the wrapper of ResultSet,It holds tabular


data like ResultSet but it is easy and flexible to use.

a. True Answer
b. False

29) The ResultSet.next method is used to move to the next row


of the ResultSet, making it the current row.

a. True Answer
b. False

30) Which JDBC product components does the Java software


provide?

a. The JDBC driver manager


b. The JDBC driver test suite
c. The JDBC-ODBC bridge
d. All mentioned above Answer
For More Engineering/ DIPLOMA MCQ
Question Papers Visit Msbte News

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy