0% found this document useful (0 votes)
16 views10 pages

AJPprelimssol

Uploaded by

vinantymhatre02
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
0% found this document useful (0 votes)
16 views10 pages

AJPprelimssol

Uploaded by

vinantymhatre02
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/ 10

VidyaVardhini’s

Bhausaheb Vartak Polytechnic


Vasai Road West, Palghar 401202
Academic Year : 2023-24 PRELIMS (Max Marks: 70)

Class: TYBD Time : 09:30 to 11:00 Date: 07 / 11 / 2023


Course code :22517 Course ABR: AJP NBA code:- D502
Course name: BD-V-I Roll No.

1. Positions the components into five regions:east, west, north, south, center

a) BorderLayout b) CardLayout c) GridLayout d) FlowLayout

2. Arranges the components as a deck of cards such that only one component is visible at a time
a) BorderLayout b) CardLayout c) GridLayout d) FlowLayout

3. The class at the top of the AWT hierarchy


a)Component b)Frame c)Window d)Panel

4. What is the description of java.sql.Driver?


a) This class provides the functionality necessary for managing one or more database drivers.
b) This is an interface that abstracts the vendor specific connection protocol
c) This class is used to discover properties required to obtain the connection
d) This interface abstracts most of the interaction with the database

5. JDBC-ODBC Bridge can be availed by importing __________ package.


a) java.sql b) sun.jdbc.odbc c) java.jdbcodbc d) None of the above

6. _____________ refers to pure Java Driver that uses a middleware driver to connect to a
database
a. Type-1 Driver b. Type-2 Driver c. Type-3 Driver d. Type-4 Drive
7. Using which classes and interfaces of javax.sql package we can establish and manage
connection with the data source?
a. Only DataSource
b. DataSource and DataManager
c. DataSource and DriverManager
d. Only DriverManager

1
8. Which class is used for this Processing Method processActionEvent( )?
(a) Button,List,MenuItem (b) Button,Checkbox,Choice
(c) Scrollbar,Component,Button (d) None of the above

9. Which of the following method is used to determine the type of adjustment event?
a) getType( ) (b) getEventType( ) (c) getAdjustmentType( ) (d) getEventObjectType( )

10. How to obtain the command name for invoking ActionEvent?


a) getCommandName( )
b) getActionEventCommand( )
c) getActionCmd( )
d) getActionCommand( )

11. ComponentEvent is the superclass of


(a) ActionEvent (b) ItemEvent (c) TextEvent (d) All of above

12. The classes and interfaces defined in AWT are contained within the package.
a) java.awt.* b) java.sql.* c) java.io.* d) java.int
13. In adapter class ,it is sufficient to include only the methods required to override.
a) True b) false c) sometimes d) Never
14. The getStateChanged() method returns the state change.
a) The mouse pressed or released
b) Selected or deselected
c) A page up or page down
d) The window gain focus
15. Which method is used to establish connection between client and server.

a)public outputStream getOutputStream() b) public synchronized void close()

c) public socket accept() d)None of the above

16. Cookies were originally designed for-

a) client side programming b)server side programming.


c)Both a and b d)web programming

2
17. In the method of servlet connection is created.
a) destroy() b)service() c) init() d) connect()

18. Servlet creates ………. thread for each request of client.


a) single b)two c)multiple d) None of These
19. The call to setContentType() establishes the MIME type of the HTTP respons
a) True b)False
20. Which method is used to specify before any lines that uses the PrintWriter?
a)SetPageType() b) setContentType() c)setContextType() d)setResponseType()
21. Swing is a set of classes that provides more _____ and _____components than are possible
with the AWT
a) Powerful , Flexible b) Great, Awesome c) Better , Powerful d) Stable, customizable.
22. Swing components are not implemented by ____ code.
a) platform-Specific b) Platform- independant c) Both d) non of these
23. A _______ is a component that appears as a group of folders in a file cabinet.
a) JTabbedPane b)Pane c)JTree d) JTable.
24. FileDialog is which kind of dialog box?
a)ModalType b)Modeless c)Both a and b d) none of these
25. In Swing the content pane can be obtained via method________

a)getContentPane() b)ContentPane() c)JtabbedPane() d)None of above

26. How to create an object and execute a query in PreparedStatement?


a)PreparedStatement stmt=new PreparedStatement("insert into Emp values(a,b)");
b) PreparedStatement stmt=con.prepareStatement("insert into Emp values(a,b)");
c)PreparedStatement stmt=con.PrepareStatement("insert into Emp values(a,b)");
d)none of the above
27. What is the immediate superclass of JRadioButton class?
a) JToggleButton b) JButton c) JAbstractButton d)JButtonMain
28. To retrieve the current state of a check box, call __ method , to set its state, call method.
a) setState( ) , getState( )
b) getState( ) , setState( )
c) setstate( ) , getstate( )
d) getstate( ) , setstate( )
29. ) To determine which item is currently selected, you may call either or method.
a)setSelectedItem( ),setSelectedIndex( ) b)GetSelectedItem(

3
),GetSelectedIndex( ) c)getSelectedItem( ),getSelectedIndex( ) d)getselectedItem(
),getselectedIndex( )
30. Constuctors of scrollbar are
a) Scrollbar( ) ,Scrollbar(int style) ,Scrollbar(int style, int initialValue, int thumbSize)
b) Scrollbar( ), Scrollbar(int style) ,Scrollbar(int style, int initialValue, int thumbSize, int min
c) Scrollbar( ),Scrollbar(int style),Scrollbar(int style, int initialValue, int thumbSize, int max)
d) Scrollbar( ),Scrollbar(int style),Scrollbar(int style, int initialValue, int thumbSize, int
min, int max)
31. Which of the following method Write s and stack the trace for e to the server log?
a) void log(Exception e, String s) b) void log( String s) c) void log() d) None of
these
32. Which of the following method returns an enumeration with the name of servlets in the
same namespace in the server?
a)String getInitParameter(String param) b) Enumeration getInitParameterNames()
( c) Enumeration getServletNames() d) None of these
33. What does byte[ ] getData( ) method do?

a)Returns the byte array of data contained in the datagram b)Returns the port
number. c)Returns data in form of string d)returns length of
data

34. Path for Data Sources(ODBC):


a)start->control panel -> system and security -> data sources
b)start ->control panel->system and security->administrative tools->data sources
c)start->control panel->data sources
d)start->accessories->data sources
35. Immediate super class of JCheckBox is –

a) JComponent b) JApplet c) JCkeckBoxGroup d) JToggleButton

36. The TreeNode is – a) A class b) An interface c) A variable d) Nothing


37. The is an object that is notified when an event occurs.
a) Listener b) Sources (c) Event (d) None of the above
38. The _______ method returns an InetAddress for a host name passed to it.
a)getByName(String hostName) b)getLocalHost()
c)getAllByName(String hostName) d)None of the above

4
39. Which of the following class provides implementations of the basic life cycle methods for a
servlet.
a)Servlet InputStream Class b) GenericServlet Class
c) ServletException Class d) Servlet OutputStream Class
40. AbstractButton is a superclass for which components?
a) Combo boxes, check boxes, and lists b) push buttons, check boxes, and radio buttons.
c) Text fields, Text areas d)None of the above
41. Which of these events will be generated if we close the applet?
a)ActionEvent b)ItemEvent c)MouseEvent d)WindowEvent
42. Constructors for JTextField
a) JTextField( ) JTextField(int cols) , JTextField(String s, int cols) JTextField(String s)
b)Only JTextField( ) and JTextField(int cols)
c) both
d) none of the above
43. Name the method defined in EventObject class that returns the object generated from the
event.
(a) getEvent( ) (b) getObject( )
(c) getId( ) (d) getSource( )
44. The factory method ______ which takes an IP address and returns an InetAddress object.
a)getByName(String hostName) b)getLocalHost()
c)getAllByName(String hostName) d)getByAddress()
45. This interface lets you execute stored procedures.
a) java.sql.Statement b) java.sql.PreparedStatement
c) java.sql.ResultSet d) java.sql.CallableStatement
46. Which of the following interface enables the servlet to obtain information about their
environment?
a) ServletContext b) ServletConfig
c)ServletRequest d) ServletResponse
47. You can remove all controls by calling method.
a)remove() b)removeFrom()
c)Remove() d)removeAll( )

48. Contructors of jtree are


a)JTree(Object obj[]) , JTree(Vec) , JTree(TreeNode tn)
b)JTree(Object obj[]) , JTree(Vector v) , JTree(Treenode tn)

5
c)JTree(Object obj[]) , JTree(Vector v) , JTree(TreenNode tn)
d)None of these
49. Which of the following is not the method of handling window event?
(a) void windowClosed(WindowEvent we) (b) void windowClosing(WindowEvent we)
(c) void windowAfterClosing(WindowEvent we) (d) All of these
50. Which of the following Instance Method returns true if this object has the same Internet
address as other?
a)boolean isMulticastAddress() b)boolean equals(Object other)
c)String toString() d)byte[] getAddress()
51. Which of the following is/are charecteristics of JDBC
1) Supports a wide level of portability.
2) Provides Java Interfaces that are compatible with Java Applications . These providers
are also responsible for providing the driver services.
3) Provides higher level APIs for application programmers. The JDBC API specification is
used as an interface for the applications and DBMS.
4) (4)The JDBC call to a Java application is made by the SQL Statements. These
statements are resposible for entire communication with the database.

a) All of the above b) None of the above


c) Only 2,3 and 4 d) Only 1,2 and 4
52. How to give number of columns for JTextField?
a) Use setColumns( ) method b) Use the value directly in the constructor
c) Using applyColumn( ) method. d) We have to use JTextArea class
53. Button Control implements following listener interface.
(a) ItemListener (b) ActionListener
(c) FlowListener (d) Adapter
54. OCI stands for _____________
a. Order Command Interface b. Oracle Call Interface
c. Operation Command Interface d. Open Command Interface
55. In getSession(boolean new) method If new is true and no session exists, creates and returns a
session for this request. Otherwise, returns the existing session for this request.
a. True b.False
56. You can retrieve the minimum and maximum values of scrollbar by and method
a) getMinimum( ), getMaximum( ) b)getMax(), getMin()
c)setMinimum(), setMaximum() d)setMax(), setMin()

6
57. The scroll bar constants for scroll pane are defined in –
a) Scrollbar class b) ScrollPane class
c) ScrollPaneConstants class d) Component class

58. For the following code select the method that can be used to handle event.
import java.awt.event.*;
import java.awt.*;
import java.applet.*;

public class checkbackg extends Applet implements ItemListener


{
Checkbox m1,m2,m3;
public void init()
{
m1=new Checkbox("A");
m2=new Checkbox("B");
m3=new Checkbox("C");
add(m1);
add(m2);
add(m3);
m1.addItemListener(this);
m2.addItemListener(this);
}
public void (ItemEvent ie)
{
if(ie.getSource()==m1)
setBackground(Color.red);
if(ie.getSource()==m2)
setBackground(Color.green); } }

a) actionPerformed(ActionEvent ae) b) itemStateChanged(ActionEvent ie)

c) itemStateChanged(ItemEvent ie) d) adjustmentPerformed(AdjustmentEvent ae)

59. _______ method Creates a socket connecting the local host to the named host and port.
a)Socket(String hostName, int port) b)Socket(InetAddress ipAddress, int port)

7
c)Both 1 & 2 d)None of the above
60. Determines if the session ID must be encoded in the URL identified as url. If so, returns the
modified version of url. Otherwise, returns url.
a)encodeRedirectURL(String url) b)encodeURL(String url)
c)encode(String url ) d)None of the above

61. Find the Errors

import java.swing.*;
public class JLabelDemo extends JApplet
{
public void init()
{
Container contentPane = getContentPane();
ImageIcon ii = new ImageIcon("france.gif");
JLabel jl = new Jlabel("France", ii, JLabel.CENTER);
contentPane.add(jl);
}
}

a) Its Correct b)Wrong package


c)Wrong constructor for creating Icon d)wrong constructor for creating label.
62. Which exception will occur if specified port number is not available for DatagramSocket?
a) UnknownException c) SocketException
b) UnknownSocketException d) UnlnownPortException
63. Returntype of execute() method is-
a) Boolean c) int
b) ResultSet d) None of the above
64. …………interface is used for inter-servlet communication
a) RequestDispatcher c)ServletRequest
b) ServletResponse d)none of the above.
65. Cookies are stored at ……..
a) Client side c) Server side
b) Both A and B d)none of the above

8
66. class provides methods to handle HTTP requests and responses
a) HttpServlet b) Cookie
c) HttpSessionEvent d) None of the above
67. What is the Driver Interface used for?
a) To create Database Object that provide and entry point for database connectivity
b) to contains the results of executing an SQL query
c) To create Connection Object that provide an entry point for database connectivity.
d) none
68. A_______ is responsible for determining whether code executing in the Java runtime
environment has permission to perform a security sensitive operation.
a) Permission object b) security object
c) policy object d) all of above
69. How many options can be selected at a time in a JCheckBox?
a) Only one b) It is defined in the program
c) As many as you want d) JCheckBox isn’t a Swing
component
70. Find the error in the following code
import java.io.*;
import javax.servlet.*;
public class HelloServlet extends GenericServlet
{
public void service(ServletRequest request, ServletResponse response) throws
ServletException,IOException
{
response.setContentType(“text/html”);
PrintWriter pw = response.getOutputStream();
pw.println(“ Hello”);
pw.close();

a) import javax.servlet.*;
b) response.setContentType(“text/html”)
c) PrintWriter pw = response.getOutputStream();
d) None of these
71. MVC stands for

9
a) Model-View-Control b) Menu-View-Control
c) Menu-Visual-Control d) Model-View-Controller

72. What does the Statement interface return?


a) ResultSet Object b) Connection Object
c) PreparedStatement Object d) None of the above
73. The signature for the registration method for a ActionEvent should be .
(a) public void addActionListener(ActionEvent L)
(b) public void setAction(ActionListener L)
(c) public void setActionListener(ActionListener L)
(d) public void addActionListener(ActionListener L)
74. ) In MVC terminology, the model corresponds to the
a) Components and links
b) state information associated with the component.
c) Data
d) All of these
75. URL class has several constructors; each can throw a _____________________.
a) MalformedURLException b) IOException
c) URLException d) SocketException

------ALL THE BEST----

10

You might also like