Shared Flashcard Set

Details

Java CS170 Chapter. 2
Chapter 2 Questions
15
Computer Science
Undergraduate 1
09/11/2011

Additional Computer Science Flashcards

 


 

Cards

Term
The paint() method in your Java applet has one parameter. What type is the parameter?
Answer

1. String

2. pen

3. Graphics

4. Color
Definition
Graphics
Term
The classes in the Java Class Libraries are organized into families called __________________.
Answer

1. subclasses

2. namespaces

3. packages

4. superclasses
Definition
packages
Term
Of the following types, which one cannot store a numeric value?
Answer

a. int

b. byte

c. float

d. char

e. all of these can store numeric values
Definition
char
Term
The Java integer type that can represent the number of people in this room (40), but not the age of the United States is :
Answer

a. int

b. short

c. char

d. byte

e. long
Definition
int
Term
What characters must appear when when writing a literal of type float :
Answer

a. .

b. f

c. F

d. Either b or c
Definition
Either b or c
Term
The "factory" that uses a class definition to initialze an object is called ____________________.
Answer

1. an init() method

2. a constructor

3. an initializer

4. an object factory
Definition
a constructor
Term
Named constants make your programs clearer and easier to maintain. To create a constant in Java that can be used in all the methods in your class, you'll normally use all of these modifiers except ______________ .
Answer

1. public

2. static

3. const

4. final
Definition
const
Term
Variables defined inside the body of a method are called:
Answer

1. private variables

2. local variables

3. public variables

4. instance variables
Definition
local variables
Term
____________________ means giving a value to a variable that already exists, not to provide a value to a newly created variable.
Answer

1. Initializing assignment

2. Variable definition

3. Variable declaration

4. Executable assignment
Definition
Executable assignment
Term
The parameter passed to the PrintStream println method:
Answer

1. can be a String or an integer

2. can be of almost any type

3. must be a String

4. must be a number
Definition
can be of almost any type
Term
The statement System.out.print("No" + 2 + 3 + "way"); produces the output:
Answer

1. No23way

2. No5way

3. None. Illegal statement.

4. No 2 3 way
Definition
No 2 3 way
Term
Which of these shows the correct way to print a literal number?
Answer

1. System.out.println('123.75');

2. System.out.println({123.75});

3. System.out.println("123.75");

4. System.out.println(123.75);
Definition
System.out.println(123.75);
Term
When "sending a message" to an object, the object is called:
Answer

1. the request

2. the sender

3. the receiver

4. the target
Definition
the receiver
Term
When you write an ACM console program, you will normally do all of these except one. Which one is not like the others?
Answer

Use System.out.print() to display your output.

extend the ConsoleProgram class

import the classes in the acm.program package.

change the title bar of the window that your program uses with setTitle()
Definition
Use System.out.print() to display your output.
Term
The JTF stands for the ACM Java Task Force. What did they do?
Answer

Mediated disputes among different ACM members, such as Microsoft, Sun, Oracle and IBM, when Java was involved.

Studied Java's suitability as a college-level teaching language and developed a library of classes designed for students.

Provided the reference documentation for the standard implementation of Java.

Promoted the use of Java across different industries and sciences.
Definition
Studied Java's suitability as a college-level teaching language and developed a library of classes designed for students.
Supporting users have an ad free experience!