Chapters 13&15

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The coordinates of the pixel in the upper-left corner of a component are usually

(0, 0)

An HTML document is usually saved with this file name extension.

.html

An application can use this object to execute code automatically at regular time intervals.

Timer

A method is called from the main method for the first time. It then calls itself seven times. What is the depth of recursion?

7

The HTML tag that is used to insert a link has the following general format:

<a href="Address">Text</a>.

Each component has an internal object that inherits from this class, which has numerous methods for drawing graphical shapes on the surface of the component.

Graphics

Web pages are normally written in

Hypertext Markup Language

When you draw a line or shape on a component, you must indicate its position using these.

X and Y coordinates

When recursive methods directly call themselves, it is known as this.

direct recursion

This method draws a string as a graphic.

drawString

A recursive method can have no more than one base case. (true/false)

false

This occurs when method A calls method B, which in turn calls method A.

indirect recursion

In the ________, we must always reduce the problem to a smaller version of the original problem.

recursive case

This method causes the Timer object to start generating action events.

start

To make a Web page, you create a text file that contains HTML instructions, which are known as ________, as well as the text that should be displayed on the Web page.

tags

The number of times that a method calls itself is known as

the depth of recursion

If you want to make sure that an applet is compatible with all Java-enabled browsers, use AWT components instead of Swing. (true/false)

true

Instead of displaying its own window, an applet appears in the browser's window. (true/false)

true

The mouse generates two types of events: mouse events and mouse motion events. (true/false)

true

Java provides a(n) ________ class for all of the interfaces in the API that have more than one method.

adapter

Override the component's ____ method is one way to get a reference to the Graphics object for an AWT component or a class that extends JApplet or JFrame?

paint

For all Swing components except JApplet and JFrame, you should override this method to get a reference to the component's Graphics object.

paintComponent

A problem can be solved recursively if it can be broken down into successive smaller problems that are identical to the overall problem. (true/false)

true

Any problem that can be solved recursively can also be solved iteratively, with a loop. (true/false)

true

Applets run in a restricted environment to prevent malicious code from attacking or spying on unsuspecting users. (true/false)

true

Without a base case, a recursive method will call itself only once and stop. (true/false)

false

An applet class has a method named ________ that performs the same operations as a constructor.

init

When you update the data used to draw shapes on a component, you must call the repaint method to force a call to the paint or paintComponent methods. (true/false)

true

Applets are important because they can be used to extend the capabilities of a stand-alone Java application. (true/false)

false

The recursive binary search algorithm is a good example of repeatedly breaking a problem down into smaller pieces until it is solved. (true/false)

true

The point where two line segments are connected is called a

vertex

This method clears the surface of the component and then calls the paint method.

repaint

Which of the following statements would you write in an HTML document to display the text "History" as a level one header?

<h1>History</h1>

The names of the AWT classes are the same as those of the Swing classes, except the AWT class names do not start with this letter.

J

An applet class inherits from this class.

JApplet

These classes implement the MouseListener and MouseMotionListener interfaces and provide empty definitions for all of the required methods.

MouseAdapter and MouseMotionAdapter

A mouse listener class must implement this interface, which is in the java.awt.event package.

MouseListener

A mouse motion listener class must implement the MouseMotionListener interface, which is in this package.

java.awt.event

Like a loop, a recursive method must have some way to ______ the number of times it repeats.

control

HTML has sophisticated abilities such as performing math calculations and interacting with the user. (true/false)

false

In HTML, the <h1></h1> tag marks a document's head section, whereas the <head></head> tag marks a header, which is large bold text. (true/false)

false

The recursive case does not require recursion, so it stops the chain of recursive calls. (true/false)

false

Whereas a recursive algorithm might result in faster execution time, the programmer might be able to design an iterative algorithm faster. (true/false)

false

The actions performed by the JVM that take place with each method call are sometimes referred to as this.

overhead

The Applet class's ________ method loads a sound file, plays it one time, and then releases it for garbage collection.

play

A method that calls itself is a ________ method.

recursive

Java also allows you to draw ovals, rectangles, and circles. (true/false)

true

Recursion can be a powerful tool for solving repetitive problems and is an important topic in upper-level computer science courses. (true/false)

true

Recursion is never absolutely required to solve a problem. (true/false)

true

The Towers of Hanoi is a mathematical game that is often used in computer science textbooks to illustrate the power of recursion. (true/false)

true

To run an applet, you create an HTML document with a(n) ________ tag.

applet

Once you create a mouse listener class, you can register it with a component using this method, which is inherited from the Component class.

addMouseListener

Which of the following problems can be solved recursively? greatest common denominator towers of Hanoi binary search All of these

all of these

Which of the following statements is correct regarding the line break <br>, paragraph break <p>, and horizontal rule <hr> HTML tags. These tags are unique from other tags because they do not occur in pairs. These tags are used to create breaks in an HTML document's text. When you use one of these tags, you insert only an opening tag. All of these

all of these

These are Java programs that are usually part of a Web site.

applets

The ________ is at least one case in which a problem can be solved without recursion.

base case

There is no static main method needed to create an instance of the applet class because the browser creates an instance of the class automatically. (true/false)

true


Kaugnay na mga set ng pag-aaral

RN Maternal Newborn Online Practice 2023 A

View Set

Spanish III conditional/future oral

View Set

Chapter 7 Interest Rates and Bond Valuation (Quiz)

View Set

EOSC 114 Final Exam (Learning Goals)

View Set

Sociology 5.3 (Agents of socialization)

View Set