Shared Flashcard Set

Details

Java CS170 Chapter. 3
Quiz Questions
15
Computer Science
Undergraduate 1
10/13/2011

Additional Computer Science Flashcards

 


 

Cards

Term
To encapsulate a data field inside your OOP class, you'll always use the modifier:
Answer

1. private

2. static

3. public

4. final
Definition
1. private
Term
The three properties of every object are its identity, ___________, and behavior.
Answer

1. methods

2. constructors

3. value

4. state
Definition
4. state
Term
The ____________ of an object is represented by its methods.
Answer

1. behavior

2. identity

3. state

4. value
Definition
1. behavior
Term
In object-oriented programming, a(n) ________________ represents the definition—the blueprint if you like—that is used to construct the components of the program.
Answer

1. Object

2. Class

3. variable

4. method
Definition
2. class
Term
What is the result of evaluating the integer expression shown here?
89 % (5 + 5) % 5
Definition
4
Term
What is the result of evaluating the integer expression shown here?
17 % 10 / 4
Definition
1
Term
What is the result of evaluating the integer expression shown here?
6 / 2 + 7 / 3
Definition
5
Term
When creating a Scanner object, the parameter passed to the constructor is the _________________________.
Answer

object that will supply the "raw bytes" for the Scanner to process.

name of the Scanner variable.

the output stream where the Scanner should place its results.

the name of the variable where the Scanner object should place its input when it is used.
Definition
object that will supply the "raw bytes" for the Scanner to process.
Term
To read your full name (first and last) into a String variable, using a Scanner object, you should use the method named _________________.
Answer

nextLine()

next()

readString()

readLine()
Definition
nextLine()
Term
To use a Scanner object to read input into a whole number variable, call its ______________ method.
Answer

nextDouble()

next()

nextInt()

readInt()
Definition
nextInt()
Term
To read a single word of user input, using a Scanner object, and return it to you program as a String value, you will use the ______________ method.
Answer

nextWord()

nextString()

nextLine()

next()
Definition
next()
Term
Evaluate the following expression.
Math.sqrt(64)
(Place only your answer in the text-box below. If the answer is a double, use a decimal like 2.0. If the answer is an integer, just write a plain number like 2.)
Definition
8.0
Term
Evaluate the following expression.
Math.min(-2, -5)
(Place only your answer in the text-box below. If the answer is a double, use a decimal like 2.0. If the answer is an integer, just write a plain number like 2.)
Definition
-5
Term
To change the default foreground or background color of your applet, you'll normally use the _____________ method.
Answer

1. init();

2. setColor();

3. paint();

4. start();
Definition
1. init();
Term
In the code shown here: new Color(0, 0, 0, 255)
the number 255 controls the object's _________________.
Answer

1. red color

2. green color

3. blue color

4. transparency
Definition
transparency
Supporting users have an ad free experience!