AP Computer Science Practice Exam A, Questions and answers, rated A+
AP Computer Science Practice Exam A, Questions and answers, rated A+ Consider the following method. public static int mystery(int[] arr) { int x = 0 for (int k = 0; k h; 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 - -(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 = A(); (B) int x; A(x); (C) int x = A (D) int x = SomeCA(); (E) int x = getA(obj); - -(A) int x =
Geschreven voor
- Instelling
- AP Computer Science
- Vak
- AP Computer Science
Documentinformatie
- Geüpload op
- 18 december 2023
- Aantal pagina's
- 18
- Geschreven in
- 2023/2024
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
ap computer science practice exam a questions an