Advance Java Programming Prilim Exam

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By RSH_AJP
R
RSH_AJP
Community Contributor
Quizzes Created: 1 | Total Attempts: 973
| Attempts: 973
SettingsSettings
Please wait...
  • 1/64 Questions

    What is Purpose of Jtree ?

    • Tree is used to display icon
    • Tree is used display button
    • Tree is used for Label
    • A tree is a component that presents a hierarchical view of elements
Please wait...
About This Quiz

This Advanced Java Programming prelim exam assesses knowledge in Java event handling. It includes questions on packages, methods for registering listeners, and identifying event types, crucial for developing interactive Java applications.

Advance Java Programming Prilim Exam - Quiz

Quiz Preview

  • 2. 

    In given code ,fill the required methodsimport java.io.*;  import java.net.*;  public class InetDemo{  public static void main(String[] args){  try{  InetAddress ip=InetAddress.getByName("www.google.com");    System.out.println("Host Name: "+_________________);  System.out.println("IP Address: "+__________________);  }catch(Exception e){System.out.println(e);}  }  }   

    • Ip.getHostAddress()

    • Ip.getHostName()

    • Ip.getHostName(), ip.getHostAddress()

    • Ip.getHostAddress(),ip.getHostName()

    Correct Answer
    A. Ip.getHostName(), ip.getHostAddress()
    Explanation
    The correct answer is "ip.getHostName(), ip.getHostAddress()". This is because the code is trying to print the host name and IP address of "www.google.com". The method "ip.getHostName()" returns the host name, which is "www.google.com", and the method "ip.getHostAddress()" returns the IP address associated with that host, which is the IP address of Google's server. Therefore, using both methods will give us both the host name and IP address of "www.google.com".

    Rate this question:

  • 3. 

    Which of these are integer constants defined in ActionEvent class? 

    • ALT_MASK

    • CTRL_MASK

    • SHIFT_MASK

    • All of the mentioned

    Correct Answer
    A. All of the mentioned
    Explanation
    All of the mentioned options (ALT_MASK, CTRL_MASK, SHIFT_MASK) are integer constants defined in the ActionEvent class. These constants represent modifier keys that can be used in combination with other keys to perform specific actions.

    Rate this question:

  • 4. 

    In event handling, A listener is a object that is notified when an event occurs.

    • True

    • False

    Correct Answer
    A. True
    Explanation
    In event handling, a listener is an object that is notified when an event occurs. This means that when an event, such as a button click or a key press, happens, the listener object is informed and can perform some action in response to that event. This allows for the separation of event handling logic from the rest of the program, making it easier to manage and maintain. Therefore, the given answer "True" is correct.

    Rate this question:

  • 5. 

    Which of these method of DatagramPacket is used to find the length of byte array?

    • Getnumber()

    • Length()

    • Length()

    • GetLength()

    Correct Answer
    A. GetLength()
    Explanation
    The method "getLength()" is used to find the length of the byte array in a DatagramPacket.

    Rate this question:

  • 6. 

    Fill in blanksimport java.sql.*; class InsertPrepared{ public static void main(String args[]){ try{ Class.____________("sun.jdbc.odbc._______________________"); Connection con=DriverManager.getConnection("jdbc:odbc:employyedsn");   PreparedStatement stmt=______________________("insert into Emp values(?,?)"); stmt._____________(1,101);stmt.setString(2,"Ratan"); int i=stmt._________________System.out.println(i+" records inserted"); con.close(); }catch(Exception e){ System.out.println(e);} } }  

    • Sun.jdbc.odbc.JdbcOdbcDriver, setIntcon.prepareStatement

    • ForName,JdbcOdbcDriver, con.prepareStatement,setInt, executeUpdate();

    • Sun.jdbc.odbc, setInt,executeUpdate

    • ExecuteUpdate,sun.jdbc.odbc, setInt

    Correct Answer
    A. ForName,JdbcOdbcDriver, con.prepareStatement,setInt, executeUpdate();
    Explanation
    The correct answer is forName,JdbcOdbcDriver, con.prepareStatement,setInt, executeUpdate(). In this code, the Class.forName() method is used to load the JDBC-ODBC driver. The DriverManager.getConnection() method is used to establish a connection to the database. The con.prepareStatement() method is used to create a PreparedStatement object for executing SQL statements. The stmt.setInt() method is used to set the value of the first parameter in the SQL statement. The stmt.executeUpdate() method is used to execute the SQL statement and returns the number of rows affected.

    Rate this question:

  • 7. 

    Which of these packages contains all the classes and methods required for even handling in Java?

    • Java.applet

    • java.awt

    • Java.event

    • java.awt.event

    Correct Answer
    A. java.awt.event
    Explanation
    The package "java.awt.event" contains all the classes and methods required for event handling in Java. This package provides classes and interfaces for handling events such as mouse clicks, keyboard inputs, and window events. It includes classes like ActionListener, MouseEvent, KeyEvent, and WindowListener, which are essential for implementing event-driven programming in Java. Therefore, "java.awt.event" is the correct answer as it specifically focuses on event handling in Java.

    Rate this question:

  • 8. 

    Scrollable ResultSet have  this constants

    • TYPE_FORWORD_ONLY

    • TYPE_SCROLL_INSENSITIVE

    • TYPE_SCROLL_SENSITIVE

    • All of the above

    Correct Answer
    A. All of the above
    Explanation
    The correct answer is "All of the above" because a Scrollable ResultSet in Java has three constants: TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, and TYPE_SCROLL_SENSITIVE. These constants represent different types of scrollable result sets that can be used to navigate through the data in a ResultSet object. Therefore, all three options are valid constants for a Scrollable ResultSet.

    Rate this question:

  • 9. 

    Which of these methods are used to register a mouse motion listener?

    • addMouse()

    • addMouseListener()

    • AddMouseMotionListner()

    • EventMouseMotionListener()

    Correct Answer
    A. AddMouseMotionListner()
    Explanation
    The correct answer is addMouseMotionListener(). This method is used to register a mouse motion listener in Java. It allows the program to detect and respond to mouse motion events, such as when the mouse is moved or dragged. By using this method, the program can add a listener that will be notified whenever there is a mouse motion event, and perform the desired actions accordingly.

    Rate this question:

  • 10. 

    The URLConnection class can be used to read and write data to the specified resource referred by the URL?

    • True

    • False

    Correct Answer
    A. True
    Explanation
    The URLConnection class in Java provides a way to establish a connection to a specified resource referred to by a URL. It allows reading and writing data to and from the resource. Therefore, the statement that the URLConnection class can be used to read and write data to the specified resource referred by the URL is true.

    Rate this question:

  • 11. 

    TCP,FTP,Telnet,SMTP,POP etc. are examples of ? 

    • Socket

    • IP Address

    • Protocol

    • MAC Address

    Correct Answer
    A. Protocol
    Explanation
    TCP, FTP, Telnet, SMTP, POP, etc. are examples of protocols. A protocol is a set of rules and guidelines that govern the communication between devices in a network. Each of these protocols serves a specific purpose. TCP (Transmission Control Protocol) is responsible for establishing a reliable connection between devices. FTP (File Transfer Protocol) is used for transferring files between computers. Telnet is a protocol that allows remote login to a computer. SMTP (Simple Mail Transfer Protocol) is used for sending emails, and POP (Post Office Protocol) is used for retrieving emails from a mail server.

    Rate this question:

  • 12. 

    What is output of following program

    • The Internet address of the server

    • The Internet address of the client

    • The Internet address of the host

    • The Internet address of any other PC

    Correct Answer
    A. The Internet address of the host
    Explanation
    The output of the program will display the Internet address of the host.

    Rate this question:

  • 13. 

    UDP you just send packets of data (datagrams) to some IP address on the network

    • True

    • False

    Correct Answer
    A. True
    Explanation
    The given statement is true. UDP (User Datagram Protocol) is a connectionless protocol in which data is sent in the form of packets called datagrams. These datagrams are sent to a specific IP address on the network without establishing a connection beforehand. Unlike TCP, UDP does not guarantee delivery or order of the packets, making it a faster but less reliable protocol for transmitting data.

    Rate this question:

  • 14. 

    Identify missing statements in bellow mention codeimport java.sql.*;  class FetchRecord{  public static void main(String args[])throws Exception{      _____________________("sun.jdbc.odbc.JdbcOdbcDriver");      __________________con=DriverManager.getConnection("jdbc:odbc:mydsn1);  Statement stmt=con.createStatement(); int result =__________________("delete from emp where id=33");      System.out.println(result+" records affected");      ______________________    }} 

    • GetConnection(),Connection,forName

    • Class.forName,getConnection() ,mydsn1,Connection

    • Class.forName,Connection, stmt.executeUpdate , con.close();

    • Con.close();

    Correct Answer
    A. Class.forName,Connection, stmt.executeUpdate , con.close();
    Explanation
    The correct answer is "Class.forName,Connection, stmt.executeUpdate , con.close();". This answer is correct because it follows the correct sequence of statements to execute a SQL query. The first statement "Class.forName" is used to load the JDBC driver. The second statement "Connection" establishes a connection to the database. The third statement "stmt.executeUpdate" executes the SQL query to delete records from the "emp" table where the id is 33. The fourth statement "con.close()" closes the connection to the database.

    Rate this question:

  • 15. 

    Different types of JDBC drivers

    • JDBC-ODBC bridge driver

    • Native-API driver (partially java driver)

    • Network Protocol driver (fully java driver)

    • Native protocol (Thin driver)

    • All of the above

    Correct Answer
    A. All of the above
    Explanation
    The correct answer is "all of the above." This is because the question is asking about the different types of JDBC drivers, and all four options listed (JDBC-ODBC bridge driver, Native-API driver, Network Protocol driver, and Native protocol) are valid types of JDBC drivers. Each type of driver has its own characteristics and uses, but all of them are considered JDBC drivers.

    Rate this question:

  • 16. 

    Which of the method used to to get content type of this file?

    • ContentType()

    • ContentType()

    • GetContentType()

    • GetContentType()

    Correct Answer
    A. GetContentType()
    Explanation
    The correct answer is "getContentType()". This method is used to retrieve the content type of a file. It is likely a method provided by a programming language or framework that allows developers to access the metadata associated with a file, such as its content type.

    Rate this question:

  • 17. 

    What is the purpose of Jtable?

    • JTable object displays rows and columns of data.

    • JTable object displays rows of data with header.

    • JTable object displays columns of data

    • JTable object displays data in Table form with header detail.

    Correct Answer
    A. JTable object displays rows and columns of data.
    Explanation
    The purpose of JTable is to display rows and columns of data.

    Rate this question:

  • 18. 

    Which of these class is used to create servers that listen for either local or remote clientprograms?

    • httpServer

    • ServerSocket

    • Socket

    • HttpResponse

    Correct Answer
    A. ServerSocket
    Explanation
    The ServerSocket class is used to create servers that listen for either local or remote client programs. This class provides a mechanism for the server to listen for incoming client connections and accept them. Once a client connection is accepted, the server can then communicate with the client using input and output streams. Therefore, the ServerSocket class is the correct choice for creating servers that listen for client programs.

    Rate this question:

  • 19. 

    Which method is used to display icon on a component?  

    • RollOverIcon(ImageIcon i)

    • SetIcon(ImageIcon i)

    • DisplayIcon(ImageIcon i)

    • RemoveIcon (ImageIcon i )

    Correct Answer
    A. SetIcon(ImageIcon i)
    Explanation
    The setIcon(ImageIcon i) method is used to display an icon on a component.

    Rate this question:

  • 20. 

    Write a comment on following method Statement state = con.createStatement(); 

    • To empty the log

    • Creates statement object and returns it as the return value.

    • To prepare the statement

    • Creating url

    Correct Answer
    A. Creates statement object and returns it as the return value.
    Explanation
    The given method "Statement state = con.createStatement();" creates a new Statement object and assigns it to the variable "state". The method "createStatement()" is called on the "con" object, which is likely a connection to a database. This method is used to create a new Statement object that can be used to execute SQL queries on the database. The created Statement object is then returned as the return value of the method.

    Rate this question:

  • 21. 

    The ................................ method executes a simple query and returns a single Result Set object.

    • ExecuteUpdate()

    • ExecuteQuery()

    • Execute()

    • Noexecute()

    Correct Answer
    A. ExecuteQuery()
    Explanation
    The executeQuery() method is the correct answer because it is used to execute a simple query and retrieve a single Result Set object. This method is typically used when you want to retrieve data from a database, such as selecting records from a table. It returns a Result Set object that contains the data fetched from the database, which can then be processed further in the code.

    Rate this question:

  • 22. 

    Identify components used in below output

    • Applet, Label TextField

    • Label, TextField, Button

    • Applet, Button TextField

    • Grid Layout, Label, Button

    Correct Answer
    A. Label, TextField, Button
    Explanation
    The correct answer is Label, TextField, Button. This is because the output includes a label, a text field, and a button. These components are commonly used in graphical user interfaces to display text, allow user input, and trigger actions respectively. The other options mentioned, such as Applet and Grid Layout, are not components but rather layout managers that can be used to arrange components in a specific way.

    Rate this question:

  • 23. 

    The ............................. package contains classes that help in connecting to a database, sending SQL statements to the database, and processing the query results. 

    • Connection.sql

    • Db.sql

    • Javax.sql

    • Java.sql

    Correct Answer
    A. Java.sql
    Explanation
    The java.sql package contains classes that help in connecting to a database, sending SQL statements to the database, and processing the query results. This package provides the necessary tools and functionality for interacting with a database in Java applications. The classes in this package allow developers to establish database connections, execute SQL queries, retrieve and manipulate data, and handle database transactions. This package is essential for any Java application that needs to work with a database.

    Rate this question:

  • 24. 

    Which of these exception is thrown by URL class’s constructors?

    • URLNotFound

    • MalformedURLException

    • URLSourceNotFound

    • URLNotFoundException

    Correct Answer
    A. MalformedURLException
    Explanation
    The correct answer is MalformedURLException. The URL class's constructors throw this exception when a malformed URL is encountered. This means that the URL provided is not in the correct format, such as missing the protocol or having invalid characters. The MalformedURLException allows the programmer to handle this specific error and take appropriate action, such as displaying an error message to the user or logging the exception for debugging purposes.

    Rate this question:

  • 25. 

    Identify missing statements in given program

    • AdjustmentPerformed(AdjustmentEvent ae);

    • ItemStateChanged(ItemEvent ie);

    • ItemStateChanged(ActionEvent ie);

    • ActionPerformed(ActionEvent ae);

    Correct Answer
    A. ItemStateChanged(ItemEvent ie);
    Explanation
    The missing statement in the given program is actionPerformed(ActionEvent ae). This is because the other three methods (adjustmentPerformed, itemStateChanged with ItemEvent, and itemStateChanged with ActionEvent) are already declared and mentioned in the program. However, actionPerformed with ActionEvent is missing, indicating that it needs to be included in the program.

    Rate this question:

  • 26. 

    ____________________to call stored procedures from within a JDBC application

    • CallableStatement

    • Statement

    • PreparedStatement

    • ExcuteStatement

    Correct Answer
    A. CallableStatement
    Explanation
    A CallableStatement is used to call stored procedures from within a JDBC application. It provides a way to execute SQL statements that may contain input and output parameters. Unlike a regular Statement or PreparedStatement, a CallableStatement is specifically designed for executing stored procedures. It allows the application to pass input parameters to the stored procedure and retrieve output parameters or result sets returned by the stored procedure. Therefore, the correct answer is CallableStatement.

    Rate this question:

  • 27. 

    Which of these class is used to encapsulate IP address and DNS?

    • DatagramPacket

    • URL

    • InetAddress

    • ContentHandler

    Correct Answer
    A. InetAddress
    Explanation
    InetAddress is the correct answer because it is a class in Java that is used to encapsulate both IP addresses and DNS names. It provides methods to retrieve and manipulate IP addresses and perform DNS lookups. This class is commonly used in networking applications to identify and communicate with remote hosts using their IP addresses or DNS names.

    Rate this question:

  • 28. 

    Select appropriate code for the given output 

    • Code1

    • Code2

    • Code3

    • Code4

    Correct Answer
    A. Code1
  • 29. 

    Which of following statements loads the JDBC-ODBC driver?

    • Class.forName (sun.jdbc.odbc.JdbcOdbcDriver)

    • Class.forName (“sun.jdbc.odbc.JdbcOdbcDriver”)

    • Class.loadClass (“sun.jdbc.odbc.JdbcOdbcDriver”)

    • Class.loadClass (sun.jdbc.odbc.JdbcOdbcDriver)

    Correct Answer
    A. Class.forName (“sun.jdbc.odbc.JdbcOdbcDriver”)
    Explanation
    The correct answer is Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"). This statement is used to load the JDBC-ODBC driver by specifying the fully qualified name of the driver class as a string parameter. The Class.forName method is used to dynamically load the driver class at runtime, and in this case, it loads the JDBC-ODBC driver.

    Rate this question:

  • 30. 

    Select the statement to add in program to get correct output

    • C.createStatement( )

    • S.executeUpdate()

    • S.close()

    • C.close()

    Correct Answer
    A. S.executeUpdate()
    Explanation
    The statement "s.executeUpdate()" should be added in the program to get the correct output. This statement is used to execute the SQL statement in the program and update the database. It is typically used for statements that modify the data in the database, such as INSERT, UPDATE, or DELETE statements.

    Rate this question:

  • 31. 

    Which of these constant value will change when the button at the end of scroll bar was clicked to increase its value? 

    • BLOCK_DECREMENT

    • BLOCK_INCREMENT

    • UNIT_DECREMENT

    • UNIT_INCREMENT

    Correct Answer
    A. UNIT_INCREMENT
    Explanation
    When the button at the end of the scroll bar is clicked to increase its value, the constant value that will change is UNIT_INCREMENT. This constant represents the amount by which the scroll bar value will increase when the button is clicked.

    Rate this question:

  • 32. 

    What is a listener in context to event handling?

    • A listener is a variable that is notified when an event occurs.

    • A listener is a object that is notified when an event occurs.

    • A listener is a method that is notified when an event occurs.

    • None of the mentioned

    Correct Answer
    A. A listener is a object that is notified when an event occurs.
    Explanation
    A listener is an object that is notified when an event occurs. This means that when a specific event takes place, the listener object is informed and can perform certain actions or execute specific code in response to that event. The listener acts as a callback mechanism, allowing the program to respond dynamically to events as they happen.

    Rate this question:

  • 33. 

    Which of these methods can be used to determine the type of adjustment event? 

    • getType()

    • GetEventType()

    • GetAdjustmentType()

    • GetEventObjectType()

    Correct Answer
    A. GetAdjustmentType()
    Explanation
    The method getAdjustmentType() can be used to determine the type of adjustment event. This method specifically retrieves the adjustment type associated with the event. The other methods getType(), getEventType(), and getEventObjectType() may retrieve different information about the event, but they do not specifically provide the adjustment type. Therefore, getAdjustmentType() is the correct method to use in order to determine the type of adjustment event.

    Rate this question:

  • 34. 

     which AWT component is used to create popup list of string items from which only one can be selected at a time. 

    • List

    • Choice

    • MenuBar

    • Scrollbar

    Correct Answer
    A. Choice
    Explanation
    The Choice component in AWT is used to create a popup list of string items from which only one can be selected at a time. It allows the user to select a single item from a list of options provided. This component is commonly used in forms or menus where the user needs to make a single selection from a predefined set of options.

    Rate this question:

  • 35. 

    Which is the passive control 

    • Checkbox

    • Scrollbar

    • Label

    • Button

    Correct Answer
    A. Label
    Explanation
    The correct answer is Label because a label is a passive control that is used to display text or information. It does not have any interactive functionality or control over user input. The other options, such as Checkbox, Scrollbar, and Button, are all active controls that allow the user to interact with them and perform specific actions.

    Rate this question:

  • 36. 

    What is the output of this program?
      import java.net.*;class networking {public static void main(String[] args) throws MalformedURLException {URL obj = new URL("http://www.sanfoundry.com/javamcq");System.out.print(obj.getPort());}}

      • 1

      • 0

      • -1

      • Garbage value

      Correct Answer
      A. -1
      Explanation
      The program creates a new URL object with the given URL "http://www.sanfoundry.com/javamcq". The getPort() method is then called on this object. Since the URL does not specify a port number, the getPort() method returns -1.

      Rate this question:

    1. 37. 

      The ........................ object allows you to execute parametrized queries.

      • ResultSet

      • Parametrized

      • PreparedStatement

      • CalableStatement

      Correct Answer
      A. PreparedStatement
      Explanation
      The PreparedStatement object allows you to execute parametrized queries. It is a precompiled SQL statement that can accept input parameters, which are placeholders for values that will be supplied at runtime. This allows for efficient execution of repeated queries with different parameter values, as the statement is only compiled once and can be reused. The PreparedStatement also provides protection against SQL injection attacks by automatically escaping special characters in the parameter values.

      Rate this question:

    2. 38. 

      What is output of following program

      • Google

      • Http://www.google.com

      • Www.google.com

      • Google.com

      Correct Answer
      A. Http://www.google.com
      Explanation
      The given program outputs "http://www.google.com" because it is the only entry in the program that starts with "http://" and ends with ".com". The other entries do not meet this criteria, so they are not included in the output.

      Rate this question:

    3. 39. 

       import java.sql.*;  class FetchRecord{  public static void main(String args[])throws Exception{      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");      Connection con=DriverManager.getConnection("jdbc:odbc:mydsn1);   Statement stmt=con.createStatement();ResultSet rs=stmt.executeQuery("select * from emp");  rs.absolute(3);  System.out.println("FName="+rs.getString(1)+"LName="+rs.getString(2));    con.close();  }}  

      • It return all data records from emp table

      • It return all data,and print FName,LName from emp table

      • Print only row 3 value and print FName,LName from emp table

      • None of the above

      Correct Answer
      A. Print only row 3 value and print FName,LName from emp table
      Explanation
      The given code connects to a database using JDBC and executes a select query to fetch all records from the "emp" table. After executing the query, the code uses the "rs.absolute(3)" method to move the cursor to the third row of the result set. Then, it prints the values of the first and second columns (FName and LName) from that row. Therefore, the correct answer is "print only row 3 value and print FName, LName from emp table."

      Rate this question:

    4. 40. 

      Which of these methods can be used to determine the type of event? 

      • GetID()

      • GetSource()

      • GetEvent()

      • GetEventObject()

      Correct Answer
      A. GetID()
      Explanation
      The method getID() can be used to determine the type of event. This is because the ID of an event can provide information about the type or category of the event. By calling the getID() method, we can retrieve the ID associated with the event and use it to identify the type of event that occurred.

      Rate this question:

    5. 41. 

      Which of these class is necessary to implement datagrams?

      • DatagramPacket

      • DatagramSocket

      • Only DatagramSocket

      • Both A & B

      Correct Answer
      A. Both A & B
      Explanation
      Both the DatagramPacket and DatagramSocket classes are necessary to implement datagrams. The DatagramPacket class represents a datagram packet, which is essentially a container for a message that can be sent over a network. The DatagramSocket class, on the other hand, is responsible for creating a socket that can send and receive datagram packets. Therefore, to implement datagrams, both classes are required.

      Rate this question:

    6. 42. 

      Which methods are commonly used in ServerSocket class?

      • Public OutputStream getOutputStream()

      • Public synchronized void close()

      • Public Socket accept()

      • None of the above

      Correct Answer
      A. Public Socket accept()
      Explanation
      The correct answer is "public Socket accept()". This method is commonly used in the ServerSocket class to accept incoming client connections. It waits until a client connection is made and returns a Socket object representing that connection. This allows the server to communicate with the client using the returned Socket object. The other methods mentioned, getOutputStream() and close(), are not commonly used in the ServerSocket class.

      Rate this question:

    7. 43. 

      Which of these is superclass of all Adapter classes? 

      • Applet

      • Component

      • Event

      • InputEvent

      Correct Answer
      A. Applet
      Explanation
      The superclass of all Adapter classes is Component. The Applet class is a subclass of the Component class, so it is not the superclass. Event and InputEvent are not related to the Adapter classes.

      Rate this question:

    8. 44. 

      What is JDBC?

      • Java compiler

      • Java interpreter

      • Java API

      • Both A and B

      Correct Answer
      A. Java API
      Explanation
      JDBC stands for Java Database Connectivity, which is a Java API that allows Java programs to interact with databases. It provides a set of classes and methods for executing SQL statements, connecting to databases, and retrieving and manipulating data. The correct answer is "Java API" because JDBC is an API specifically designed for database connectivity in Java.

      Rate this question:

    9. 45. 

      To delete the records from database, use the following sequence of the part of coding: 

      • String b = ""delete from emp where ID=1""; PreparedStatement ps=con.prepareStatement(b);ps.executeUpdate();

      • String b = ""delete from emp where ID=1""; PreparedStatement ps=con.prepareStatement(b);ps.Update();

      • String b = ""delete from emp where ID=1""; PreparedStatement ps=con.prepareStatement(b) ;s.executeQuery();

      • String b = ""drop table from emp where ID=1""; PreparedStatement ps=con.prepareStatement(b); s.executeUpdate();

      Correct Answer
      A. String b = ""delete from emp where ID=1""; PreparedStatement ps=con.prepareStatement(b);ps.executeUpdate();
      Explanation
      The correct answer is the first option: String b = "delete from emp where ID=1"; PreparedStatement ps=con.prepareStatement(b);ps.executeUpdate(); This sequence of code uses the correct syntax to delete records from the "emp" table where the ID is equal to 1. The PreparedStatement is used to execute the SQL statement and the executeUpdate() method is used to perform the actual deletion.

      Rate this question:

    10. 46. 

      • URL Class

      • URLConnection Class URLConnection Class URLConnection Class

      • Connection Class

      • ConnectionUrl Class

      Correct Answer
      A. URLConnection Class URLConnection Class URLConnection Class
    11. 47. 

      What is the default length of the queue in following constructor of Serversocket? ServerSocket(int portno)

      • 50

      • 25

      • 30

      • 40

      Correct Answer
      A. 50
      Explanation
      The default length of the queue in the ServerSocket constructor with the parameter int portno is 50. This means that the ServerSocket can accept up to 50 incoming connections before it starts rejecting new connections.

      Rate this question:

    12. 48. 

      Identify the error in given program

      • Error in statement in which JScrollPane is created

      • Error in statement in which applet tag is declared

      • Error in statement in which JTable is created

      • None of the above

      Correct Answer
      A. Error in statement in which JTable is created
      Explanation
      The error in the given program is in the statement where the JTable is created.

      Rate this question:

    13. 49. 

      How many types of controls does AWT supports these controls are subclasses of component?

      • 5

      • 7

      • 6

      • 8

      Correct Answer
      A. 7
      Explanation
      AWT (Abstract Window Toolkit) supports 7 types of controls, which are subclasses of the Component class. These controls include Button, Checkbox, Choice, Label, List, TextArea, and TextField. Each control serves a different purpose and allows for user interaction in a graphical user interface.

      Rate this question:

    Quiz Review Timeline (Updated): Mar 22, 2023 +

    Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

    • Current Version
    • Mar 22, 2023
      Quiz Edited by
      ProProfs Editorial Team
    • Feb 23, 2017
      Quiz Created by
      RSH_AJP
    Back to Top Back to top
    Advertisement
    ×

    Wait!
    Here's an interesting quiz for you.

    We have other quizzes matching your interest.