Trivia Quiz On Distributed Computing In Java

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Vietha
V
Vietha
Community Contributor
Quizzes Created: 11 | Total Attempts: 9,614
Questions: 65 | Attempts: 606

SettingsSettingsSettings
Trivia Quiz On Distributed Computing In Java - Quiz

Java is a programming language that is used by most of the techies. This language can be used in different platforms and is quite easy to understand, write, and debug when compared to others. Below is a trivia quiz that is designed to test your understanding of distributing computing in Java language. Give it a try and see if you get it!


Questions and Answers
  • 1. 

    Which statements are true?- 3 choices

    • A.

      TCP is a connection-based protocol that provides a reliable flow of data between two computer.

    • B.

      You do not write programs at the lower level like application, instead you generally program at the transport level.

    • C.

      Java provides the java.net package which contains all the necessary classes to perform system-independent network communications.

    • D.

      TCP guarantees that data sent from one end of the connection is received at the other end.

    • E.

      The first layer in the TCP protocol is the network layer.

    Correct Answer(s)
    A. TCP is a connection-based protocol that provides a reliable flow of data between two computer.
    C. Java provides the java.net package which contains all the necessary classes to perform system-independent network communications.
    D. TCP guarantees that data sent from one end of the connection is received at the other end.
    Explanation
    The given answer is correct because it accurately states that TCP is a connection-based protocol that ensures reliable data flow between two computers. It also correctly mentions that Java provides the java.net package, which includes the necessary classes for system-independent network communications. Additionally, it correctly states that TCP guarantees the successful reception of data sent from one end of the connection to the other.

    Rate this question:

  • 2. 

    Which statements are true?

    • A.

      Once the pattern is applied to the MessageFormat instances, you invoke the getString();

    • B.

      The MessageFormat class can be used to create a compound message.

    • C.

      The applyPatern() method is used to fetch an element from the Resource Bundle

    • D.

      A template is a string, which contained only the fixed part of the message.

    • E.

      The date and numeric values contained in a message need not to be translated.

    Correct Answer
    B. The MessageFormat class can be used to create a compound message.
    Explanation
    The MessageFormat class can be used to create a compound message. This means that it allows for the creation of messages that contain dynamic elements, such as variables or placeholders, that can be replaced with actual values at runtime. This is useful for situations where the message needs to be customized or personalized based on specific data or conditions.

    Rate this question:

  • 3. 

    This is responsible for determining whether the component should react to any input events from input devices such as the keyboard or mouse.

    • A.

      View

    • B.

      Controller

    Correct Answer
    B. Controller
    Explanation
    The controller is responsible for determining whether the component should react to any input events from input devices such as the keyboard or mouse. It acts as the intermediary between the view and the model, receiving input from the user and updating the model accordingly. In this case, the controller decides how the component should respond to input events and triggers the appropriate actions or updates.

    Rate this question:

  • 4. 

    Event handling of JTextField are:

    • A.

      AddFocusListener(new FocusListener(){ public void focusGained(FocusEvent fe){ } public void focusLost(FocusEvent ev){ } });

    • B.

      AddItemListenner(new ItemListenner(){ public void itemStateChanged(ItemEvent e){ } });

    Correct Answer
    A. AddFocusListener(new FocusListener(){ public void focusGained(FocusEvent fe){ } public void focusLost(FocusEvent ev){ } });
    Explanation
    The correct answer is "addFocusListener(new FocusListener(){ public void focusGained(FocusEvent fe){ } public void focusLost(FocusEvent ev){ } });". This is the correct answer because it shows the correct syntax for adding a focus listener to a JTextField. The focus listener is used to handle events when the JTextField gains or loses focus. The code provided correctly implements the focusGained and focusLost methods, which will be executed when the corresponding events occur.

    Rate this question:

  • 5. 

    Lightweight components includes:- 3 choices

    • A.

      JPanel, FormattedTextField

    • B.

      JFrame,

    • C.

      JCheckBox, JRadioButton

    • D.

      JButton,JPasswordTextField

    • E.

      JLabel

    Correct Answer(s)
    C. JCheckBox, JRadioButton
    D. JButton,JPasswordTextField
    E. JLabel
    Explanation
    The correct answer includes JCheckBox, JRadioButton, JButton, JPasswordTextField, and JLabel. These components are considered lightweight because they are implemented entirely in Java and do not rely on the underlying operating system. They are more efficient in terms of memory usage and performance compared to heavyweight components, which are dependent on the operating system for rendering.

    Rate this question:

  • 6. 

    If an error occurs when creating a socket an IOException is thrown.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    When creating a socket, various errors can occur such as network issues, invalid arguments, or a failure to establish a connection. In Java, these errors are represented by IOException, which is a checked exception. This means that if any error occurs during socket creation, the code must handle or declare this exception. Therefore, the statement "If an error occurs when creating a socket an IOException is thrown" is true.

    Rate this question:

  • 7. 

    Event Handling of JComboBox is :- 2 choices

    • A.

      AddListSelectionListener

    • B.

      ListSelectionListener Vs valueChanged()

    • C.

      ActionListener() Vs actionPerformed()

    • D.

      AddActionListener

    Correct Answer(s)
    C. ActionListener() Vs actionPerformed()
    D. AddActionListener
    Explanation
    The correct answer is ActionListener() Vs actionPerformed(),addActionListener.

    This is because the JComboBox component in Java Swing allows users to select an item from a drop-down list. To handle events related to the JComboBox, we need to use an ActionListener interface and its corresponding actionPerformed() method. This method is called when the user selects an item from the JComboBox. To register the ActionListener with the JComboBox, we use the addActionListener() method. Therefore, the correct answer is ActionListener() Vs actionPerformed(),addActionListener.

    Rate this question:

  • 8. 

    Which statements are true?- 3 choices

    • A.

      The java.rmi.Remote interface server to distinguish interfaces which are non remote.

    • B.

      A RMI application has to expose methods, which remote clients can invoke.

    • C.

      The java.rmi.Remote is a maker interface.

    • D.

      The skeleton resides on the client side.

    • E.

      The stub resides on the server side.

    Correct Answer(s)
    A. The java.rmi.Remote interface server to distinguish interfaces which are non remote.
    B. A RMI application has to expose methods, which remote clients can invoke.
    C. The java.rmi.Remote is a maker interface.
    Explanation
    The given answer is correct because it accurately identifies the statements that are true. The java.rmi.Remote interface is used to distinguish interfaces that are non-remote. A RMI application must expose methods that remote clients can invoke. The java.rmi.Remote interface is a marker interface.

    Rate this question:

  • 9. 

    If the host does not exist,  the Constructor Socket(String host,int port); will throws .........

    • A.

      An UnknownHostException

    • B.

      An IOException

    Correct Answer
    A. An UnknownHostException
    Explanation
    The Constructor Socket(String host,int port); will throw an UnknownHostException if the host does not exist. This exception is thrown when the IP address of the host cannot be determined or if the host name is invalid. It indicates that the host is not recognized or cannot be reached, causing the connection to fail.

    Rate this question:

  • 10. 

    TCP (Transmission Control Protocol) includes:- 3 choices

    • A.

      Port 20 FTP, Port 21 FTP

    • B.

      Port 161 SNMP

    • C.

      Port 23 Telnet

    • D.

      Port 162 SNMP

    • E.

      Port 25 SMTP

    Correct Answer(s)
    A. Port 20 FTP, Port 21 FTP
    C. Port 23 Telnet
    E. Port 25 SMTP
    Explanation
    TCP (Transmission Control Protocol) is a widely used protocol in computer networking. It ensures reliable and ordered delivery of data packets between devices over a network. The given answer includes the correct ports associated with specific protocols. Port 20 and Port 21 are used for FTP (File Transfer Protocol), which is commonly used for transferring files between a client and a server. Port 23 is used for Telnet, a protocol that allows remote access to a device's command-line interface. Port 25 is used for SMTP (Simple Mail Transfer Protocol), which is responsible for sending email messages between servers.

    Rate this question:

  • 11. 

    Which statements are true?- 2 choices

    • A.

      The port numbers ranging from 0 to 1023 are reserved

    • B.

      The physical connection is logically numbered within a range of 0 to 65500

    • C.

      The destination address identifiers the computer

    Correct Answer(s)
    A. The port numbers ranging from 0 to 1023 are reserved
    C. The destination address identifiers the computer
    Explanation
    The first statement is true because port numbers ranging from 0 to 1023 are indeed reserved for well-known services and protocols. The second statement is false because the physical connection is not logically numbered within a range of 0 to 65500. The third statement is true because the destination address in networking identifies the computer or device that the data is being sent to.

    Rate this question:

  • 12. 

    Which a three layered architecture is based on?

    • A.

      Stub and Skeleton Layer

    • B.

      Stub Reference Layer

    • C.

      Remote Reference Layer

    • D.

      Transport Reference Layer

    • E.

      Transport Protocol Layer

    Correct Answer(s)
    A. Stub and Skeleton Layer
    C. Remote Reference Layer
    E. Transport Protocol Layer
    Explanation
    The correct answer is the Stub and Skeleton Layer, Remote Reference Layer, and Transport Protocol Layer. The three-layered architecture is based on these layers which are responsible for different functionalities. The Stub and Skeleton Layer handles the communication between the client and server by generating stubs and skeletons. The Remote Reference Layer manages the remote object references and handles the object communication. The Transport Protocol Layer ensures the reliable delivery of messages between the client and server using various protocols.

    Rate this question:

  • 13. 

    Which statements are true?

    • A.

      Internationalized software is developed separately for each country and language.

    • B.

      Successful translation of the source files in the desired language is very difficult.

    • C.

      Cost of development of the product in the desired language will be much lower than one time cost.

    • D.

      Internationalized software should be developed such that it can be adapted without engineering changes

    • E.

      Internationalization is process of the designing an application so that it can adapt to various.

    Correct Answer(s)
    B. Successful translation of the source files in the desired language is very difficult.
    D. Internationalized software should be developed such that it can be adapted without engineering changes
    E. Internationalization is process of the designing an application so that it can adapt to various.
    Explanation
    The answer is correct because it accurately identifies the true statements among the given options. It states that successful translation of the source files in the desired language is very difficult, which is true because translation requires linguistic and cultural understanding. It also states that internationalized software should be developed such that it can be adapted without engineering changes, which is true because it allows for easy localization. Lastly, it mentions that internationalization is the process of designing an application so that it can adapt to various languages and cultures, which is true as internationalization involves making software flexible and adaptable.

    Rate this question:

  • 14. 

    JList can be supported scrolling inherently by JScrollPane as JComboBox

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The given statement is false. While JScrollPane can support scrolling for JList, JComboBox cannot inherently support scrolling. JScrollPane is specifically designed to provide a scrollable view for components like JList, JTable, and JTextArea. However, JComboBox is a drop-down list that displays a single item at a time and does not have built-in scrolling functionality.

    Rate this question:

  • 15. 

    This layer is responsible for setting up connections using sockets.It listens for incoming calls, and manages requests from remote reference layer

    • A.

      Stub and Skeleton Layer

    • B.

      Transport Protocol Layer

    • C.

      Remote Reference Layer

    Correct Answer
    B. Transport Protocol Layer
    Explanation
    The Transport Protocol Layer is responsible for setting up connections using sockets and managing requests from the remote reference layer. It listens for incoming calls and ensures the reliable delivery of data between the communicating systems. This layer handles the segmentation and reassembly of data, as well as error detection and correction. It provides end-to-end communication services and ensures the proper flow control and congestion control mechanisms are in place.

    Rate this question:

  • 16. 

    Which statements  are True?

    • A.

      A sever must retrieve the InputStream and OutputStream from the proxy socket object to comunicate with the client.

    • B.

      When a client requests, the accept() method creates an object of class ServerSocket and return it.

    • C.

      The accept() method is a blocking method.

    • D.

      The ServerSocket class has a method clientAccept() for listening to client request.

    • E.

      The accept method, once invoked, will wait till a client request for a connection.

    Correct Answer(s)
    A. A sever must retrieve the InputStream and OutputStream from the proxy socket object to comunicate with the client.
    C. The accept() method is a blocking method.
    E. The accept method, once invoked, will wait till a client request for a connection.
    Explanation
    To communicate with the client, a server must retrieve the InputStream and OutputStream from the proxy socket object. The accept() method in the ServerSocket class is a blocking method, meaning it will wait until a client requests a connection. Once the accept method is invoked, it will continue to wait until a client request is received. However, there is no method called clientAccept() in the ServerSocket class.

    Rate this question:

  • 17. 

    This is a protocol that sends independent package of data, called datagrams, from one computer to another with no quarantee about its transmission. it is not connect - based protocol.

    • A.

      TCP

    • B.

      UDP

    Correct Answer
    B. UDP
    Explanation
    UDP (User Datagram Protocol) is a protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantee of its transmission. Unlike TCP (Transmission Control Protocol), UDP is not a connection-based protocol. It is commonly used for applications that require fast and efficient transmission of data, such as streaming media, online gaming, and DNS (Domain Name System) queries. UDP does not provide error checking or retransmission of lost packets, making it less reliable but faster than TCP.

    Rate this question:

  • 18. 

    The root panel has four parts :

    • A.

      Glass Panel,Content Panel

    • B.

      JPanel

    • C.

      Layered Panel

    • D.

      ToolBar Panel

    • E.

      Menu Bar

    Correct Answer(s)
    A. Glass Panel,Content Panel
    C. Layered Panel
    E. Menu Bar
    Explanation
    The root panel in this question has four parts: Glass Panel, Content Panel, Layered Panel, and Menu Bar. These components are typically used in graphical user interfaces to provide different functionalities. The Glass Panel is a transparent panel that can be used to overlay other components. The Content Panel is the main area where the application's content is displayed. The Layered Panel is used to layer components on top of each other. And finally, the Menu Bar provides a set of menus and options for the user to interact with the application.

    Rate this question:

  • 19. 

    Which methods is used for registering listener-objects of JCheckBox ?

    • A.

      AddActionListener();

    • B.

      AddItemListener();

    Correct Answer(s)
    A. AddActionListener();
    B. AddItemListener();
    Explanation
    The correct answer is AddActionListener(); and AddItemListener();. These methods are used for registering listener-objects of JCheckBox. The AddActionListener() method is used to register an ActionListener, which is invoked when the checkbox is selected or deselected. The AddItemListener() method is used to register an ItemListener, which is invoked when the state of the checkbox changes. By using these methods, listener-objects can be registered to perform specific actions based on the checkbox events.

    Rate this question:

  • 20. 

    Which statements are true?

    • A.

      The Java Foundation Class were introduced since JDK 1.0

    • B.

      The JFC includes 2D graphics support.

    • C.

      Swing is based on a tookit.

    • D.

      Swing supports a technology called "Pluggable Like and Feel"

    • E.

      JFC is a graphical framework

    Correct Answer(s)
    B. The JFC includes 2D graphics support.
    E. JFC is a graphical framework
    Explanation
    The JFC (Java Foundation Class) includes 2D graphics support, allowing developers to create and manipulate 2D graphics in their Java applications. Additionally, the JFC is a graphical framework, providing a set of classes and components for building graphical user interfaces (GUIs) in Java. These statements are true and accurately describe the features and purpose of the JFC.

    Rate this question:

  • 21. 

    Event handling of JTextArea is:

    • A.

      None - Event Handling.

    • B.

      AddFocusListener(new FocusListener(){ public void focusGained(FocusEvent fe){ } public void focusLost(FocusEvent ev){ } });

    • C.

      AddActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ev){ } });

    Correct Answer
    C. AddActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ev){ } });
    Explanation
    The correct answer is "addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ev){ } });". This is because JTextArea does not have a built-in action event, so in order to handle events when the user interacts with the JTextArea, an ActionListener needs to be added. The actionPerformed method within the ActionListener is where the code for handling the event should be written.

    Rate this question:

  • 22. 

    This is a Java program which is meant to run as a part of a web page.

    • A.

      JFrame

    • B.

      JApplet

    • C.

      JDialog

    • D.

      JPanel

    • E.

      JWindow

    Correct Answer
    B. JApplet
    Explanation
    This Java program is designed to run as a part of a web page. JApplet is a class in Java that allows you to create applets, which are small applications that can be embedded within a web page. Therefore, using JApplet would be the correct choice for running this program as a part of a web page.

    Rate this question:

  • 23. 

    Which statements are true?- 4 choices

    • A.

      The getCurrencyInstance() returns an instance of a NumberFormat class initialized to the specified locale.

    • B.

      The argument passed can only be primitive data type.

    • C.

      The getCurrencyInstance() takes an instance of Locale class as an argument.

    • D.

      The date and time format need not conform to the conventions of the end user's Locale

    • E.

      Formatting the captions of the GUI components ensures that the look and feel of the application is in a locale-sensitive manner.

    Correct Answer(s)
    A. The getCurrencyInstance() returns an instance of a NumberFormat class initialized to the specified locale.
    C. The getCurrencyInstance() takes an instance of Locale class as an argument.
    D. The date and time format need not conform to the conventions of the end user's Locale
    E. Formatting the captions of the GUI components ensures that the look and feel of the application is in a locale-sensitive manner.
    Explanation
    The getCurrencyInstance() method returns an instance of the NumberFormat class that is initialized with the specified locale. This means that the formatting of currency values will be based on the conventions of the specified locale. The method does not only accept primitive data types as arguments, but it can also accept an instance of the Locale class. The statement about date and time format not needing to conform to the end user's locale is also true. Lastly, formatting the captions of GUI components ensures that the application's look and feel is sensitive to the locale.

    Rate this question:

  • 24. 

    This depicts the graphical part on the screen.It takes the data and various states from the Other part to render the component's graphical part.

    • A.

      Controller

    • B.

      View

    • C.

      Model

    Correct Answer
    B. View
    Explanation
    The given correct answer is "View". In the context of software development, the View is responsible for the graphical part on the screen. It takes data and various states from the Model and Controller to render the component's graphical part. The View is responsible for displaying the user interface and presenting information to the user.

    Rate this question:

  • 25. 

    This is used to create a GUI-based application. It is available in the javax.swing package.

    • A.

      JFrame

    • B.

      JApplet

    • C.

      JPanel

    Correct Answer
    A. JFrame
    Explanation
    JFrame is the correct answer because it is a class in the javax.swing package that is used to create a GUI-based application. It provides a window for the application and contains various methods and components for creating a graphical user interface. JFrame is commonly used as the main container for GUI applications and allows developers to add and arrange other components such as buttons, labels, and text fields.

    Rate this question:

  • 26. 

    This class is both a container and a components.

    • A.

      JWindow

    • B.

      JApple

    • C.

      JFrame

    • D.

      JDialog

    • E.

      JPanel

    Correct Answer
    E. JPanel
    Explanation
    The correct answer is JPanel because it is a class in Java that can act as both a container and a component. It can be used to group other components together and also be added to other containers. This makes it a versatile class for creating user interfaces in Java applications.

    Rate this question:

  • 27. 

    Event handling of JCheckBox are:

    • A.

      AddItemListenner(new ItemListenner(){ public void itemStateChanged(ItemEvent e){ } });

    • B.

      AddActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ev){ } });

    • C.

      AddFocusListener(new FocusListener(){ public void focusGained(FocusEvent fe){ } });

    Correct Answer(s)
    A. AddItemListenner(new ItemListenner(){ public void itemStateChanged(ItemEvent e){ } });
    B. AddActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ev){ } });
    Explanation
    The correct answer is to use the "addItemListener" method to add an ItemListener to the JCheckBox. This method allows you to listen for changes in the state of the checkbox, such as when it is selected or deselected. The provided code correctly creates an anonymous inner class that implements the ItemListener interface and overrides the "itemStateChanged" method. This method will be called whenever the state of the checkbox changes. The other two options, addActionListener and addFocusListener, are not relevant for handling events of a JCheckBox.

    Rate this question:

  • 28. 

    Event Handling of JList are:- 3 choices.

    • A.

      ActionListener interface.

    • B.

      ListSelectionListener

    • C.

      ActionPerformed() method

    • D.

      ValueChanged(); method

    • E.

      AddListSelectionListener()

    Correct Answer(s)
    B. ListSelectionListener
    D. ValueChanged(); method
    E. AddListSelectionListener()
    Explanation
    The correct answer is ListSelectionListener, valueChanged(); method, addListSelectionListener(). JList is a Swing component in Java that displays a list of items. To handle events related to JList, we can use the ListSelectionListener interface. This interface provides the valueChanged() method which is called whenever the selection in the JList changes. To register the ListSelectionListener with the JList, we use the addListSelectionListener() method. Therefore, ListSelectionListener, valueChanged(); method, and addListSelectionListener() are the correct choices for event handling of JList.

    Rate this question:

  • 29. 

    Which statements are true?-  2 choices

    • A.

      The translation of text is the least time - consuming part of the localization process.

    • B.

      Localization is the process of adapting software for a specific region.

    • C.

      Textual elements are stored outside the source code and retrieved dynamically.

    • D.

      Textual elements such as label and messages for GUI components are hard-coded in the program.

    • E.

      Support for new languages require recompilation

    Correct Answer(s)
    B. Localization is the process of adapting software for a specific region.
    C. Textual elements are stored outside the source code and retrieved dynamically.
    Explanation
    The first statement is false because the translation of text is not necessarily the least time-consuming part of the localization process. Other tasks such as adapting graphics, currency formats, and date formats can also be time-consuming.

    The second statement is true because localization is indeed the process of adapting software for a specific region. This includes translating text, adapting graphics, adjusting formats, and considering cultural differences.

    The third statement is true because textual elements are typically stored outside the source code, often in separate resource files, and retrieved dynamically during runtime.

    The fourth statement is false because textual elements such as labels and messages for GUI components are usually not hard-coded in the program. Instead, they are stored separately and retrieved dynamically.

    The fifth statement is false because adding support for new languages does not necessarily require recompilation. With proper design and internationalization practices, language support can be added without recompiling the entire program.

    Rate this question:

  • 30. 

    An Icon can be added as a corner component to the JScrollPane.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The statement is stating that it is possible to add an icon as a corner component to the JScrollPane. This means that users can customize the appearance of the scroll pane by adding an icon in one of the corners.

    Rate this question:

  • 31. 

    This is a Component which lets the user to select a numberic value within a bounded range.

    • A.

      JRadioButton

    • B.

      JButton

    • C.

      JSlider

    • D.

      JPanel

    Correct Answer
    C. JSlider
    Explanation
    A JSlider is a component that allows the user to select a numeric value within a bounded range. It provides a graphical representation of the range with a draggable thumb that can be moved along the track to select a desired value. This makes it suitable for scenarios where the user needs to choose a value within a specific range, such as setting a volume level or selecting a value on a scale. JRadioButton, JButton, and JPanel are not specifically designed for selecting numeric values within a range, making JSlider the correct answer.

    Rate this question:

  • 32. 

    Which statement is true?

    • A.

      JSlider SL; ............. SL.addChangeListener(new ChangeListener(){ public void stateChanged(ChangeEvent e){ // ction Code; } });

    • B.

      JSlider SL; ............. SL.addChangeListener(new ChangeListener(){ public void statechanged(ChangeEvent e){ // ction Code; } });

    • C.

      JSlider SL; ............. SL.addChangelistener(new ChangeListener(){ public void stateChanged(ChangeEvent e){ // ction Code; } });

    • D.

      JSlider SL; ............. SL.addChangeListener(new ChangeListener(){ public void stateChanged(Changeevent e){ // ction Code; } });

    Correct Answer
    A. JSlider SL; ............. SL.addChangeListener(new ChangeListener(){ public void stateChanged(ChangeEvent e){ // ction Code; } });
    Explanation
    The correct answer is the first option: JSlider SL; SL.addChangeListener(new ChangeListener(){ public void stateChanged(ChangeEvent e){ // ction Code; } }); The reason this is the correct answer is because it correctly uses the addChangeListener() method to add a ChangeListener to the JSlider component. The ChangeListener is implemented as an anonymous inner class, and the stateChanged() method is overridden to define the desired action code. The other options either have incorrect method names (statechanged() instead of stateChanged()) or incorrect parameter names (Changeevent instead of ChangeEvent), which would result in compilation errors.

    Rate this question:

  • 33. 

    This is as part of its view provides four corners where you can add components.

    • A.

      JLabel

    • B.

      JFrame

    • C.

      JScrollPane

    • D.

      JPanel

    Correct Answer
    C. JScrollPane
    Explanation
    The JScrollPane is the correct answer because it is a component in Java Swing that provides a scrollable view of a component. In this case, the question mentions that "it" (referring to something not specified) provides four corners where you can add components. The JScrollPane has four corners where you can add components, allowing you to customize the scrollable view as needed.

    Rate this question:

  • 34. 

    Valid values of orientation in Method of JSlider are:-2 choices.

    • A.

      SwingConstants.HORIZONTAL

    • B.

      Swing.Constant.HORIZONTAL

    • C.

      Swing.Constants.VERTICAL

    • D.

      Public void setOrientation(int orientation);

    • E.

      SwingConstants.VERTICAL

    Correct Answer(s)
    A. SwingConstants.HORIZONTAL
    E. SwingConstants.VERTICAL
    Explanation
    The valid values for the orientation parameter in the Method of JSlider are SwingConstants.HORIZONTAL and SwingConstants.VERTICAL. The SwingConstants class provides constants for specifying the orientation of components in Swing. In this case, the setOrientation method is used to set the orientation of the JSlider. The answer includes the correct values, SwingConstants.HORIZONTAL and SwingConstants.VERTICAL.

    Rate this question:

  • 35. 

    Any character (Character.isLetter).

    • A.

      ?

    • B.

      A

    • C.

      U

    • D.

      *

    Correct Answer
    A. ?
    Explanation
    The correct answer is "?" because the given statement "Any character (Character.isLetter)" implies that the answer can be any character that is a letter. Since "?" is a letter, it satisfies the condition and is therefore the correct answer.

    Rate this question:

  • 36. 

    The language code consisting of two or more letters in Lower case and the country code consisting of two letter in uper case.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The statement is false because the language code consists of two or more letters in lower case, but the country code consists of two letters in upper case.

    Rate this question:

  • 37. 

    If you have a slider with the range 0 to 20 and major tick spacing set to 10, then you you will get at 0,10, and 20. So that Method is:

    • A.

      Public void setMinorTickSpacing(int spacing)

    • B.

      Public void setMajorTickSpacing(int spacing)

    • C.

      Public void setSnapToTicks(boolean set)

    Correct Answer
    B. Public void setMajorTickSpacing(int spacing)
    Explanation
    The given correct answer is "public void setMajorTickSpacing(int spacing)". This method is used to set the spacing between major ticks on the slider. In this case, the major tick spacing is set to 10, so the slider will have ticks at positions 0, 10, and 20.

    Rate this question:

  • 38. 

    Which Statement is true?

    • A.

      JSlider sl; sl = new JSliDer(SwingConstant.VERTICAL,0,255,0);

    • B.

      JSlider sl; sl = new JSlider(SwingConstants.VERTICAL,0,255,0);

    • C.

      JSlider sl; sl = new JSlider(SwingConstant.VERTICAL,0,255,0);

    • D.

      JSlider sl; sl = new JSlider(Swingconstant.VERTICAL,0,255,0);

    Correct Answer
    B. JSlider sl; sl = new JSlider(SwingConstants.VERTICAL,0,255,0);
    Explanation
    The correct answer is "JSlider sl; sl = new JSlider(SwingConstants.VERTICAL,0,255,0);". This is the correct way to create a new JSlider object with the specified parameters. The SwingConstants.VERTICAL constant is used to set the orientation of the slider to vertical, and the values 0, 255, and 0 represent the minimum, maximum, and initial values of the slider respectively.

    Rate this question:

  • 39. 

    Common Methods of JScroPanel class are:-3 choices.

    • A.

      Public void setCorner(String key, component corner)

    • B.

      Public void setHorizontalScrollBarPolicy(int policy)

    • C.

      Public void setVerticalScrollBarPolicy(int policy)

    • D.

      Public void setHorizontalScrollBarPolicy(String key, policy)

    • E.

      Public void actionPerformed(ActionEvent e)

    Correct Answer(s)
    A. Public void setCorner(String key, component corner)
    B. Public void setHorizontalScrollBarPolicy(int policy)
    C. Public void setVerticalScrollBarPolicy(int policy)
    Explanation
    The correct answer is public void setCorner(String key, component corner), public void setHorizontalScrollBarPolicy(int policy), public void setVerticalScrollBarPolicy(int policy). These methods are commonly used in the JScroPanel class. The setCorner method is used to set the corner component for a specific key in the scroll pane. The setHorizontalScrollBarPolicy method is used to set the horizontal scroll bar policy, determining when the horizontal scroll bar should be displayed. The setVerticalScrollBarPolicy method is used to set the vertical scroll bar policy, determining when the vertical scroll bar should be displayed.

    Rate this question:

  • 40. 

    Which Statements are true?

    • A.

      A Swing Timer can fire only one ActionEvent

    • B.

      A Timer can be configured to fire events repeatedlly

    Correct Answer
    B. A Timer can be configured to fire events repeatedlly
    Explanation
    A Timer can be configured to fire events repeatedly because it is designed to schedule and execute tasks at specified intervals. By setting the initial delay and interval, the Timer can repeatedly fire ActionEvents at the specified time intervals. This allows for repetitive actions or tasks to be performed automatically without the need for manual intervention.

    Rate this question:

  • 41. 

    Any character (Character.isLetter). All lowercase letters are mapped to upper case.  in MaskFormatter class.

    • A.

      #

    • B.

      A

    • C.

      `

    • D.

      U

    • E.

      H

    Correct Answer
    D. U
    Explanation
    The given correct answer is "U" because in the MaskFormatter class, all lowercase letters are mapped to uppercase. This means that if any lowercase letter is entered as a character, it will be automatically converted to its uppercase equivalent.

    Rate this question:

  • 42. 

    Which statements are true?- 3 choice

    • A.

      A JDialog is a top-level container.

    • B.

      The container is physically constrained with the max size offered by the screen on which it display

    • C.

      To return the parent, it is required to close the modal dialog

    • D.

      If you click on the parent of the modal dialog box, it appears

    Correct Answer(s)
    A. A JDialog is a top-level container.
    B. The container is physically constrained with the max size offered by the screen on which it display
    C. To return the parent, it is required to close the modal dialog
    Explanation
    A JDialog is a top-level container means that it can be displayed independently of any other window or frame. The container being physically constrained with the max size offered by the screen on which it displays means that it cannot exceed the maximum size of the screen. To return the parent, it is required to close the modal dialog means that in order to access the parent window or frame, the modal dialog needs to be closed first.

    Rate this question:

  • 43. 

    Which statement are true?- 2 choices

    • A.

      It is not possible to use the String class to convert standard encoding systems to and from the Unicode system.

    • B.

      Unicode is a 32 bit character encoding system.

    • C.

      Unicode provides a unique number for every character irrespective of platform, program or language.

    • D.

      The java platform does not use Unicode as its native character encoding.

    • E.

      The primitive data type in java is base on Unicode encoding.

    Correct Answer(s)
    C. Unicode provides a unique number for every character irrespective of platform, program or language.
    E. The primitive data type in java is base on Unicode encoding.
    Explanation
    The first statement is false because the String class in Java does provide methods to convert between standard encoding systems and the Unicode system.

    The second statement is false because Unicode is actually a 16-bit character encoding system, not 32-bit.

    The third statement is true as Unicode assigns a unique number to every character, regardless of the platform, program, or language.

    The fourth statement is false because Java does use Unicode as its native character encoding.

    The fifth statement is true as the primitive data types in Java, such as char, are based on Unicode encoding.

    Rate this question:

  • 44. 

    This class is used to display a group of items.It allows you to choose one or more items., Items can be displayed in one or more columns.

    • A.

      JComboBox

    • B.

      JList

    • C.

      JTextare

    Correct Answer
    B. JList
    Explanation
    JList is the correct answer because it is a class in Java Swing that is used to display a group of items. It allows the user to choose one or more items from the list. The items in the list can be displayed in one or more columns. JComboBox is used to create a drop-down list of items, while JTextArea is used to create a multi-line text input area.

    Rate this question:

  • 45. 

    This is a Java object associated with a container which governs the placement and size of the component.

    • A.

      GridLayout

    • B.

      BorderLayout

    • C.

      Layout Manager

    • D.

      CardLayout

    • E.

      FlowLayout

    Correct Answer
    C. Layout Manager
    Explanation
    A layout manager is a Java object that is associated with a container and controls the placement and size of the components within that container. It determines how the components are arranged and displayed on the user interface. Different layout managers have different rules for positioning and resizing components. In this context, the correct answer is "Layout Manager" as it accurately describes the Java object responsible for managing the layout of components within a container.

    Rate this question:

  • 46. 

    This layout manager allows you to stack components one behind another.

    • A.

      BorderLayout

    • B.

      FlowLayout

    • C.

      CardLayout

    • D.

      GridLayout

    Correct Answer
    C. CardLayout
    Explanation
    CardLayout is a layout manager that allows you to stack components one behind another. It is useful when you want to switch between different components, such as displaying different panels or cards in a container. Each component is added to the layout with a unique name, and you can easily switch between them using methods like next() or show(). This layout manager is commonly used in GUI applications where you need to display different views or screens based on user interactions.

    Rate this question:

  • 47. 

    Which statements are true?- 3 choices

    • A.

      All the remote methods declared should be qualified to throw java.rmi.RemoteException.

    • B.

      Methods from other interfaces which are non-remote are available for clients to invoke.

    • C.

      The rmiregistry.exe application is available in the bin directory of the java home directory.

    • D.

      The remote interface extends from java.Remote interfaces

    • E.

      Remote clients can only invoke remote methods.

    Correct Answer(s)
    A. All the remote methods declared should be qualified to throw java.rmi.RemoteException.
    C. The rmiregistry.exe application is available in the bin directory of the java home directory.
    E. Remote clients can only invoke remote methods.
    Explanation
    The first statement is true because all remote methods declared in a remote interface should be qualified to throw java.rmi.RemoteException, as it is a checked exception required by the RMI system.

    The second statement is false because only methods from remote interfaces are available for clients to invoke. Methods from non-remote interfaces are not accessible to clients.

    The third statement is true as the rmiregistry.exe application is commonly found in the bin directory of the Java home directory, where it is used to start the RMI registry.

    The fourth statement is false because the remote interface does not extend from java.Remote interfaces. It extends from the java.rmi.Remote interface.

    The fifth statement is true as remote clients can only invoke remote methods, they cannot directly invoke methods on objects that are not remote.

    Rate this question:

  • 48. 

    Which statements are true?- 3 choices

    • A.

      MVC Architecture was first introduced in SmallTalk.

    • B.

      Model represents the view of the components

    • C.

      Controller reacts to the user inputs from Keyboard and Mouse

    • D.

      View represents the Data.

    • E.

      Separable Architecture combines the View and Controller.

    Correct Answer(s)
    A. MVC Architecture was first introduced in SmallTalk.
    C. Controller reacts to the user inputs from Keyboard and Mouse
    E. Separable Architecture combines the View and Controller.
    Explanation
    The first statement is true because MVC Architecture was indeed first introduced in SmallTalk. The second statement is true because the model represents the data and not the view of the components. The third statement is true because the controller is responsible for reacting to user inputs from the keyboard and mouse. The fourth statement is false because the view represents the components and not the data. The fifth statement is true because separable architecture combines the view and controller.

    Rate this question:

  • 49. 

    Which statements are true?

    • A.

      The JPanel is a container and not a component.

    • B.

      The setSize() method bring JFrame into realized state.

    • C.

      By default close operation of frame is not functional

    • D.

      Applet makes web pages more dynamic.

    • E.

      The stop() method of JApplet is invoked only once in life time of JApplet.

    Correct Answer(s)
    C. By default close operation of frame is not functional
    D. Applet makes web pages more dynamic.
    Explanation
    The first statement is false. The JPanel is a component, not a container. A container is a component that can contain other components, such as a JFrame or a JApplet.

    The second statement is false. The setSize() method sets the size of a component, not necessarily a JFrame. It does not bring a JFrame into a realized state.

    The third statement is true. By default, the close operation of a frame is not functional. This means that clicking the close button on the frame will not close the frame unless you explicitly set the default close operation using the setDefaultCloseOperation() method.

    The fourth statement is true. Applets are used to make web pages more dynamic by adding interactive content, such as animations, games, or interactive forms.

    The fifth statement is false. The stop() method of JApplet is invoked multiple times throughout the lifetime of the applet, not just once. It is called when the applet is stopped or when the web page that contains the applet is closed.

    Rate this question:

  • 50. 

    Which Statements are true?- 2 choices.

    • A.

      JPasswordField can be created with the constructor public JPasswordField("password");

    • B.

      JTextField allow to input single line of text.

    • C.

      The method setEditable(false) allow you to edit the text

    • D.

      JTextArea does not allow you to edit the text.

    • E.

      The text in the JTextArea can be set programmatically.

    Correct Answer(s)
    B. JTextField allow to input single line of text.
    E. The text in the JTextArea can be set programmatically.
    Explanation
    The first statement is false because the constructor public JPasswordField("password") does not exist. The second statement is true because JTextField allows the user to input a single line of text. The third statement is true because the method setEditable(false) does not allow you to edit the text. The fourth statement is false because JTextArea does allow you to edit the text. The fifth statement is true because the text in the JTextArea can be set programmatically.

    Rate this question:

Quiz Review Timeline +

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

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 16, 2008
    Quiz Created by
    Vietha
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.