AP CS Principles Algorithms & Programming

AP CS Principles Algorithms & Programming

Assessment

Flashcard

Computers

9th Grade - University

Hard

Created by

Quizizz Content

FREE Resource

Student preview

quiz-placeholder

8 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is the result of the following AP pseudocode? You may assume that the isPrime procedure accepts a whole number and returns Boolean true if the number is prime and Boolean false if the number is composite.

n ← 0
primes ← []

REPEAT UNTIL(n > 100)
{
  IF(isPrime(n))
  {
    APPEND(primes, n)
  }
  n ← n + 1

Back

The primes list contains all of the prime numbers from 0 to 100.

2.

FLASHCARD QUESTION

Front

What does the following AP pseudocode procedure do?
PROCEDURE mystery(num)
{
IF(num MOD 2 = 0)
{
RETURN(true)
}
ELSE
{
RETURN(false)
}
}

Back

Returns true if the num argument is an even number; returns false otherwise.

3.

FLASHCARD QUESTION

Front

Smyth County Public Schools' Director of Transportation is trying to figure out bus routes for the coming school year. He wants to minimize miles traveled, while still picking up all students who request bus transport. What kind of solution is he likely to use?

Back

A heuristic approach that comes up with a reasonable set of routes that is not necessarily the most optimal solution.

4.

FLASHCARD QUESTION

Front

True or False: there are certain problems that cannot be solved algorithmically.

Back

True

5.

FLASHCARD QUESTION

Front

When measuring the efficiency of an algorithm, is the growth rate of the number of moves required to solve the Towers of Hanoi problem (which grows exponentially) considered reasonable or unreasonable?

Back

Unreasonable

6.

FLASHCARD QUESTION

Front

What kind of coding error occurs if a program using Zeller's Congruence incorrectly determines that Feb. 29, 2021 fell on a Monday? Options: Syntactical error, Run-time error, Logic error, Overflow error

Back

Logic error

7.

FLASHCARD QUESTION

Front

A problem for which no algorithm can be constructed that will provide a correct answer for every set of inputs is called:

Back

An undecidable problem

8.

FLASHCARD QUESTION

Front

What is the output of this circuit which is composed of two logic gates?

Back

True