• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 21 páginas
Examen

Computer Science 109 _ Introduction to Programming

Document preview thumbnail
Vista previa 3 fuera de 21 páginas

Computer Science 109 _ Introduction to Programming

Vista previa del contenido

Computer Science 109 : Introduction to
Programming


When the main method False.
parses the input parameters, Explanation: The arguments are stored as strings in the
it stores the largest numbers parameter args in the order in which they are passed in.
first.
args[0] through args[2]
When three arguments are
Explanation: Java array indexes start at 0 and there are 3
passed to the main method,
values: args[0], args[1], and args[2].
they will be stored in:
Multiple arguments separated by space.
The main method's parameter,
Explanation: Arguments are stored in a string array and can
args, allows passing which of
be converted by the main method to whatever data types
the following?
it expects.
javac
Which of the java commands
Explanation: The command javac will compile java source
will compile java files from the
files into bytecodes and the .class file(s).
command-line prompt?
Most development console/terminal command-line application
environments allow setting Explanation: Most development environments (like Eclipse
up a run configuration or IntelliJ) allow setting up a run configuration where you
where you can pre-populate can pre-populate program arguments. If program
program arguments. If arguments will change regularly, however, you can use
program arguments will the console/terminal command-line application to run the
change regularly, however, program and type in the parameters you want to pass.
you can use the____to run
the
program and type in the
parameters you want to
pass.

integer, float.
Explanation: Java will accept an
integer in a float field (would just
Based on the following code,
make it something like 25.0). But, if
what data types could be
you try to enter other data types
entered without error?
it will fail (although double may
also work, depending on the
length and precision). It's best to
check for valid values or allow

,double from the start.

, You are developing a Long.
program to accept user Explanation: The integer will not be able to hold additions of
input. Users will enter such numbers. It is best to use a long. Population counts
population counts of bacteria are whole numbers, so no need for double.
and add them together
(numbers in the billions).
Which data type would be best
for the user to convert their
input to?
It is an instance of the Scanner class.
Explanation: In order to read user
Examine the following code.
input, we need to create an instance
What is true about the
of the Scanner class to capture that
variable inputValue?
input. We will read the input into the
inputValue instance variable.
while (!enterQty.hasNextInt( ) ) {
System.out.println("Enter integer");
enterQty.next( );
Examine the following code.
}
What could we add to ensure Explanation: The exclamation
only integers were entered? point indicates an inversion/false.
In other words, while the enterQty
value is NOT an integer, display an
error. Use the next() function to
read the next value.
The Scanner utility was not
imported. Explanation: Without
This code will not compile, Java
the Scanner utility (or the entire
displays an error. What is
java.util package) you cannot
missing?
use this feature. It needs to be
imported before the first class
function.
tokens.
The Scanner class
Explanation: The Scanner class (package
(package java.util.Scanner)
java.util.Scanner) is a text scanner that breaks up input
is a text scanner that
into tokens based on a delimiter pattern such as space
breaks up input into _.
(default), semi-colon, tab, etc.
When using the Scanner class nextDouble()
to read data from the Explanation: The correct answer is 'nextDouble()' which will
console, in order to read obtain the next value and convert it to double data type
data which is a double and and return it as such.
assign it directly to a double

Información del documento

Subido en
25 de septiembre de 2025
Número de páginas
21
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$12.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.
smartchoices
4.8
(9)
Vendido
39
Seguidores
5
Artículos
4500
Última venta
1 mes 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