Computer Programming II 2nd Half Review Quiz

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 Justinsmith
J
Justinsmith
Community Contributor
Quizzes Created: 9 | Total Attempts: 40,278
Questions: 23 | Attempts: 183

SettingsSettingsSettings
Computer Programming II 2nd Half Review Quiz - Quiz

How are you when it comes to computer programming now that we have undergone that extensive course on some basic languages in use today? Below is a quiz to review the material from the 2nd half of the Metcalfe County high school`s computer programming II course. Give it a try and get to see just how attentive you have been this past year. All the best!


Questions and Answers
  • 1. 

    Creating an object is called

    • A.

      Instantiation

    • B.

      Reference

    • C.

      Variable

    • D.

      Abstraction

    Correct Answer
    A. Instantiation
    Explanation
    Instantiation refers to the process of creating an object from a class. It involves allocating memory for the object and initializing its state. In other words, instantiation is the act of creating an instance of a class, which can then be used to access the methods and properties defined within that class. Therefore, the correct answer for this question is "instantiation".

    Rate this question:

  • 2. 

    Which of the following is not a part of the string class?

    • A.

      CompareTo

    • B.

      Length

    • C.

      Concat

    • D.

      ToString

    Correct Answer
    D. ToString
    Explanation
    The toString method is not a part of the string class. The toString method is a method of the Object class, which is the superclass of all classes in Java. It is used to return a string representation of an object. However, the other options (compareTo, length, and concat) are all methods that are directly available in the string class. The compareTo method is used to compare two strings lexicographically, the length method is used to return the length of a string, and the concat method is used to concatenate two strings.

    Rate this question:

  • 3. 

    A ___________ is a collection of classes that we can use when developing programs.

    • A.

      Class

    • B.

      Class library

    • C.

      Index

    • D.

      Object

    Correct Answer
    B. Class library
    Explanation
    A class library is a collection of classes that can be utilized during program development. It provides a set of pre-defined classes that can be used to create objects and perform various operations. By using a class library, developers can save time and effort by reusing existing classes instead of creating them from scratch. This allows for more efficient and streamlined programming, as well as promoting code consistency and modularity.

    Rate this question:

  • 4. 

    Which of the following is not a part of the Java standard class library

    • A.

      System class

    • B.

      String class

    • C.

      Keyboard

    Correct Answer
    C. Keyboard
    Explanation
    The System class and String class are both part of the Java standard class library, which contains a collection of pre-defined classes and interfaces that provide commonly used functionality. However, the Keyboard class is not a part of the Java standard class library. It is likely a custom class that is not included in the standard library.

    Rate this question:

  • 5. 

    TThe Java standard class library is part of any Java development environment

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The Java standard class library is a collection of pre-written classes and interfaces that provide a wide range of functionality for Java developers. It includes classes for input/output, networking, data structures, GUI components, and much more. This library is an integral part of any Java development environment and is automatically included when setting up a Java project. Therefore, the statement "The Java standard class library is part of any Java development environment" is true.

    Rate this question:

  • 6. 

    Which of the following classes would allow random numbers to be generated?

    • A.

      Math

    • B.

      Keyboard

    • C.

      String

    • D.

      Random

    Correct Answer
    D. Random
    Explanation
    The Random class would allow random numbers to be generated. The Math class provides mathematical functions but does not generate random numbers. The Keyboard class is not a standard class in most programming languages and does not have a built-in function for generating random numbers. The String class is used for manipulating and working with strings, not generating random numbers. Therefore, the correct class for generating random numbers is the Random class.

    Rate this question:

  • 7. 

    The Keyboard class is part of a package called_________

    • A.

      String

    • B.

      Cs1

    • C.

      Random

    • D.

      Applet

    Correct Answer
    B. Cs1
    Explanation
    The correct answer is Cs1. The Keyboard class is part of the Cs1 package.

    Rate this question:

  • 8. 

    When using JCreator a shortcut to run the current program is_________

    • A.

      F5

    • B.

      Alt + 5

    • C.

      Ctrl + 5

    • D.

      Alt + Tab

    Correct Answer
    A. F5
    Explanation
    When using JCreator, the shortcut to run the current program is F5. This shortcut allows users to quickly execute their code without having to navigate through menus or use the mouse. It is a commonly used shortcut in many programming environments and helps to streamline the development process.

    Rate this question:

  • 9. 

    An applet doesn't have a _______ method

    • A.

      Main

    • B.

      Secondary

    • C.

      Primary

    • D.

      System

    Correct Answer
    A. Main
    Explanation
    An applet doesn't have a main method because the main method is the entry point for standalone Java applications, not applets. Applets have a different lifecycle and are typically embedded within webpages and run within a web browser. Instead of a main method, applets have init, start, stop, and destroy methods that are called at different stages of the applet's lifecycle.

    Rate this question:

  • 10. 

    What do the first two numbers in page.drawLine (10, 20, 150, 45); mean?

    • A.

      Width and Height

    • B.

      X & Y Coordinate

    • C.

      RGB Value

    • D.

      Y and Width

    Correct Answer
    B. X & Y Coordinate
    Explanation
    The first two numbers in the page.drawLine function represent the X and Y coordinates. In this case, the line will start at the point (10, 20) on the page and end at the point (150, 45). The X coordinate determines the horizontal position, while the Y coordinate determines the vertical position.

    Rate this question:

  • 11. 

    What do the 2nd two numbers in page.drawLine (10, 20, 150, 45); mean?

    • A.

      Width and Height

    • B.

      X and Y Coordinate

    • C.

      RGB Value

    • D.

      Y and Width

    Correct Answer
    A. Width and Height
    Explanation
    The 2nd two numbers in the page.drawLine function (10, 20, 150, 45) represent the width and height of the line being drawn. The first two numbers (10, 20) correspond to the starting point of the line, while the last two numbers (150, 45) represent the ending point. Therefore, the 2nd two numbers determine how wide and tall the line will be on the page.

    Rate this question:

  • 12. 

    Which of the following would be used to draw a curved line within a Java Applet?

    • A.

      DrawLine

    • B.

      DrawString

    • C.

      DrawArc

    • D.

      DrawRect

    Correct Answer
    C. DrawArc
    Explanation
    The drawArc method in Java Applet is used to draw a curved line. It allows the programmer to specify the starting and ending angles, as well as the width and height of the arc. This method is commonly used to create curved shapes or to draw portions of circles. Therefore, drawArc is the correct choice for drawing a curved line within a Java Applet.

    Rate this question:

  • 13. 

    Within Java an oval is always drawn inside of a__________ _________

    • A.

      Single oval

    • B.

      Bounding rectangle

    • C.

      Straight line

    • D.

      Semi circle

    Correct Answer
    B. Bounding rectangle
    Explanation
    In Java, when drawing an oval, it is always drawn inside a bounding rectangle. The bounding rectangle is a rectangle that completely encloses the oval shape. This rectangle acts as a reference frame for the oval, determining its position and size. The oval is then drawn within this rectangle, ensuring that it fits perfectly inside. This approach allows for easy manipulation and positioning of the oval shape within the Java program.

    Rate this question:

  • 14. 

    How many numbers must be supplied with the drawArc method?

    • A.

      4

    • B.

      5

    • C.

      6

    • D.

      7

    Correct Answer
    C. 6
    Explanation
    The drawArc method in programming typically requires six numbers to be supplied. These numbers represent the coordinates and dimensions of the arc to be drawn, including the starting point, width, height, and angles. By providing these six numbers, the drawArc method can accurately render the desired arc on the screen or canvas.

    Rate this question:

  • 15. 

    Applets open up using what program within JCreator?

    • A.

      WebViewer

    • B.

      AppletScreen

    • C.

      AppletViewer

    • D.

      WebScreen

    Correct Answer
    C. AppletViewer
    Explanation
    Applets open up using the program called AppletViewer within JCreator. This program allows developers to view and test their applets before deploying them on the web. It provides a virtual environment for running and debugging applets, making it an essential tool for applet development.

    Rate this question:

  • 16. 

    Applets and Applications are coded the same way.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Applets and Applications are not coded the same way. Applets are small applications that are designed to run within a web browser, while applications are standalone programs that can be run independently. Applets are typically written in Java and require a Java Virtual Machine to run, whereas applications can be written in various programming languages and do not require a specific runtime environment. Therefore, the statement that "Applets and Applications are coded the same way" is false.

    Rate this question:

  • 17. 

    Applets use a X and Y coordinate system.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Applets use a X and Y coordinate system because they are graphical programs that are designed to be embedded within web pages. The X and Y coordinate system allows applets to position and manipulate graphical elements on the screen. This system is commonly used in computer graphics to represent the location of objects in a two-dimensional space. Therefore, the statement "Applets use a X and Y coordinate system" is true.

    Rate this question:

  • 18. 

    The X,Y coordinate in the upper left hand corner of an Applet screen would be___,____.

    • A.

      100,100

    • B.

      50,50

    • C.

      0,0

    • D.

      -50,-50

    Correct Answer
    C. 0,0
    Explanation
    The X,Y coordinate in the upper left hand corner of an Applet screen is (0,0) because the coordinate system used in computer graphics and programming typically starts at (0,0) in the upper left corner of the screen. This means that the X-axis increases as you move to the right and the Y-axis increases as you move down the screen. Therefore, the upper left corner has the coordinates (0,0).

    Rate this question:

  • 19. 

    One can use negative values within x,y coordinates when designing a Java Applet?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In Java Applet, negative values within x, y coordinates can be used. This allows for positioning elements or drawing graphics outside the visible area of the applet window. It can be useful in certain cases, such as when creating animations or implementing scrolling functionality.

    Rate this question:

  • 20. 

    Custom colors can be added into a Java applet

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In Java, custom colors can be added into a Java applet. The Graphics class in Java provides methods such as setColor() that allow developers to specify custom colors using RGB values. These custom colors can then be used to draw shapes, fill areas, or set the background color in a Java applet. Therefore, the statement "Custom colors can be added into a Java applet" is true.

    Rate this question:

  • 21. 

    Page.setColor (new Color(255,255,255)); would set the color within an Applet to.

    • A.

      White

    • B.

      Black

    • C.

      Red

    • D.

      Blue

    Correct Answer
    A. White
    Explanation
    The given code page.setColor (new Color(255,255,255)); sets the color within an Applet to white. The values (255,255,255) represent the RGB values for white, where each value ranges from 0 to 255. Therefore, the correct answer is White.

    Rate this question:

  • 22. 

    Page.setColor (new Color(0,0,0)); would set the color within an Applet to.

    • A.

      Black

    • B.

      White

    • C.

      Red

    • D.

      Blue

    Correct Answer
    A. Black
    Explanation
    The given code is setting the color within an Applet to black. The method setColor is being called on the page object, and a new Color object is being passed as an argument with RGB values (0,0,0), which represents black. Therefore, the color within the Applet will be set to black.

    Rate this question:

  • 23. 

    Print and println are the same

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The statement "print and println are the same" is false. Although both "print" and "println" are used to display output in programming, they have different functionalities. "print" displays the output without adding a new line, while "println" displays the output and adds a new line after it. This subtle difference allows for more control over the formatting and presentation of the output.

    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
  • Feb 06, 2011
    Quiz Created by
    Justinsmith
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.