Master Programming Logic Questions in AP CSP Exam | Alps Academy

international student with laptop smiling

AP CSP Exam Preparation

In this series of articles we will explain some of the sample questions that are provided to help AP CSP students help with exam preparation.

Programming logic

This article focuses on the AP CSP exam questions related to programming logic. This includes logical operators in programming, Boolean logic and the sequence of direction and movements to move from a start to end location.

Sample Exam Questions

We have taken examples from the sample questions from the two practice question sets from 2021 and from previous practice exercises provided by the college board.

Although it does not mean these are going to be in the exam, it is assumed that the primary areas of computing, programming, networks, data and algorithms will form most of the CSP exam.

These articles will present and explain questions and answers in these areas.

What type of programming logic questions will be in the CSP exam?

We don’t know. But we do know that during the AP CSP course we have learn about conditional if statements, logical operators. and we think of directing a robot type questions.

In addition to the normal questions there are also Boolean logic with True and False, Not True, etc.

Practice Exam questions

Read the questions and check your answer with the explanation below. We want to help everybody so if you think the question is easy then move on to the next question without reading the solution if you wish.

Some questions have more than one answer – these multiple answer questions are also in the AP CSP exam.

Boolean expression

Which of these is NOT a Boolean expression?

  • A. IF (eyes = brown AND height > 60)
  • B. REPEAT UNTIL (song = favSong)
  • C. IF (NOT ( pet = cat ) )
  • D. x <- (x + 42)

Which of these options are True or False expressions and which one is not?

A is either T or F, B is not as straightforward but the brackets is a condition, C again is a condition, true or false. D is the odd one out, it is an assignment which adds 42 to x.

Answer: D

Which of these is a Boolean expression?

  • x ← 14
  • temp < high
  • 32 / (7-5)
  • Y ← temp * 25 / 4

Boolean logic

Which of the following will evaluate to false?
i. false AND (true OR NOT (false) )
ii. true AND (NOT (true AND false ))
iii. NOT( false OR (true OR false) )
  • A. i and ii
  • B. ii and iii
  • C. i and iii
  • D. i, ii and iii

This is a lot easier if you know your tables for AND and OR. As you can see below 2 True = True and 2 False = False, but one of each is different for AND and OR. 

AND

practicequestionapcspexam

OR

practicequestionapcspexam

We think – if either is True then its True with OR, but if they are not both True then they are False with AND. So (true and false) in ii is false, but in iii (true or false) is true.

Lets look at each of the statements. We use T for True and F for False.

F +(T or T)  means F + T, which is False

T + (NOT (F) ) is the same as T + T, which evaluates as True

F OR (T OR F) -> F OR T -> T, so NOT(T) is False

So we get i and iii as False

Answer: C

practicequestionapcspexam

Which of the following is a true statement about input A?

  • A. Input A must be true
  • B. Input A must be false
  • C. Input A can be either true or false
  • D. There is no possible value of input A that will cause the circuit to have the output true
In this diagram we need to work out A. Well only True and True make True so we know the output is True of the first part.
So what makes True in the OR table with false? Only True. So if we use False then it is wrong, but True it is good.
 

Answer: A

Robot logic

apcsp grid question
What moves get from the arrow to the circle?
    • MOVE FORWARD( )
    • ROTATE RIGHT( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • ROTATE LEFT( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • ROTATE RIGHT( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )

    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • ROTATE LEFT( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
apcsp grid question
What moves get from the arrow to the circle?
    • MOVE FORWARD( )
    • ROTATE LEFT( )
    • MOVE FORWARD( )
    • ROTATE RIGHT( )
    • MOVE FORWARD( )
    • ROTATE LEFT( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • ROTATE RIGHT( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • ROTATE LEFT( )
    • MOVE FORWARD( )

    • ROTATE RIGHT( )
    • MOVE FORWARD( )
    • MOVE FORWARD( )
    • ROTATE LEFT( )
    • MOVE FORWARD( )

More AP CSP exam practice questions

This is the last of a series of articles that take questions from the sample practice exams.

The first article was about computing questions. Click on the following link to see this article: Computing Questions in the Computer Science Principles AP CSP Exam

The second article was about network questions. Click on the following link to see this article: Network Questions in the Computer Science Principles AP CSP Exam

The third article was about programming questions. Click on the following link to see this article: Programming Questions in the Computer Science Principles AP CSP Exam

The fourth article was about algorithm questions. Click on the following link to see this article: Algorithm Questions in the Computer Science Principles AP CSP Exam

The last article was about data questions. Click on the following link to see this article: Data Questions in the Computer Science Principles AP CSP Exam.

If you wish to see an overview of the sample questions related to the AP CSP exam, please visit the following article:

Ultimate Guide to AP Computer Science Principles Exam Questions

AP CSP exam webpage

For all courses, articles and information relating to the AP Computer Science Principles Exam, see our dedicated web page. Click the following link to visit this webpage: AP CSP Exam webpage

Big Ideas exam practice questions

There are also practice questions grouped by the ‘big ideas’ that are here in pdf format.

So, if you want free download AP CSP questions and answers, then click on the big idea:

  1. Creative Development
  2. Data
  3. Algorithms and Programming
  4. Computer Systems and Networks
  5. Impact of Computing

Multiples Choice Answers

  • temp < high

C

  • MOVE FORWARD( )
  • MOVE FORWARD( )
  • ROTATE RIGHT( )
  • MOVE FORWARD( )
  • MOVE FORWARD( )

B

  • ROTATE LEFT( )
  • MOVE FORWARD( )
  • MOVE FORWARD( )
  • ROTATE RIGHT( )
  • MOVE FORWARD( )

Leave a Comment