Computer Science Test 1

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Identify the explicit parameter of the withdraw method of the BankAccount class

amount

Which of the following is a valid constructor header for the Player class that accepts the player name as a parameter/

public Player(String playerName)

Which method could you use to obtain the string "1234567890" from the string "123-456-7890"

replace

What is the purpose of a test program?

the test program verifies that methods have been implemented correctly

What is the purpose of the assignment operator?

to change the value of a variable

A sequence of steps that contains precise instructions for what to do at each step and where to go next is

unambiguous

What is the name of the instance variable for a Counter object?

value

What storage location in the computer's memory called that has a type, name, and contents?

variable

What is the argument in the given method call? System.out.println("Welcome")

"Welcome"

In Java, a comment on a line begins with

//

System.out.println(4 + 6);

10

Which statement is true about the compilation process? 1. The compiler will generate Java virtual machine instructions even if it detects and error. 2. The compiler will continue compiling after it finds an error. 3. The compiler will generate CPU specific instructions even if it detects an error. 4. The compiler will stop compiling when it finds the first error.

2. The compiler will continue compiling after it finds an error.

Which statement regarding computer programs is correct? 1. Computer programs can decide what task to perform. 2. Small computer programs are not documented. 3. Large and complex computer programs are generally written by only one programmer. 4. Computer programs are composed of extremely primitive operations.

4

Which of the following statements about classes is correct?

A class declares the methods that you can apply to its objects

What is a tester class?

A class with a main method that contains statements to run methods of another class.

What is an object?

An entity in your program that is manipulated by calling methods.

Every Java program consists of one or more of these fundamental building blocks.

Class

What is the term used to describe an error detected by the compiler that is a violation of the programming language rules?

Compile-time error.

What tool translates high-level instructions into low level machine code?

Compiler

Assume that the following Java statement is contained in the main method of the class named Hello: System.out.printLine("Hello!"); What is the name of the file generate by the Java compiler?

No file is generated due to an error.

Which one of the following memory types provides storage that is slower and less expensive?

Secondary storage. (RAM would be primary storage)

What is the nickname for the graphical user interface library in java?

Swing

Which statement about private instance variables is true? They cannot be accessed by methods of the same class. They can only be accessed by the constructor of the class they can only be accessed by the methods of the same class They can only be accessed by methods of a different class

They can only be accessed by methods of the same class

What terminology describes a method that returns information about an object and does not change the object's internal data?

accessor

the javadoc utility is used to

automatically generate HTML pages that describe classes

Which line of code is part of private implementation of the BankAccount class? public void withdraw(double amount) balance = balance - amount public BankAccount() public void deposit(double amount)

balance = balance - amount

When you declare a method, you also need to provide the method ___ which consists of statements that are executed when the method is called.

body

If you get a sequence of error messages from the compiler that are increasingly off track, you should...

check for spelling, capitalization, or mission quotation marks

Which part of a class implementation contains the instructions to initialize an object's instance variables?

constructor

A method is invoked on what type of parameter?

implicit parameter

What mechanism does an object use to store its data?

instance variables

The private implementation of a class consists of

instance variables and the implementation of the constructors and methods.

Identifiers can be made up of what?

letters digits and underscore character

When a method exits, its _____ are removed.

local variables

Other than run-tim error, what is another term used to describe an error causing a program to take an action that the programmer did not intend?

logic error

By convention among java programmers, variables begins with a

lowercase letter

Whenever a method is called, what must be specified?

method name, arguments

Which of the following is the best choice for a variable identifier that will store a name? name, Name, nm, n

name

Which operator constructs object instances

new

The "building blocks" that Java programmers use to write programs are called

objects

Which type of storage is made from electronic circuits that can store data

primary storage

Which is not a method of the string class?

print.ln

What term is used to refer to an individual instruction inside a method?

statement


Set pelajaran terkait

This is an example of which therapeutic technique?

View Set

ch 14. bonds and long-term notes

View Set

Cisco CCNA Exploration 1 Chapter 2: On-line Test Questions and Answers

View Set

Period 3 (1754-1800): Colonial Society in 18th Century

View Set