Advanced Placement (AP)

AP Computer Science Principles QUESTIONS (MAX POINTS) 1. If the following program is supposed to put down seven tennis balls. Where is the error?

1 function start() {
2 placeSevenBalls();
3 }
4
5 function placeSevenBalls() {
6 for (var i = 0; i <= 7; i++) {
7 putBall();
8 }
9 }
Options:
Line 2
Line 5
Line 6
Line 7

2. What is the output of the following code segment?

var numResult = 12 + 17;
println(numResult);

var stringResult = 12 + "17";
println(stringResult);

Options:
29
29

29
1217

29
12
17

1217 1217

3. What is printed when the following code is run?

function tripleNumber(x){
return 3 * x;
}

function start(){
var y = 2;
var tripledY = tripleNumber(y);
var result = tripleNumber(tripledY);
print(result);
}
Options:
2

6

18

27

4. Consider the array below.

var characterList = ["Luke", "C3PO", "Han", "Leia", "Obi Wan"];
Which line of code will correctly change "C3PO" to "R2D2"?
Options:
characterList["C3PO"] = "R2D2";

characterList["R2D2"] = "C3PO";

characterList[2] = "R2D2";

characterList[1] = "R2D2";

5. What is the output of the following program?

function start(){
var arr = [2, 15, 12, 65, 17, 83];
var elem = arr. remove(2);
println(arr);
}

Options:
15, 12, 65, 17, 83

12, 65, 17, 83

2, 15, 12, 65

2, 15, 65, 17, 83

answer
Answers: 2

Other questions on the subject: Advanced Placement (AP)

image
Advanced Placement (AP), 22.06.2019 13:00, staz13wiggins
Ang pagsunod sa mga batas trapiko ay isang katangian ng pagiging mabuting mamamayan. ano ang ipinamamalas nito?
Answers: 2
image
Advanced Placement (AP), 25.06.2019 03:00, janeou17xn
Secondary school falls between a . kindergarten & elementary b. elementary school & post secondary school c. post secondary school & higher education d. middle school & high school
Answers: 1
image
Advanced Placement (AP), 25.06.2019 20:00, phavion
Long-term alcohol use can cause major depression. a. true b. false
Answers: 2
image
Advanced Placement (AP), 25.06.2019 21:30, angelina6836
Aphysical education teacher lets students read material in a workbook and then complete worksheets on the material. to what type of thinker would this assessment most likely appeal? analytical exploratory structured relational
Answers: 1
Do you know the correct answer?
AP Computer Science Principles QUESTIONS (MAX POINTS) 1. If the following program is supposed to pu...

Questions in other subjects: