Programming Quiz

Results

#1 What are the values of i and j at the end of the code fragment?

#2 Given the following procedure run, what is the output of run(25) ?

#3 Are both the outputs of code segment (i) and code segment (ii) equal?

#4 Analyze the following two code segments and determine what will be the value of x after executing each of the code segments.

#5 What will be the output of the following code segment?

#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?

#7 What will be the output of each of the code fragments?

#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 ) ?

#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.

#10 What is the output of this code?

finish