Deck 3: Syntax, Errors, and Debugging

Full screen (f)
exit full mode
Question
The x and y coordinates of a point express its position relative to the system's origin.
Use Space or
up arrow
down arrow
to flip the card.
Question
In Java, when integers and floating-point numbers are combined in a calculation, the integers are converted to doubles before the operation is performed.
Question
An object is an example of a primitive data type.
Question
An object can respond to a message only if its class implements a corresponding method. ____________________
Question
Objects support terminal input and output.
Question
FIGURE 3-2 FIGURE 3-2   The Java coordinate system is oriented as shown in Figure 3-2 above. ____________________<div style=padding-top: 35px>
The Java coordinate system is oriented as shown in Figure 3-2 above. ____________________
Question
Programming and natural languages share all of the following elements EXCEPT ____.

A) rigidity
B) vocabulary
C) syntax
D) semantics
Question
Natural languages are more rigid than programming languages.
Question
Which of the following is NOT an example of a primitive data type?

A) Strings
B) Numbers
C) Characters
D) Booleans
Question
Arithmetic operators are examples of Java syntax.
Question
____ define the rules for interpreting the meaning of statements.

A) Syntax
B) Rigidity
C) Logic
D) Semantics
Question
Explanations are sentences inserted into a program in such a manner that the compiler ignores them. ____________________
Question
Java uses a technique called mixed-mode to convert one data type to another in arithmetic expressions. ____________________
Question
FIGURE 3-1 FIGURE 3-1   The line in Figure 3-1 above was drawn using the ColorPanel class.<div style=padding-top: 35px>
The line in Figure 3-1 above was drawn using the ColorPanel class.
Question
Programming languages have smaller vocabularies and simpler syntax than natural languages.
Question
Strings can be combined in expressions with other strings or numbers using the concatenation operator.
Question
Which of the following is a difference between programming and natural languages?

A) semantics
B) literalness
C) exception
D) origin
Question
Syntax are the rules for combining words into statements.
Question
All of the following are examples of Java vocabulary EXCEPT ____.

A) =
B) *
C) (f - 32) * / 9
D) Fahrenheit
Question
An object must be instantiated before use. ____________________
Question
The paintComponent is triggered automatically by the ____ in response to certain events.

A) JVM
B) compiler
C) method
D) program
Question
A(n) ____________________ expression consists of operands and operators.
Question
Boolean, if, import, and return are all examples of ____.

A) user-defined symbols
B) reserved words
C) variables
D) signatures
Question
Programmers share code using a mechanism called a(n) ____________________.
Question
A ____ error occurs when the computer is instructed to divide by 0.

A) Syntax
B) Run-time
C) Logic
D) Semantic
Question
Text that appears between an opening /* and a closing */ is a(n) ____.

A) end-of-line comment
B) multiline comment
C) debugging statement
D) expression
Question
You can reduce the number of logic errors in a program by rereading code carefully, or ____.

A) proofreading
B) debugging
C) desk checking
D) keywording
Question
Numbers with decimals are the ____________________ numeric data type.
Question
Items in a program whose values do not change are called ____________________.
Question
____ errors are also called bugs.

A) Syntax
B) Run-time
C) Logic
D) Semantic
Question
Which of the following numeric data types is used for smaller, less precise floating-point numbers?

A) Double
B) Float
C) Short
D) Byte
Question
A ____ error occurs when a semicolon is missing at the end of a statement.

A) Syntax
B) Run-time
C) Logic
D) Semantic
Question
In an import statement, you can substitute a class or subsection name with the ____ character to indicate that all of the subsections in the package of classes in the subsection are to be imported.

A) \
B) ?
C) *
D) #
Question
Sending a message to a variable before the corresponding object has been instantiated causes a(n) ____ exception.

A) no such method
B) syntax
C) desk checking
D) null pointer
Question
The ____Panel class has all of the behavior of a JPanel, but it also knows how to draw specific shapes.

A) Color
B) Image
C) Shape
D) Draw
Question
Caroline uses the ____ character to include quotation marks in the welcome message.

A) escape
B) output
C) concatenation
D) forward slash
Question
To use a method successfully, you must know ____.

A) what type of value it returns
B) its name
C) the number and type of the parameters it expects
D) all of the above
Question
The ____ character is used to indicate that punctuation such as commas and quotation marks should be taken literally.

A) *
B) =
C) (
D) \
Question
The expression (3 + 5) + 2* 2 + 4 will yield ____ as the answer.

A) 16
B) 20
C) 24
D) 60
Question
Which of the following is NOT true about variables?

A) Their values can change during execution.
B) Before using a variable for the first time, the program must declare its type.
C) The type of data a variable contains can be changed.
D) All of the above are true.
Question
A(n) ____________________ is a computer program that can replicate itself and move from computer to computer.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
The origin in a screen coordinate system.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
A example of scientific notation.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
A reserved word.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
What a program must use before using a variable for the first time.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
The name, type, and number of parameters.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/46
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 3: Syntax, Errors, and Debugging
1
The x and y coordinates of a point express its position relative to the system's origin.
True
2
In Java, when integers and floating-point numbers are combined in a calculation, the integers are converted to doubles before the operation is performed.
True
3
An object is an example of a primitive data type.
False
4
An object can respond to a message only if its class implements a corresponding method. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
5
Objects support terminal input and output.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
6
FIGURE 3-2 FIGURE 3-2   The Java coordinate system is oriented as shown in Figure 3-2 above. ____________________
The Java coordinate system is oriented as shown in Figure 3-2 above. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
7
Programming and natural languages share all of the following elements EXCEPT ____.

A) rigidity
B) vocabulary
C) syntax
D) semantics
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
8
Natural languages are more rigid than programming languages.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following is NOT an example of a primitive data type?

A) Strings
B) Numbers
C) Characters
D) Booleans
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
10
Arithmetic operators are examples of Java syntax.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
11
____ define the rules for interpreting the meaning of statements.

A) Syntax
B) Rigidity
C) Logic
D) Semantics
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
12
Explanations are sentences inserted into a program in such a manner that the compiler ignores them. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
13
Java uses a technique called mixed-mode to convert one data type to another in arithmetic expressions. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
14
FIGURE 3-1 FIGURE 3-1   The line in Figure 3-1 above was drawn using the ColorPanel class.
The line in Figure 3-1 above was drawn using the ColorPanel class.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
15
Programming languages have smaller vocabularies and simpler syntax than natural languages.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
16
Strings can be combined in expressions with other strings or numbers using the concatenation operator.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following is a difference between programming and natural languages?

A) semantics
B) literalness
C) exception
D) origin
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
18
Syntax are the rules for combining words into statements.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
19
All of the following are examples of Java vocabulary EXCEPT ____.

A) =
B) *
C) (f - 32) * / 9
D) Fahrenheit
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
20
An object must be instantiated before use. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
21
The paintComponent is triggered automatically by the ____ in response to certain events.

A) JVM
B) compiler
C) method
D) program
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
22
A(n) ____________________ expression consists of operands and operators.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
23
Boolean, if, import, and return are all examples of ____.

A) user-defined symbols
B) reserved words
C) variables
D) signatures
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
24
Programmers share code using a mechanism called a(n) ____________________.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
25
A ____ error occurs when the computer is instructed to divide by 0.

A) Syntax
B) Run-time
C) Logic
D) Semantic
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
26
Text that appears between an opening /* and a closing */ is a(n) ____.

A) end-of-line comment
B) multiline comment
C) debugging statement
D) expression
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
27
You can reduce the number of logic errors in a program by rereading code carefully, or ____.

A) proofreading
B) debugging
C) desk checking
D) keywording
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
28
Numbers with decimals are the ____________________ numeric data type.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
29
Items in a program whose values do not change are called ____________________.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
30
____ errors are also called bugs.

A) Syntax
B) Run-time
C) Logic
D) Semantic
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following numeric data types is used for smaller, less precise floating-point numbers?

A) Double
B) Float
C) Short
D) Byte
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
32
A ____ error occurs when a semicolon is missing at the end of a statement.

A) Syntax
B) Run-time
C) Logic
D) Semantic
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
33
In an import statement, you can substitute a class or subsection name with the ____ character to indicate that all of the subsections in the package of classes in the subsection are to be imported.

A) \
B) ?
C) *
D) #
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
34
Sending a message to a variable before the corresponding object has been instantiated causes a(n) ____ exception.

A) no such method
B) syntax
C) desk checking
D) null pointer
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
35
The ____Panel class has all of the behavior of a JPanel, but it also knows how to draw specific shapes.

A) Color
B) Image
C) Shape
D) Draw
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
36
Caroline uses the ____ character to include quotation marks in the welcome message.

A) escape
B) output
C) concatenation
D) forward slash
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
37
To use a method successfully, you must know ____.

A) what type of value it returns
B) its name
C) the number and type of the parameters it expects
D) all of the above
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
38
The ____ character is used to indicate that punctuation such as commas and quotation marks should be taken literally.

A) *
B) =
C) (
D) \
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
39
The expression (3 + 5) + 2* 2 + 4 will yield ____ as the answer.

A) 16
B) 20
C) 24
D) 60
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
40
Which of the following is NOT true about variables?

A) Their values can change during execution.
B) Before using a variable for the first time, the program must declare its type.
C) The type of data a variable contains can be changed.
D) All of the above are true.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
41
A(n) ____________________ is a computer program that can replicate itself and move from computer to computer.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
42
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
The origin in a screen coordinate system.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
43
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
A example of scientific notation.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
44
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
A reserved word.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
45
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
What a program must use before using a variable for the first time.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
46
Identify the letter of the choice that best matches the phrase or definition.
a.Variable declaration statement
b.Keyword
c.5.301E5
d.(0, 0)
e.Method signature
The name, type, and number of parameters.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 46 flashcards in this deck.