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
Examen

AP COMPUTER SCIENCE PRACTICE EXAM A

Puntuación
-
Vendido
-
Páginas
11
Grado
A+
Subido en
10-11-2025
Escrito en
2025/2026

AP COMPUTER SCIENCE PRACTICE EXAM A

Institución
AP COMPUTER SCIENCE
Grado
AP COMPUTER SCIENCE

Vista previa del contenido

AP COMPUTER SCIENCE PRACTICE EXAM A

Consider the following method.

public static int mystery(int[] arr)
{
int x = 0
for (int k = 0; k < arr.length; k = k + 2)
x = x + arr[k]
return x;
}
Assume that the array nums has been declared and initialized as follows.
int[] nums = {3, 6, 1, 0, 1, 4, 2};

(A) 5
(B) 6
(C) 7
(D) 10
(E) 17 - Answer -(C) 7

Consider the following partial class declaration.

public class SomeClass
{
private int myA;
private int myB;
private int myC;
// Constructor(s) not shown
public int getA
{ return myA; }
public void setB(int value)
{ myB = value; }
The following declaration appears in another class.
SomeClass obj = new SomeClass();
Which of the following code segments will compile without error?
(A) int x = obj.getA();
(B) int x;
obj.getA(x);
(C) int x = obj.myA
(D) int x = SomeClass.getA();
(E) int x = getA(obj); - Answer -(A) int x = obj.getA

Which of the following changes to SomeClass will allow other classes to access but not
modify the value of myC ?
(A) Make myC public.

, (B) public int getC()
{ return myC; }

(C) private int getC()
{ return myC; }

(D) public void getC(int x)

(E) private void getC(int x)
{ x = myC; } - Answer -(B) public int getC()
{ return myC; }

Consider the following code segment.
int x = 7;
int y = 3;

if ((x < 10) && (y < 0))
System.out.printIn("Value is: " + x * y);
else
System.out.printIn("Value is: " + x / y);
What is printed as a result of executing the code segment

(A) Value is: 21
(B) Value is: 2.3333333
(C) Value is: 2
(D) Value is: 0
(E) Value is: 1 - Answer -(B) 2.3333333

Consider the following method.
public ArrayList<Integer> mystery(int n)
{
ArrayList<Integer> seq = new ArrayList<Integer>();
for (int k = 1; k <= n; k++)
seq.add(new Integer(k * k + 3));

return seq
}
Which of the folowing is printed as a result of executing the following statement?
System.out.printIn.(mystery(6));
(A) [3, 4, 7, 12, 19, 28]
(B) [3, 4, 7, 12, 19, 28, 39]
(C) [4, 7, 12, 19, 28, 39]
(D) [39, 28, 19, 12, 7, 4]
(E) [39, 28, 19, 12, 7, 4, 3] - Answer -(C) [4, 7, 12, 19, 28, 39]

Escuela, estudio y materia

Institución
AP COMPUTER SCIENCE
Grado
AP COMPUTER SCIENCE

Información del documento

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

Temas

$14.99
Accede al documento completo:

¿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

Conoce al vendedor

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 YALA UNIVERSITY
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
2066
Miembro desde
4 año
Número de seguidores
1446
Documentos
51736
Última venta
1 hora hace

3.8

355 reseñas

5
177
4
61
3
47
2
17
1
53

Documentos populares

Recientemente visto por ti

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