Java AWT Basics Quiz
48 Questions
6 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which method is correctly used to set the color in a Graphics context?

  • g.setColor(Color.cyan); (correct)
  • g.setColor(“cyan”); (correct)
  • g.setColor(“Color.cyan”);
  • g.setCurrentColor(cyan);
  • What is the purpose of the second parameter in the Lable(String, int) constructor?

  • It specifies the alignment of text in the label.
  • It determines the label's background color.
  • It specifies the width of the label in pixels. (correct)
  • It specifies the height of the label.
  • Which AWT component is best suited for providing a compact, multi-choice selection?

  • Panel
  • TextArea
  • Choice (correct)
  • List
  • In AWT, which control is typically used for a binary ON/OFF switch?

    <p>ToggleButton</p> Signup and view all the answers

    What does the following line of code achieve? TextField tf = new TextField(10);

    <p>It establishes a character capacity of 10.</p> Signup and view all the answers

    Which class contains the setBackground() method in the java.awt package?

    <p>Component</p> Signup and view all the answers

    What are the properties defined in the Dimension class?

    <p>length and width</p> Signup and view all the answers

    Frame is a standard window, which is a __________ of the Window class in the AWT hierarchy?

    <p>subclass</p> Signup and view all the answers

    In which scenario do both AWT and Swing components create a process?

    <p>Both AWT and Swing create a process.</p> Signup and view all the answers

    What is the method to set the title of a Frame window?

    <p>void setTitle(String str)</p> Signup and view all the answers

    Which class is utilized to represent a single line textbox with password character facility?

    <p>TextField</p> Signup and view all the answers

    What type of component is a Panel in Java programming?

    <p>A window without a title bar or menubar.</p> Signup and view all the answers

    If a Button is added to a Panel with a specific font setting, which font will be used for the Button’s label if the Frame's font is different?

    <p>The Button's label will use the Panel’s font setting.</p> Signup and view all the answers

    Which method is specifically used to set the password character for a TextField?

    <p>setEchoChar()</p> Signup and view all the answers

    The method getContentPane() is associated with which class in Java's AWT/Swing?

    <p>JFrame</p> Signup and view all the answers

    What is the default minimum value when creating a ScrollBar in Java with the parameters ScrollBar s = new ScrollBar(0,10,20,0,1000);

    <p>0</p> Signup and view all the answers

    What is the purpose of the method Container getContentPane()?

    <p>Returns a ContentPane for Applet</p> Signup and view all the answers

    Which of the following methods is not applicable for buttons in Swing?

    <p>setDiableIcon()</p> Signup and view all the answers

    Which method is used to retrieve the icon of a JButton?

    <p>ImageIcon getIcon()</p> Signup and view all the answers

    Which of the following is not a component of the Swing library?

    <p>JImageIcon</p> Signup and view all the answers

    Which components provide support for two-state functionality?

    <p>JCheckBox, JRadioButton</p> Signup and view all the answers

    What action is required before implementing the Listener interface?

    <p>Override necessary methods</p> Signup and view all the answers

    What method is used in the Graphics class to set the current color?

    <p>setColor()</p> Signup and view all the answers

    Which option describes an incorrect statement regarding the Model-View-Controller (MVC) design pattern?

    <p>View retrieves data directly from the database.</p> Signup and view all the answers

    Which exception can the constructor of URL throw?

    <p>MalformedUrlException</p> Signup and view all the answers

    What is considered a multicast IP address?

    <p>235.55.45.2</p> Signup and view all the answers

    Which parameters uniquely identify a connection?

    <p>Local IP, Local PORT, Remote IP, Remote PORT and Protocol</p> Signup and view all the answers

    Which classes of Java enable connection-oriented communication?

    <p>Socket and ServerSocket</p> Signup and view all the answers

    How many clients can a server socket connect to at once?

    <p>multiple</p> Signup and view all the answers

    Which method is used to create a URL connection?

    <p>openConnection()</p> Signup and view all the answers

    Which method of the DatagramPacket class is used to find the destination address?

    <p>getAddress()</p> Signup and view all the answers

    What is the correct format for a valid local IP address?

    <p>192.168.1.1</p> Signup and view all the answers

    Which method is used to obtain the IP address associated with a hostname?

    <p>getByName(String host_name)</p> Signup and view all the answers

    Which of the following is NOT a method defined for InetAddress?

    <p>getContentLength()</p> Signup and view all the answers

    Which constructor of DatagramPacket is specifically used for receiving data?

    <p>DatagramPacket(byte data[], int size, InetAddress ip, int port)</p> Signup and view all the answers

    Which class is responsible for creating a listening port on the server side?

    <p>ServerSocket</p> Signup and view all the answers

    Which of the following statements about getByName method is true?

    <p>It is reliable and connection-oriented.</p> Signup and view all the answers

    What type of class is Permission in the java.security package?

    <p>It provides access control mechanisms.</p> Signup and view all the answers

    Which DatagramPacket constructor can be used for sending data?

    <p>DatagramPacket(byte data[], int size, InetAddress ip, int port)</p> Signup and view all the answers

    Which method of InetAddress retrieves the IP address as a string?

    <p>getHostAddress()</p> Signup and view all the answers

    What does the code 'smt = con.createStatement()' achieve?

    <p>A Statement object is created to send SQL commands to the database.</p> Signup and view all the answers

    Which method can be used to send SQL statements?

    <p>Both B &amp; C</p> Signup and view all the answers

    Which driver converts JDBC calls into calls on the Client API for various databases?

    <p>Native API partly – Java Driver</p> Signup and view all the answers

    Which method executes an SQL statement that may return multiple results?

    <p>executeQuery()</p> Signup and view all the answers

    Which format is used for Microsoft Access data files?

    <p>.MDB</p> Signup and view all the answers

    How is a DELETE statement in SQL executed?

    <p>using executeUpdate()</p> Signup and view all the answers

    What is the interface that handles communication with the database?

    <p>Connection</p> Signup and view all the answers

    What is created when a CallableStatement is prepared?

    <p>A parameterized SQL command</p> Signup and view all the answers

    Study Notes

    Advanced Java Programming Study Notes

    •  Textbook Edition: 2019
    • Curriculum: Strictly adheres to the revised syllabus of 'I' Scheme, effective from academic year 2018-2019
    • Institution: Maharashtra State Board of Technical Education
    • Subject: Advanced Java Programming
    • Course Code: 22517
    • Course Level: Semester V, Computer Engineering (CO/CM/CW)
    • Author: Ravi Majithia
    • Material Type: Free MCQ Booklet for Online Examinations

    Features

    • MCQs: Over 250 multiple-choice questions.
    • Structure: Questions organized chapterwise.
    • Purpose: Specifically designed for online examinations adhering to 'I' Scheme.

    Index of MCQs (Page 3)

    • Unit I: (AWT) - M1-1 to M1-5
    • Unit II: Swings - M2-1 to M2-2
    • Unit III: Event Handling - M3-1 to M3-3
    • Unit IV: Networking Basics - M4-1 to M4-3
    • Unit V: Interacting with Database - M5-1 to M5-3
    • Unit VI: Servlets - M6-1 to M6-3

    Chapter 1: Abstract Windowing Toolkit (AWT) (Page 5)

    • AWT abbreviation: Abstract Windowing Toolkit
    • Number of AWT controls: 7
    • Passive controls: Do not support user interaction (Choice, List, Checkbox)
    • Label text change method: setText()
    • Pop-up list control: Choice
    • Graphics programming class: java.awt.Graphics
    • Frame creation methods: Association and Inheritance

    Additional Chapters (Pages 6-11, 15-17, 18-20, 21-23)

    • Coverage of various Java programming concepts like Swing, Event Handling, Networking, Database Interaction, and Servlets, including related multiple-choice questions.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Description

    Test your knowledge of Java's Abstract Window Toolkit (AWT) with this quiz. Answer questions about components, constructors, and methods used in AWT. Get ready to prove your understanding of GUI programming in Java!

    More Like This

    Java AWT and Event Driven Programming Quiz
    10 questions
    AWT Fundamentals and Graphics Concepts Quiz
    10 questions
    Java AWT Unit 1 Quiz
    32 questions

    Java AWT Unit 1 Quiz

    SupportingPulsar avatar
    SupportingPulsar
    Use Quizgecko on...
    Browser
    Browser