Training high school teachers to teach AP Computer Science Principles
Select Page
Programming Quiz
Results
#1 What are the values of i and j at the end of the code fragment?
i = 40, j =35
i = 50, j = 30
i = 50, j =35
#2 Given the following procedure run, what is the output of run(25) ?
5
20
25
3
#3 Are both the outputs of code segment (i) and code segment (ii) equal?
Yes, output of (i) and (ii) are same
No, output of (i) differs from output of (ii)
Syntax of (i) is correct and (ii) is incorrect
Syntax of (i) is incorrect and (ii) is correct
#4 Analyze the following two code segments and determine what will be the value of x after executing each of the code segments.
(i) The value of x is:6, The value of x is:7, The value of x is:8 (ii) The value of x is:5, The value of x is:6, The value of x is:7
(i) The value of x is:5, The value of x is:6, The value of x is:7 (ii) The value of x is:6, The value of x is:7, The value of x is:8
(i) & (ii) results in same output as below. The value of x is:6, The value of x is:7, The value of x is:8
(i) & (ii) results in same output as below. The value of x is:5, The value of x is:6, The value of x is:7
#5 What will be the output of the following code segment?
Binary is base 2 Base 16 Base 10
a.hexaDecimal() Binary is base 2 Base 10
Base 16 Binary is 2
Base 16 Binary is base 2 Base 10
#6 Let ‘a’ be the array = {12,1, 89, 2, 34, 46, 0, 13, 7}. And a.length represents length of the array. Here a.length = 9. After executing the flow chart, how will the array ‘a’ look like?
{12,1, 89, 2, 34, 46, 0, 13, 7}
{0, 12, 89, 2, 34, 46, 1, 13, 7}
{0, 1, 2, 7, 12, 13, 34, 46, 89}
{89, 46, 34, 13, 12, 7, 2, 1, 0}
#7 What will be the output of each of the code fragments?
(i) 0 (ii) 1
(i) 0 (ii) 0
(i) 1 (ii) 1
(i) 1 (ii) 0
#8 Consider the following code segment where ‘f’ is a function that is defined as shown below. What value is returned by the function call f ( 30 , 100 ) ?
100
0
30
Can't be determined
#9 Analyze the following code segment and determine the values of ‘s’, ‘x’, ‘y’ after the execution of the code segment. calculate() is a function that calculates the value s. Assume that whenever print statement is called it prints on a new line.
The value of s: 50 The value of x: 35 The value of y: 10
The value of s: 0 The value of x: 5 The value of y: 5
The value of s: 25 The value of x: 5 The value of y: 5
The value of s: 25 The value of x: 35 The value of y: 10
#10 What is the output of this code?
Hi there!
Hi there!Thank you!
Thank you!
Error: non-static method director() cannot be referenced from a static context