• ¿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 1 fuera de 4 páginas
Examen

Ap Computer Science A Unit 2 Exam

Document preview thumbnail
Vista previa 1 fuera de 4 páginas

AP COMPUTER SCIENCE A UNIT 2 EXAM

Vista previa del contenido

AP COMPUTER SCIENCE A: UNIT 2 EXAM

Consider the following variable declarations.

int a = 5;
int b = 4;
double x = 5;
double y = 4;

Which of the following expressions would evaluate to the number, 1?

1. (int) x / y
2. a / b
3. a % b - Answer -All of them. (1 , 2, and 3)

Consider the following variable declarations.
1. double x = (int) 3.4
2. int y = (int) , 5
3. String z = new String(" ") - Answer -1 and 3

Consider String a below. Which of the following would create a new String with the
value, "ram"?
String a = new String ("Java Program"); - Answer -String b = a.substring(9);

Better code will NOT type in a static number to produce words near the end of the
String and instead, uses length. Which of the following will result in "ram" in a better way
than #2 did? - Answer -String b = a.substring(a.length()-3);

What special type of data is identified it has methods , unlike primitive data? Another
giveaway that this is not primitive data is that variables of this type begin with a capital
letter. - Answer -Objects

Consider the code segment below. What is the result that is printed on the screen?

String six = new String ("Question 6");
int find = six.indexOf("q");
find = find + 2;
System.out.println(find + six.indexOf("t"); - Answer -5

What is the value stored in z by the end of the code segment?
int x = 3;
int y = 6;
double z = x + y / 2; - Answer -6.0

What is the value stored in c by the end of the code segment?

Información del documento

Subido en
10 de noviembre de 2025
Número de páginas
4
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.
GEEKA
3.8
(376)
Vendido
2225
Seguidores
1451
Artículos
62882
Última venta
12 horas 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