Loading

Select from a List of Professors

1.1.1: What is the most important skill for a computer scientist?
a) To think like a computer.
b) To be able to write code really well.
c) To be able to solve problems.
d) To be really good at math.

1.1.2: An algorithm is:
a) A solution to a problem that can be solved by a computer.
b)A step by step list of instructions that if followed exactly will solve the problem under consideration.
c) A series of instructions implemented in a programming language
d) A special kind of notation used by computer scientists
Submit

1.2.1: Source code is another name for:
a) The instructions in a program, stored in a file
b) The language that you are programming in (e.g., Python).
c) The environment/tool in which you are programming
d) The number (or 'code') that you must input at the top of each program to tell the computer how to execute your program.

1.2.2: What is the difference between a high-level programming language and a low-level programming language?
a) It is high-level if you are standing and low-level if you are sitting.
b) It is high-level if you are programming for a computer and low-level if you are programming for a phone or mobile device.
c) It is high-level if the program must be processed before it can run, and low-level if the computer can execute it without additional processing.
d) It is high-level if it easy to program in and is very short; it is low-level if it is really hard to program in and the programs are really long.

1.2.3: Pick the best replacements for 1 and 2 in the following sentence.
a) 1 = a process, 2 = a function
b)It is high-level if you are programming for a computer and low-level if you are programming for a phone or mobile device.
c) It is high-level if the program must be processed before it can run, and low-level if the computer can execute it without additional processing.
d) It is high-level if it easy to program in and is very short; it is low-level if it is really hard to program in and the programs are really long.
Submit

1.3.1: The activecode interpreter allows you to (select all that apply):
a) Save programs and reload saved programs.
b) Type in Python source code.
c) Execute Python code right in the text itself within the web browser.
d) Receive a yes/no answer about whether your code is correct or not.

1.3.2: Codelens allows you to (select all that apply):
a) Measure the speed of a program’s execution
b) Control the step by step execution of a program.
c) Write and execute your own Python code
d) Execute the Python code that is in Codelens.

Submit

1.4.1: A program is:
a) A sequence of instructions that specifies how to perform a computation.
b) Something you follow along at a play or concert.
c) A computation, even a symbolic computation.
d) The same thing as an algorithm

Submit

1.5.1: Debugging is:
a) Tracking down programming errors and correcting them.
b) Removing all the bugs from your house.
c) Finding all the bugs in the program.
d) Fixing the bugs in the program.

Submit

1.6.1: Which of the following is a syntax error?
a) Attempting to divide by 0
b) Forgetting a colon at the end of a statement where one is required
c) Forgetting to divide by 100 when printing a percentage amount.

1.6.2: Who or what typically finds syntax errors?
a) Programmer
b)Compiler / Interpreter
c) Computer
d) Teacher / Instructor

Submit

1.7.1: Which of the following is a run-time error?
a) Attempting to divide by 0
b) Forgetting a colon at the end of a statement where one is required
c) Forgetting to divide by 100 when printing a percentage amount.

Submit

1.8.1: Which of the following is a semantic error?
a) Attempting to divide by 0
b) Forgetting a semi-colon at the end of a statement where one is required
c) Forgetting to divide by 100 when printing a percentage amount.

Submit

1.9.1: The difference between programming and debugging is:
a) Programming is the process of gradually debugging a program until it does what you want.
b) Programming is creative and debugging is routine.
c) Programming is fun and debugging is work.
d) There is no difference between them.

Submit

1.10.1: The differences between natural and formal languages include:
a) Natural languages can be parsed while formal languages cannot.
b) Ambiguity, redundancy, and literalness
c) There are no differences between natural and formal languages.
d) Tokens, structure, syntax, and semantics

1.10.2: True or False: Reading a program is like reading other kinds of text.
a) True
b) False

Submit

1.11.1: The print function:
a) Sends information to the printer to be printed on paper.
b) Displays a value on the screen.
c) Tells the computer to put the information in print, rather than cursive, format.
d) Tells the computer to speak the information.

Submit

1.12.1: What are comments for?:
a) To tell the computer what you mean in your program.
b) For the people who are reading your code to know, in natural language, what the program is doing.
c) None, they are extraneous information that is not needed.
d) None in a short program. They are only needed for really large programs.

Submit

2.1.1: How can you determine the type of a variable?
a) Print out the value and determine the data type based on the value printed.
b) Use the type function.
c) Use it in a known equation and print the result.
d) Look at the declaration of the variable.

2.1.2: What is the data type of 'this is what kind of data'?
a) character
b) integer
c) float
d) string
Submit

2.2.1: What value is printed by the following statement:

print( int(53.785) )

a) Nothing, it generates a runtime error.
b) 53
c) 54
d) 53.785


Submit

2.3.2: What is printed after the following set of statements?


day = "Thursday"
day = 32.5
day = 19
print(day)

a) Nothing is printed, a runtime error occurs.
b) Thursday
c) 32.5
d) 19


Submit

2.4.1: True or False: the following is a legal variable name in Python: A_good_grade_is_A+
a) True
b) False
Submit

2.6.1: What is printed from the following statement?

print (18 / 4)

a) 4.5
b) 5
c) 4
d) 2

2.6.2: What is printed from the following statement?

print (18 // 4)

a) 4.25
b) 5
c) 4
d) 2

2.6.3: What is printed from the following statement?

print (18 % 4)

a) 4.25
b) 5
c) 4
d) 2

Submit

2.7.1: What is printed from the following statements?

n = input("Please enter your age: ")
# user types in 18
print ( type(n) )

a) <class 'str'>
b) <class 'int'>
c) <class 18>
d) 18

Submit

2.8.1: What is the value of the following expression:

16 - 2 * 5 // 3 + 1

a) 14
b) 24
c) 3
d) 13.667

2.8.2: What is the value of the following expression:

2 ** 2 ** 3 * 3

a) 768
b) 128
c) 12
d) 256

Submit

2.9.1: After the following statements, what are the values of x and y?

x = 15
y = x
x = 22

a) x is 15 and y is 15
b) x is 22 and y is 22
c) x is 15 and y is 22
d) x is 22 and y is 15

Submit

2.10.1: What is printed by the following statements?

x = 12
x = x - 1
print (x)

a) 12
b) -1
c) 11
d) Nothing. An error occurs because x can never be equal to x - 1

Submit

6.1.1:Which of the following is a Boolean expression? Select all that apply
a) True
b) 3 == 4
c) 3 + 4
d) 3 + 4 == 7
e) "False"

Submit

6.2.1:What is the correct Python expression for checking to see if a number stored in a variable x is between 0 and 5.
a) x > 0 and < 5
b) 0 < x < 5
c) x > 0 or x < 5
d) x > 0 and x < 5
Submit

6.3.1:Which of the following properly expresses the precedence of operators(using parentheses) in the following expression: 5 * 3 > 10 and 4 + 6 ==11
a) ((5*3) > 10) and ((4+6) == 11)
b) (5*(3 > 10)) and (4 + (6 == 11))
c) ((((5*3) > 10) and 4)+6) == 11
d) ((5*3) > (10 and (4+6))) == 11
Submit

6.4.1: How many statements can appear in each block (the if and the else) in a conditional statement?
a) Just one
b) Zero or more.
c) One or more.
d) One or more, and each must contain the same number.

6.4.2: What does the following code print (choose from output a, b, c or nothing).

if (4 + 5 == 10):
    print("TRUE")
else:
    print("FALSE")
a.
  TRUE
b.
  FALSE
c.
  TRUE
  FALSE

a) Output a
b) Output b
c) Output c
d) Nothing will be printed


6.4.3: What does the following code print?

if (4 + 5 == 10):
    print("TRUE")
else:
    print("FALSE")
print("TRUE")
   
a.
  TRUE
b.
  TRUE
  FALSE
c.
  FALSE
  TRUE
d.
  TRUE
  FALSE
  TRUE

a) Output a
b) Output b
c) Output c
d) Output d


Submit

6.5.1: What does the following code print?

x = -10
if x < 0:
     print("The negative number ",  x, " is not valid here.")
print("This is always printed")

a.
 This is always printed
 
b.
 The negative number -10 is not valid here
 This is always printed
 
c.
 The negative number -10 is not valid here

a) Just one
b) Zero or more.
c) One or more.
d) It will cause an error because every if must have an else clause.


6.5.2: Will the following code cause an error?

x = -10
if x < 0:
    print("The negative number ",  x, " is not valid here.")
else:
    print(x, " is a positive number")
else:
    print("This is always printed")

a) No
b) Yes


Submit

6.6.1: Will the following code cause an error?

x = -10
if x < 0:
    print("The negative number ",  x, " is not valid here.")
else:
    if x > 0:
        print(x, " is a positive number")
     else:
        print(x," is 0")

a) No
b) Yes


Submit

6.7.1: Which of I, II, and III below gives the same result as the following nested if?

# nested if-else statement
x = -10
if x < 0:
   print("The negative number ",  x, " is not valid here.")
else:
    if x > 0:
       print(x, " is a positive number")
    else:
        print(x, " is 0")
I.

if x < 0:
    print("The negative number ",  x, " is not valid here.")
else (x > 0):
    print(x, " is a positive number")
else:
    print(x, " is 0")
   
II.

if x < 0:
    print("The negative number ",  x, " is not valid here.")
elif (x > 0):
    print(x, " is a positive number")
else:
    print(x, " is 0")
    
III.

if x < 0:
    print("The negative number ",  x, " is not valid here.")
if (x > 0):
    print(x, " is a positive number")
else:
    print(x, " is 0")

a) I only
b) II only
c) III only
d) II and III
e) I, II, and III


6.7.2: What will the following code print if x = 3, y = 5, and z = 2?

if x < y and x < z:
    print ("a")
elif y < x and y < z
    print ("b")
else:
    print ("c")

a) a
b) b
c) c


Submit

6.8.1: What is a Boolean function?
a) A function that returns True or False
b) A function that takes True or False as an argument
c) The same as a Boolean expression

6.8.2: Is the following statement legal in Python (assuming x, y and z are defined to be numbers)?

return x + y < z

a) Yes
b) No


Submit

7.2.1: True or False: You can rewrite any for-loop as a while-loop.
a) True
b) False

7.2.2: The following code contains an infinite loop. Which is the best explanation for why the loop does not terminate?

n = 10
answer = 1
while ( n > 0 ):
  answer = answer + n
     n = n + 1
print answer

a) n starts at 10 and is incremented by 1 each time through the loop, so it will always be positive
b) answer starts at 1 and is incremented by n each time, so it will always be positive N
c) You cannot compare n to 0 in while loop. You must compare it to another variable.
d) In the while loop body, we must set n False, and this code does not do that.


Submit

7.3.1: Which type of loop can be used to perform the following iteration: You choose a positive integer at random and then print the numbers from 1 up to and including the selected integer.
a) a for-loop or a while-loop
b) only a for-loop
c) only a while-loop

7.3.2: In the random walk program in this section, what does the isInScreen function do?
a) Returns True if the turtle is still on the screen and False if the turtle is no longer on the screen.
b) Uses a while loop to move the turtle randomly until it goes off the screen.
c) Turns the turtle right or left at random and moves the turtle forward 50.
d) Calculates and returns the position of the turtle in the window.
Submit

7.4.1: Consider the code that prints the 3n+1 sequence in ActiveCode box 6. Will the while loop in this code always terminate for any value of n?
a) Yes.
b) No.
c) No one knows.
Submit

7.7.1: What is the difference between a tab (\t) and a sequence of spaces?
a) A tab will line up items in a second column, regardless of how many characters were in the first column, while spaces will not.
b) There is no difference
c) A tab is wider than a sequence of spaces
d) You must use tabs for creating tables. You cannot use spaces.
Submit

7.8.1.1: If you have a pixel whose RGB value is (20, 0, 0), what color will this pixel appear to be?
a) Dark red
b) Light red
c) Dark green
d) Light green

7.8.2.1: In the example in ActiveCode box 10, what are the RGB values of the pixel at row 100, column 30?
a) 149 132 122
b) 183 179 170
c) 165 161 158
d) 201 104 115

7.8.3.1: What will the following nested for-loop print? (Note, if you are having trouble with this question, review CodeLens 3).

for i in range(3):
  for j in range(2):
    print(i,j)
 
a.

 0   0
 0   1
 1   0
 1   1
 2   0
 2   1
 
b.

 0   0
 1   0
 2   0
 0   1
 1   1
 2   1
 
c.

 0   0
 0   1
 0   2
 1   0
 1   1
 1   2
 
d.

 0   1
 0   1
 0   1

a) Output a
b) Output b
c) Output c
d) Output d

7.8.3.2: What would the image produced from ActiveCode box 12 look like if you replaced the lines:

newred = 255-p.getRed()
newgreen = 255-p.getGreen()
newblue = 255-p.getBlue()

with the lines:

newred = p.getRed()
newgreen = 0
newblue = 0

a) It would look like a red-washed version of the bell image
b) It would be a solid red rectangle the same size as the original image
c) It would look the same as the original image
d) It would look the same as the negative image in the example code.


Submit


Student ID:

Section:

1. What is the most important skill for a computer scientist?
a) To think like a computer.
b) To be able to write code really well.
c) To be able to solve problems.
d) To be really good at math.

2. An algorithm is:
a) A solution to a problem that can be solved by a computer.
b)A step by step list of instructions that if followed exactly will solve the problem under consideration.
c) A series of instructions implemented in a programming language
d) A special kind of notation used by computer scientists

3. Source code is another name for:
a) The instructions in a program, stored in a file
b) The language that you are programming in (e.g., Python).
c) The environment/tool in which you are programming
d) The number (or 'code') that you must input at the top of each program to tell the computer how to execute your program.

4. What is the difference between a high-level programming language and a low-level programming language?
a) It is high-level if you are standing and low-level if you are sitting.
b) It is high-level if you are programming for a computer and low-level if you are programming for a phone or mobile device.
c) It is high-level if the program must be processed before it can run, and low-level if the computer can execute it without additional processing.
d) It is high-level if it easy to program in and is very short; it is low-level if it is really hard to program in and the programs are really long.

5. Pick the best replacements for 1 and 2 in the following sentence.
a) 1 = a process, 2 = a function
b) 1 = translating an entire book, 2 = translating a line at a time
c)1 = software, 2 = hardware
d) 1 = object code, 2 = byte code

6. The activecode interpreter allows you to (select all that apply):
a) Save programs and reload saved programs.
b) Type in Python source code.
c) Execute Python code right in the text itself within the web browser.
d) Receive a yes/no answer about whether your code is correct or not.

7. Codelens allows you to (select all that apply):
a) Measure the speed of a program’s execution
b) Control the step by step execution of a program.
c) Write and execute your own Python code
d) Execute the Python code that is in Codelens.

8. A program is:
a) A sequence of instructions that specifies how to perform a computation.
b) Something you follow along at a play or concert.
c) A computation, even a symbolic computation.
d) The same thing as an algorithm

9. Debugging is:
a) Tracking down programming errors and correcting them.
b) Removing all the bugs from your house.
c) Finding all the bugs in the program.
d) Fixing the bugs in the program.

10. Which of the following is a syntax error?
a) Attempting to divide by 0
b) Forgetting a colon at the end of a statement where one is required
c) Forgetting to divide by 100 when printing a percentage amount.

11. Who or what typically finds syntax errors?
a) Programmer
b)Compiler / Interpreter
c) Computer
d) Teacher / Instructor

12. Which of the following is a run-time error?
a) Attempting to divide by 0
b) Forgetting a colon at the end of a statement where one is required
c) Forgetting to divide by 100 when printing a percentage amount.

13. Which of the following is a semantic error?
a) Attempting to divide by 0
b) Forgetting a semi-colon at the end of a statement where one is required
c) Forgetting to divide by 100 when printing a percentage amount.

14. The difference between programming and debugging is:
a) Programming is the process of gradually debugging a program until it does what you want.
b) Programming is creative and debugging is routine.
c) Programming is fun and debugging is work.
d) There is no difference between them.

15. The differences between natural and formal languages include:
a) Natural languages can be parsed while formal languages cannot.
b) Ambiguity, redundancy, and literalness
c) There are no differences between natural and formal languages.
d) Tokens, structure, syntax, and semantics

16. True or False: Reading a program is like reading other kinds of text.
a) True
b) False

17. The print function:
a) Sends information to the printer to be printed on paper.
b) Displays a value on the screen.
c) Tells the computer to put the information in print, rather than cursive, format.
d) Tells the computer to speak the information.

18. What are comments for?:
a) To tell the computer what you mean in your program.
b) For the people who are reading your code to know, in natural language, what the program is doing.
c) None, they are extraneous information that is not needed.
d) None in a short program. They are only needed for really large programs.


Student ID:

Section:

1.)Which of the following is a Boolean expression? Select all that apply
a) True
b) 3 == 4
c) 3 + 4
d) 3 + 4 == 7
e) "False"

2.)What is the correct Python expression for checking to see if a number stored in a variable x is between 0 and 5.
a) x > 0 and < 5
b) 0 < x < 5
c) x > 0 or x < 5
d) x > 0 and x < 5

3.)Which of the following properly expresses the precedence of operators(using parentheses) in the following expression: 5 * 3 > 10 and 4 + 6 ==11
a) ((5*3) > 10) and ((4+6) == 11)
b) (5*(3 > 10)) and (4 + (6 == 11))
c) ((((5*3) > 10) and 4)+6) == 11
d) ((5*3) > (10 and (4+6))) == 11

4.) How many statements can appear in each block (the if and the else) in a conditional statement?
a) Just one
b) Zero or more.
c) One or more.
d) One or more, and each must contain the same number.

5.) What does the following code print (choose from output a, b, c or nothing).

if (4 + 5 == 10):
    print("TRUE")
else:
    print("FALSE")
a.
  TRUE
b.
  FALSE
c.
  TRUE
  FALSE

a) Output a
b) Output b
c) Output c
d) Nothing will be printed


6.) What does the following code print?

if (4 + 5 == 10):
     print("TRUE")
else:
   print("FALSE")
print("TRUE")
   
a.
  TRUE
  
b.
  TRUE
  FALSE
  
c.
  FALSE
  TRUE
d.
  TRUE
  FALSE
  TRUE

a) Output a
b) Output b
c) Output c
d) Output d


7.) What does the following code print?

x = -10
if x < 0:
    print("The negative number ",  x, " is not valid here.")
print("This is always printed")
   
a.
  This is always printed
  
b.
  The negative number -10 is not valid here
  This is always printed
  
c.
  The negative number -10 is not valid here

a) Just one
b) Zero or more.
c) One or more.
d) It will cause an error because every if must have an else clause.


8.) Will the following code cause an error?

x = -10
if x < 0:
  print("The negative number ",  x, " is not valid here.")
else:
  print(x, " is a positive number")
else:
  print("This is always printed")

a) No
b) Yes


9.) Will the following code cause an error?

x = -10
if x < 0:
    print("The negative number ",  x, " is not valid here.")
else:
   if x > 0:
      print(x, " is a positive number")
   else:
       print(x," is 0")

a) No
b) Yes


10). Which of I, II, and III below gives the same result as the following nested if?

# nested if-else statement
x = -10
if x < 0:
   print("The negative number ",  x, " is not valid here.")
else:
   if x > 0:
      print(x, " is a positive number")
    else:
      print(x, " is 0")
I.
if x < 0:
   print("The negative number ",  x, " is not valid here.")
else (x > 0):
   print(x, " is a positive number")
else:
   print(x, " is 0")
   
II.
if x < 0:
   print("The negative number ",  x, " is not valid here.")
elif (x > 0):
   print(x, " is a positive number")
else:
   print(x, " is 0")
   
III.
if x < 0:
   print("The negative number ",  x, " is not valid here.")
if (x > 0):
    print(x, " is a positive number")
else:
   print(x, " is 0")

a) I only
b) II only
c) III only
d) II and III
e) I, II, and III


11.) What will the following code print if x = 3, y = 5, and z = 2?

if x < y and x < z:
   print ("a")
elif y < x and y < z
   print ("b")
else:
   print ("c")

a) a
b) b
c) c


12.) What is a Boolean function?
a) A function that returns True or False
b) A function that takes True or False as an argument
c) The same as a Boolean expression

13.) Is the following statement legal in Python (assuming x, y and z are defined to be numbers)?

return x + y < z

a) Yes
b) No



Student ID:

Section:

1.) True or False: You can rewrite any for-loop as a while-loop.
a) True
b) False

2.) The following code contains an infinite loop. Which is the best explanation for why the loop does not terminate?

n = 10
answer = 1
while ( n > 0 ):
  answer = answer + n
     n = n + 1
print answer

a) n starts at 10 and is incremented by 1 each time through the loop, so it will always be positive
b) answer starts at 1 and is incremented by n each time, so it will always be positiveN
c) You cannot compare n to 0 in while loop. You must compare it to another variable.
d) In the while loop body, we must set n False, and this code does not do that.


3.) Which type of loop can be used to perform the following iteration: You choose a positive integer at random and then print the numbers from 1 up to and including the selected integer.
a) a for-loop or a while-loop
b) only a for-loop
c) only a while-loop

4.) In the random walk program in this section, what does the isInScreen function do?
a) Returns True if the turtle is still on the screen and False if the turtle is no longer on the screen.
b) Uses a while loop to move the turtle randomly until it goes off the screen.
c) Turns the turtle right or left at random and moves the turtle forward 50.
d) Calculates and returns the position of the turtle in the window.

5.) Consider the code that prints the 3n+1 sequence in ActiveCode box 6. Will the while loop in this code always terminate for any value of n?
a) Yes.
b) No.
c) No one knows.

6.) What is the difference between a tab (\t) and a sequence of spaces?
a) A tab will line up items in a second column, regardless of how many characters were in the first column, while spaces will not.
b) There is no difference
c) A tab is wider than a sequence of spaces
d) You must use tabs for creating tables. You cannot use spaces.

7.) If you have a pixel whose RGB value is (20, 0, 0), what color will this pixel appear to be?
a) Dark red
b) Light red
c) Dark green
d) Light green

8.) In the example in ActiveCode box 10, what are the RGB values of the pixel at row 100, column 30?
a) 149 132 122
b) 183 179 170
c) 165 161 158
d) 201 104 115

9.) What will the following nested for-loop print? (Note, if you are having trouble with this question, review CodeLens 3).

for i in range(3):
  for j in range(2):
    print(i,j)
 
a.
 0   0
 0   1
 1   0
 1   1
 2   0
 2   1
 
b.
 0   0
 1   0
 2   0
 0   1
 1   1
 2   1
 
c.
 0   0
 0   1
 0   2
 1   0
 1   1
 1   2
 
d.
 0   1
 0   1
 0   1

a) Output a
b) Output b
c) Output c
d) Output d


10.) What would the image produced from ActiveCode box 12 look like if you replaced the lines:

newred = 255-p.getRed()
newgreen = 255-p.getGreen()
newblue = 255-p.getBlue()

with the lines:

newred = p.getRed()
newgreen = 0
newblue = 0

a) It would look like a red-washed version of the bell image
b) It would be a solid red rectangle the same size as the original image
c) It would look the same as the original image
d) It would look the same as the negative image in the example code.



Student ID:

Section:

1. How can you determine the type of a variable?
a) Print out the value and determine the data type based on the value printed.
b) Use the type function.
c) Use it in a known equation and print the result.
d) Look at the declaration of the variable.

2. What is the data type of 'this is what kind of data'?
a) character
b) integer
c) float
d) string

3. What value is printed by the following statement:

print( int(53.785) )

a) Nothing, it generates a runtime error.
b) 53
c) 54
d) 53.785


4. What is printed after the following set of statements?

day = "Thursday"
day = 32.5
day = 19
print(day)

a) Nothing is printed, a runtime error occurs.
b) Thursday
c) 32.5
d) 19


5. True or False: the following is a legal variable name in Python: A_good_grade_is_A+
a) True
b) False

6. What is printed from the following statement?

print (18 / 4)

a) 4.5
b) 5
c) 4
d) 2

7. What is printed from the following statement?

print (18 // 4)

a) 4.25
b) 5
c) 4
d) 2

8. What is printed from the following statement?

print (18 % 4)

a) 4.25
b) 5
c) 4
d) 2

9. What is printed from the following statements?

n = input("Please enter your age: ")
# user types in 18
print ( type(n) )

a) <class 'str'>
b) <class 'int'>
c) <class 18>
d) 18

10. What is the value of the following expression:

16 - 2 * 5 // 3 + 1

a) 14
b) 24
c) 3
d) 13.667

11. What is the value of the following expression:

2 ** 2 ** 3 * 3

a) 768
b) 128
c) 12
d) 256

12. After the following statements, what are the values of x and y?

x = 15
y = x
x = 22

a) x is 15 and y is 15
b) x is 22 and y is 22
c) x is 15 and y is 22
d) x is 22 and y is 15

13. After the following statements, what is the value of x?

x = 12
x = x - 1
print (x)

a) 12
b) -1
c) 11
d) Nothing. An error occurs because x can never be equal to x - 1



Student ID:

Section:

1.) Match the following definitions by dragging and dropping the keywords

Objects or elements used to create an application.
User-initiated, Initialization, Timer, and External.
Corresponds to the app's behaviors; that is, it is where you define how the app should respond to the events.
The Component Designer, the Blocks Editor, and the Emulator.
Named memory slots representing attributes that define a component.

Component

Properties

Event-Handler

Event types

Tools that compound the AppInventor programming environment.



2.) There are two main types of components in an app: visible and non-visible. The "LocationSensor" and the "TextToSpeech" components are examples of visible components.
a) True
b) False

3.) Width, Height, Alignment, and Text, are examples of behaviors of a Button component.
a) True
b) False

4.) You can find the "TextToSpeech" component in the Palette under the "Sensors" group
a) True
b) False

5.) In the Palette and among the "Media" components, you can find the the ImagePicker, a special-purpose button. When the user taps an image picker, the device's image gallery appears, and the user can choose an image. After the user picks an image, the property ImagePath is set to a name that designates the image. (Hint: you can know more about the ImagePicker on the AppInventor documentation)
a) True
b) False

6.) Select the option that contains a conditional block
a)
b)
c)
d)

7.) Match the following definitions by dragging and dropping the keywords

Named memory cells that that are associated to a feature of a component.
Named memory cells that can be thought as the app's hidden "scratch" memory. They are symbolic names given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents.
Defines the variable "BackgroundColor" having as initial value Red.
Sets the value of the "BackgroundColor" property as Red.

Properties

Variables














Student ID:

Section:

1.)What are the two parts to programming?
a) Understanding the logic of the app
b) Translating the logic into some form of programming language.
c) Show an audience an interactive model for the app you are going to create.
d) Design and run an app at the end of program.

2. It is better to test a program when it is done. It helps the programmer to save time on debugging and testing.
a) True
b) False

3. The black box with a question mark "?" that appears in the following block sample is a:

a) Comments
b) Helps
c) Question from the block
d) Repeating block

4. Imagine that the app containing the blocks below is ran or executed for the first time. After the screen shows up, the first thing the user does is to touch the Canvas_drawing component (the screen), this displays a circle. Remember, the Canvas component has the method DrawCircle that draws a circle with radius r at the position x, y. What is the radius of the circle displayed on the in the canvas?

a) 8
b) 5
c) 2
d) 7

5. Imagine that the app containing the blocks below is ran or executed for the first time. After the screen shows up, the first thing the user does is to press one time the Button_image component. For the user, nothing happens. The user then touches the Canvas_drawing component (the screen), this displays a circle. Remember, the Canvas component has the method DrawCircle that draws a circle with radius r at the position x, y. What is the radius of the circle displayed on the in the canvas?

a) 7
b) 8
c) 5
d) 2


Student ID:

Section:

1.)For the following blocks, the number 20 represents:

a) The drawing of the circle with radius 20 pixels.
b) The drawing of a line with thickness 20 pixels.
c) The drawing of the circle with radius 20 millimeters.
d) The distance between points x and y is 20 pixels
e) The distance between points x and y is 20 millimeters
f) The center (midpoint) of the DrawCircle is 20 pixels
g) The center (midpoint) of the DrawCircle is 20 millimeters

2. For the following blocks, after SmallButton is clicked twice, the value for variable dotSize will be:

a) 2
b) 10
c) 5
d) 12

3. According to the following blocks, after NewNoteBUtton is clicked three times, the value for variable orange will be:

a) 96
b) 30
c) 36
d) 40

4. According to the following blocks, after NewNoteBUtton is clicked twice, the value for variable apple is:

a) 300
b) 294
c) -360
d) -330

5. For the following blocks, the initial value for variable dotSize is:

a) 12
b) 10
c) 5
d) 2

6. For the following blocks, the initial value for variable orange is:

a) 7
b) 8
c) 6
d) 2


Student ID:

Section:

1. A drawing canvas is really a table of pixels, where a pixel is the tiniest possible dot of color that can appear on the display (screen). A canvas is defined by an X-Y coordinate system, with x defining a location on the horizontal plane (the column), and the y defining a location on the vertical plane (the row). Imagine that the grid in the picture is a canvas and each cell represents a pixel. What are the coordinates of the pixels (cells) labeled A, B, C, D, and E?

a) A(x=0,y=0), B(x=1,y=1), C(x=2,y=2), D(x=3,y=3), and E(x=4,y=4)
b) A(x=1,y=1), B(x=2,y=2), C(x=3,y=3), D(x=4,y=4), and E(x=5,y=5)
c) A(x=0,y=4), B(x=1,y=3), C(x=2,y=2), D(x=3,y=1), and E(x=5,y=0)
d) A(x=1,y=5), B(x=2,y=4), C(x=3,y=3), D(x=4,y=2), and E(x=5,y=1)

2.)From the list below, select ALL the methods for changing the appearence of a Canvas, from the animation point of view.
a) Moving the Canvas around the screen
b) Placing and moving objects with in the Canvas.
c) Painting or drawing on the Canvas
d) Rotating the Canvas

3.)From the list below, select ALL the functions or methods provided by the Canvas component that allow to paint on within it.
a) DraLine
b) DrawCircle
c) PaintColor
d) FontSize

4. In your MoleMash app, you use a Clock component (you named it MoleTimer) as timer to call the MoveMole procedure, which produce the animation (moving the mole randomly around the screen). In your MoleTimer you set the TimerInterval to 500, which represents a period of time that the app have to wait before moving the mole again. By changing the TimeInterval to 250 the mole would move twice faster.
a) True
b) False

5. In App Inventor, an Sprite (an animated object) provides an event-handler named Sprite.CollidedWith. From the list below, select the event that would trigger this event-handler.
a) When the Sprite collides with the any edge of the screen
b) When the Sprite touches other Sprite
c) When the Sprite collides with the mouse pointer
d) When the user touches the Sprite

6. The black box with a question mark "?" that appears in the following block sample is a:

a) Comments
b) Questions
c) Repeating block
d) Help
e) Block Error
f) Blocking link

7.)What are the two parts to programming?
a) Understanding the logic of the app
b) Translating the logic into some form of programming language.
c) Show an audience an interactive model for the app you are going to create.
d) Design and run an app at the end of program.

8. It is better to test a program when it is done. It helps the programmer to save time on debugging and testing.
a) True
b) False

9. For the following blocks, when the program runs for the first time, the radius of the drawing circle in the canvas is:

a) 7
b) 8
c) 5
d) 2

10. For the following blocks, when the button named image is clicked, the radius of the drawing circle in the canvas is:

a) 7
b) 8
c) 5
d) 2


Student ID:

Section:

1.)From the list below, select only the conditional blocks provided in App Inventor
a)
b)
c)
d)

2.) The purpose of the test slot in a condition block is to provide a plug for a mathematical equation. The equation is tested and if it is well defined (no errors) then then-do part is executed.
a) True
b) False

3.) then-do slot in a condition block is where you plug other blocks that should be executed when the test in the condition block is evaluated to true.
a) True
b) False

4.)From the following list, select all the valid Boolean expressions that could be plugged into the test slot in a condition block.
a)
b)
c)
d)

5.) ifelse conditional block provides a then-do slot, and the blocks plugged in that slot are executed only when the Boolean expression plugged in test slot is false
a) True
b) False

6.) A "list" represents a sequential set of data. Since a variable can only store one value, either a number of a text, you cannot define a list variable, a variable containing several elements.
a) True
b) False

7.)The elements of a list are accessed using an "index". An index is a position in a list. Computer scientist count from zero, so in AppInventor as in any other programming language, the first element in a list is the element with index equal to zero.
a) True
b) False

8. Imaging that you have a list of phone numbers as shown in the picture. What would be the value returned by the "select list item" block in the right side?

a) 555-6666
b) 111-2222
c) 333-4444
d) None of the above, since index 3 would generate an error.


Figure 1

9.) Base on Figure 1 above determine wether the following statment is True or False: If the user clicks once in the ColorButton component, the BakcgroundColor of the ColorButton button will be Green.
a) True
b) False

10.)Base on Figure 1 above determine wether the following statment is True or False: If the user clicks TWICE in the ColorButton component, the BakcgroundColor of the ColorButton button will be Orange.
a) True
b) False

11. Base on Figure 1 above determine wether the following statment is True or False: If the user clicks 4 TIMES in the ColorButton component, the BakcgroundColor of the ColorButton button will be Red.
a) True
b) False

12. Base on Figure 1 above determine wether the following statment is True or False: There is no way the user can make the BakcgroundColor of the ColorButton button to be Green.
a) True
b) False

13. "Static lists" are those list whose elements are define by the programmer and whose items do not change unless the programmer changes the blocks. In the other hand, "dynamic lists" are those lists that change based on the end user entering new items, on new items being loaded in from a database or web information source.
a) True
b) False


Student ID:

Section:

1.)"Static lists" are those list whose elements are define by the programmer and whose items do not change unless the programmer changes the blocks. In the other hand, "dynamic lists" are those lists that change based on the end user entering new items, on new items being loaded in from a database or web information source.
a) True
b) False

2.) Giving the following blocks, what would be the value displayed in the PickedAnswerLabel label when the user clicks in the SelectAnswerButton button?

a) Wilson
b) Nixon
c) Ford
d) Carter
e) None of the above because the blocks in the SelectAnswerButton.Click event will produce an error.

3.) Just as the conditional blocks ("if" and the "ifelse" blocks), repeat or looping blocks allow a program to branch.
a) True
b) False

4.)AppInventor provides two types of repeat blocks: "foreach" and "while". The block "foreach" is used to specify functions that should be performed on each element of a list. The block "while" is more general than the "foreach", it is used to program blocks that continually repeat until some arbitrary condition changes.
a) True
b) False

5.) Giving the following blocks, what would be the value displayed in the ResultLabel label when the user clicks the button CalculateButton?

a) 11
b) 15
c) 10
d) 5

6.) Imagine we want to implement some extra features for the Pac Mac game. Which of the following features describe a case where a persistent data storing method would be needed?


a) Show the highest score from all the times you have played the game
b) The reset button should set the number of hits and misses to zero.
c) A text box asking to input user's name
d) An image moving within the canvas
e) An extra image moving within the canvas

7.)According to the following block program, which statement could represent a possible error?

a) tags of TinyDB can never be a number
b) The valueToStore can never display in a Label
c) tinyDB_number can only store numbers
d) TinyDB can never be true in a button component
e) Nothing is wrong with the program

8. For the following program blocks, when HitsCounterLabel is equal to -1, what will happen with the application?

a) LabelLevel will display GAME OVER!
b) HitsCounterLabel will display 0
c) MissesCounterLabel will display 0
d) LabelLevel will display -1
e) LabelLevel will display 0

9.) According to the following program blocks, every time when you run the application, the tag of your TinyDB1 is used to:
a) Retrieve the data from the database
b) Store the data to the database TinyDB1
c) Display the text responseMessage
d) Store in ResponseLabel responseMessage
e) Reset the ResponseLabel to responseMessage

10.)Which are the two components that appinventor provides for persistent data storage?
a) TinyWebDB
b) TinyDB
c) ValueToStore
d) GetValue
e) Display Value

11. TinyWebDB processes the requested data faster than TinyDB
a) True
b) False