Midterm - CIT 111 - Intro To Java

50 Questions | Total Attempts: 65

SettingsSettingsSettings
Midterm Quizzes & Trivia

Name:_________________         Date: __________________


Questions and Answers
  • 1. 
    Is a Container object in GUI programming a primitive variable that contains...    
    • A. 

      True

    • B. 

      False

  • 2. 
    The size of a frame on the screen is measured in pixels
    • A. 

      True

    • B. 

      False

  • 3. 
    What is the difference between private and public functions
    • A. 

      Public can be used by anyone, private can only be used by other code in the class you are writing

    • B. 

      Public are free

    • C. 

      Public can't be used

    • D. 

      Public is only for .NET

  • 4. 
    A method can be defined within the body of another method.  This is known as nesting methods?
    • A. 

      True

    • B. 

      False

  • 5. 
    To use the method Math.sqrt(x) you must import the package java.lang.
    • A. 

      True

    • B. 

      False

  • 6. 
    Void methods are always stand-alone statements
    • A. 

      True

    • B. 

      False

  • 7. 
    It is possible to create several methods with the same name in a single class
    • A. 

      True

    • B. 

      False

  • 8. 
    Is the name of the Swing class used for frames called SwingFrame
    • A. 

      True

    • B. 

      False

  • 9. 
    When you create a JFame object it is not automatically displayed.
    • A. 

      True

    • B. 

      False

  • 10. 
    A requirements document may specify that a new program be developed or they may specify updates to an existing program.
    • A. 

      True

    • B. 

      False

  • 11. 
    You may declare an unlimited number of variables in a statement as long as the variables are the same data type
    • A. 

      True

    • B. 

      False

  • 12. 
    As you develop a Java program you can use Eclipse to watch the stock options online
    • A. 

      True

    • B. 

      False

  • 13. 
    A syntax error occurs when there's a syntax error in a Java Statement
    • A. 

      True

    • B. 

      False

  • 14. 
    A console application uses a graphical user interface
    • A. 

      True

    • B. 

      False

  • 15. 
    A class is an object or a set of objects that share a common structure but not a common behavior
    • A. 

      True

    • B. 

      False

  • 16. 
    What is missing from the try and catch method? try {      UIManager.setLookAndFeel("Java is Awesome.."); }catch(Exception exc)
  • 17. 
    What is the size of a Char in Java
    • A. 

      4 Bit

    • B. 

      16 Bit

    • C. 

      8 Bit

    • D. 

      7 Bit

  • 18. 
    Declare an Integer, defined name and values are below.Integer Name is mynumbermynumber value is 22
  • 19. 
    Write out how you would import the class "java.util.Scanner"?
  • 20. 
    Declare a String and assign a value to the string as you would in Java programming code.1. String name is: city2. City Name is: Pittsburgh
  • 21. 
    A Class is
    • A. 

      Object

    • B. 

      Variable

    • C. 

      Executable

    • D. 

      Program

  • 22. 
    Below is a simple Frame program we worked on in class. See what is missing and write it below? import javax.swing.*; public class SimpleFrame extends JFrame{ public SimpleFrame(){super("Frame Title");setSize(300,522);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setVisible(true); } private static void setLookAndFeel(){try {UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");   } catch(Exception exc){//ignore error }} public static void main(String[]arguments){setLookAndFeel();SimpleFrame sf = new SimpleFrame();//sf.setVisible(false);} }
  • 23. 
    Write out the main class of a java class program
  • 24. 
    In the following module you have a main class, and a method called void. Write out how you would call the Void method?//Main Class public static void main(String[] args) {// TODO Auto-generated method stub  } //Method public static void Info(){        //Do something...        }
  • 25. 
    What is a program? Choose between the examples below
    • A. 

      Wakeup, Brush my teeth, Floss my teeth, shave, and trim my eye brows

    • B. 

      Drive a car, Wake up in the morning, yawn at work, Take a nap at night

    • C. 

      Jump out of your chair at work, Go fishing on Lake Erie

    • D. 

      Jump and lay down

Back to Top Back to top