Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 2 fuera de 5 páginas
Examen

COP 3330 FINAL Exam with complete solutions latest version.

Document preview thumbnail
Vista previa 2 fuera de 5 páginas

COP 3330 FINAL Exam with complete solutions latest version.

Vista previa del contenido

BRAINSCAPE1




COP 3330 FINAL Exam with
complete solutions latest version




True or False

When String objects are compared using ==, the result is true if the strings contain the
same values. - CORRECT ANSWER-False. String objects are compared using the
operator == to compare if they are the same object in memory.

True or False

A string can be modified after it's created. - CORRECT ANSWER-False. string objects
are immutable and cannot be modified after they're created. Stringbuilder objects can
be modified after they're created.

Compare the string in s1 to the string in s2 for equality of contents. - CORRECT
ANSWER-s1.equals(s2)

Append the string s2 to the string s1, using +=. - CORRECT ANSWER-s1 += s2;

Determine the length of the string in s1. - CORRECT ANSWER-s1.length()

True or False

You must explicitly create the stream objects System.in, System.out, and System.err. -
CORRECT ANSWER-False. These 3 streams are created for you when a java app
begins execution

When reading data from a file using class Scanner, if you wish to read data in the file
multiple times, the file must be closed and reopened to read from the beginning of the
file - CORRECT ANSWER-True

T/F


BRAINSCAPE1

, BRAINSCAPE1




Files static method "exists" receives a Path and determines whether it exists (either as a
file or as a directory) on disk. - CORRECT ANSWER-True

Binary files are human readable in a text editor. - CORRECT ANSWER-False. Text files
are human Readable, Binary files are only readable if they appear in ASCII text

An absolute path contains all the directories, starting with the root directory, that lead up
to a specific file or directory. - CORRECT ANSWER-True

Class "Formatter" contains method printf, which enables formatted data to be output to
the screen or to a file. - CORRECT ANSWER-False. Formatter contains method
"format" which enables formatted data to be output to a screen or to a file.

Write a statement that opens file "oldmast.txt" for input - use Scanner variable "in-
OldMaster" - CORRECT ANSWER-Scanner inOldMaster = new Scanner
(Paths.get("oldmast.txt"));

Write a statement that opens file "trans.txt" for input - Use Scanner variable "in-
Transaction - CORRECT ANSWER-Scanner inTransaction = new
Scanner(Paths.get("trans.txt"));

Write a statement that opens file "newmast.txt" for output (and Creation) - use formatter
variable "outNewMaster" - CORRECT ANSWER-Formatter outNewMaster = new
Formatter("newmast.txt");

Write the statements needed to read a record from the file "oldmast.txt". Use the data to
create an object of class "Account" - use Scanner Variable "inOldMaster". Assume the
class Account is the same as figure 15.9 - CORRECT ANSWER-Account account =
new Account();
account.setAccount(inOldMaster.nextInt( ));
account.setFirstName(inOldMaster.next( ));
account.setLastName(inOldMaster.next( ));
account.setBalance(inOldMaster.nextDouble( ))

Write the statements needed to read a record form the file "trans.txt". the record is an
object of class "TransactionRecord" - use scanner variable "inTransaction" Assume the
class contains method "setAccount" which takes in an int, to set the account number
and method "setAmount" which takes in a double for the amount of the transaction -
CORRECT ANSWER-TransactionRecord transaction = new Transaction ( );
transaction.setAccount(inTransaction.nextInt( ));
transaction.setAmount(inTransaction.nextDouble( ));

Write a statement that outputs a record to the file "newmast.txt". the Record is an object
of type Account - use Formatter variable outNewMaster - CORRECT ANSWER-
outNewMaster.format("%d %s %s %.2f%n", account.getAccount(),
account.getFirstName(), account.getLastName(), account.getBalance());

BRAINSCAPE1

Información del documento

Subido en
11 de noviembre de 2025
Número de páginas
5
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$14.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
BRAINSCAPE1
4.4
(20)
Vendido
141
Seguidores
15
Artículos
11139
Última venta
1 semana hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes