wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

AP Computer Science Principles Semester 1 Python

Total questions: 75

Worksheet time: 41mins

Name
Class
Date
1.

What computer science concept stores information to be used later?

a)

Conditional

b)

Variable

c)

Loop

d)

Function

2.

What computer science concept does something different depending on the situation?

a)

Conditional

b)

Variable

c)

Loop

d)

Function

3.

What concept repeats whatever is inside it?

a)

Conditional

b)

Variable

c)

Loop

d)

Function

4.

What data type can hold more than one value?

a)

String

b)

Integer

c)

List

d)

Boolean

5.

What data type would store the value: 6.4?

a)

String

b)

List

c)

Boolean

d)

Float

6.

What data type would store the value: Oranges

a)

String

b)

Float

c)

Boolean

d)

Integer

7.

What data type would store the value: True

a)

Boolean

b)

String

c)

Integer

d)

Float

8.

What data value would store the value: 9?

a)

Float

b)

Integer

c)

String

d)

Boolean

9.

What keyword do you use to start a function in Python?

a)

Function

b)

Def

c)

In

d)

Key

10.

What would you put in an if statement to see if two values are equal?

a)

++

b)

==

c)

//

d)

||

11.

What symbol is used to either add two numbers together or join two strings in Python?

a)

-

b)

=

c)

+

d)

*

12.

ASCII is a character-encoding scheme that uses a numeric value to represent each character. For example, the uppercase letter “G” is represented by the decimal (base 10) value 71. A partial list of characters and their corresponding ASCII values are shown in the table above.


ASCII characters can also be represented by binary numbers. According to ASCII character encoding, which of the following letters is represented by the binary (base 2) number 1010100?

a)

N

b)

P

c)

T

d)

W

13.

Which of the following decimal (base-10) values is equivalent to the binary (base-2) value 101001?

a)

22

b)

37

c)

41

d)

82

14.

What value does the above code segment display?

a)

17

b)

36

c)

53

d)

No value is ever displayed because the algorithm repeats the REPEAT UNTIL block indefinitely.

15.

ASCII is a character-encoding scheme that uses 7 bits (8 bits if you are using the extended ASCII table) to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table above.


Which ASCII character is represented by the binary (base 2) number 1000001?

a)

A

b)

B

c)

C

d)

D

16.

What is Computational Thinking?

a)

Thinking about how computers work things out

b)

the objective analysis and evaluation of an issue in order to form a judgement.

c)

Abstraction, Decomposition, Pattern recognition, Algorithm Design

d)

Nothing to do with Computer Science

17.

Decomposition is:

a)

what happens in the compost heap

b)

To break things down into easier to handle chunks

c)

Getting rid of unnecessary information

d)

Creating a step-by-step guide to do something

18.

what is the formal name in computing for looping?

a)

Iteration

b)

Selection

c)

Repetition

d)

For While Do

19.

A program is expressed in a programming language. Which of the following is true of the program?

a)

The program can also be expressed as binary code, but will be more easily understood by humans when expressed in a higher-level programming language.

b)

The program can also be expressed as binary code, which will reduce the likelihood of errors.

c)

The program cannot be expressed as binary code, because binary code can only be used to represent data.

d)

Some parts of the program can be expressed as binary code, but operations must be expressed using a higher-level programming language.

20.

A flowchart is a way to visually represent an algorithm. The flowchart above uses the building blocks from the table above.


Which of the following statements best describes the behavior of the algorithm depicted in the flowchart?

Assume a always starts greater than b.

a)

It displays the sum of a and b.

b)

It displays the difference between a and b.

c)

It displays the product of a and b

d)

It runs in an infinite loop.

21.
What are the only two numbers you can use in binary?
a)
0 and 1
b)
1 and 2
c)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
d)
1, 2, 4, 8, 16
22.
Convert 128 to binary
a)
10000000
b)
01111110
c)
10000001
d)
11001100
23.

Which of these are the correct place values for binary?

a)

128,64,32,16,8,4,2,1

b)

128, 68,34,12,6,4,2,1

c)

1,0

d)

0,1

24.
What is the point of binary?
a)
It represents how computers interpret electrical signals
b)
Because we like to make you do extra maths ;-D
c)
For the lulz
d)
Because it describes star systems
25.

What is the ASCII code for ... A?

a)

65

b)

56

c)

97

d)

79

26.

What is the following word ... 79 78

a)

OFF

b)

ON

c)

OR

d)

ONE

27.
The binary number 01000001 represents the letter "A" in ASCII, which of the following represents the letter "B"
a)
01000011 
b)
01000010 
c)
00100001 
d)
01000001 
28.
Which color is this?
a)
#FF0000
b)
#00FF00
c)
#0000FF
d)
None of these
29.

Where is hexadecimal used on the internet?

a)

To represent colours (RGB values)

b)

It's written into every website to display text

c)

Videos are stored in hex

d)

On BBC Bitesize and that's the only place you'll ever find it

30.
What is the base of hexadecimal?
a)
2
b)
10
c)
16
d)
32
31.
What letters does hexadecimal use?
a)
A-F
b)
A-D
c)
P-W
d)
A-Z
32.
In computing, a bit is
a)
8 bytes
b)
a single    0 or 1     on or off
33.

Which of the file types is an audiofile type?

a)

jpg

b)

mp3

c)

png

d)

csv

34.

Consider the following three binary numbers:

01010

010000

1110

Which of the following lists the numbers in order from least to greatest?

a)

010000

1110

01010


b)

01010

1110

010000


c)

01010

010000

1110


d)

1110

01010

010000


35.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
36.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
37.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
38.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
39.
returns the remainder from division
a)
modulo
b)
exponments
c)
boolean
d)
variables
40.
symbol used for modulo
a)
%
b)
&
c)
#
d)
**
41.
10= 100
Which of the following is used in Python to calculate ten squared?
a)
10 ** 2
b)
10 * 2
c)
10 % 2
d)
10 ** 10
42.
In python the ' STRING data type' can be defined as...?
a)
holds alphanumeric text
b)
hold whole numbers
c)
holds numbers with a decimal point
d)
holds either a true or false value
43.
In python the ' INTEGER data type' can be defined as...?
a)
holds alphanumeric data as text
b)
holds whole numbers
c)
holds numbers with a decimal point
d)
holds either ‘true’ or ‘false’
44.
What is the correct definition for 'pseudo code?'
a)
a notation resembling a complex programming language, used in program design.
b)
a notation resembling a simplified programming language, used in program design.
45.
what is the code for a STRING in python?
a)
str
b)
stri
c)
stg
46.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
47.

Which of these codes is correct for creating a list of numbers in Python?

a)

num = ('10','29','37','109')

b)

num = ['10','29','37','109']

c)

num == ('10','29','37','109')

d)

num = ['10 29 37 109']

48.

What is the index number for 'Spain' in Python?

['England','Brazil','Spain','France']

a)

0

b)

1

c)

2

d)

3

49.

This question uses a robot in a grid of squares. The robot is represented as a triangle, which is initially facing up, towards the top of the grid. The robot is moved according to the instructions in the chart above.


Consider the following program which uses commands from the pseudocode described above.


REPEAT 4 TIMES {

MOVE_FORWARD()

MOVE_FORWARD()

MOVE_FORWARD()

ROTATE_RIGHT()

MOVE_FORWARD()

ROTATE_RIGHT()

MOVE_FORWARD()

ROTATE_RIGHT()

}


Which of the following images shows the path and ending location of the robot that will result from executing the code above. The starting location of the robot is shown as dotted triangle for cases where the robot does not start and end at the same location.

a)
b)
c)
d)
e)
50.

What is the most likely outcome of running the code shown in the image above?

a)

It will draw a star with each side 150 pixels long.

b)

The program will stop with an error at line 3 because parameters may not be used in for loops.

c)

The program will stop with an error at line 5 because it is dividing by 0.

d)

The program will run without error, but will not draw anything.

51.

A byte is _

a)

8 bits

b)

16 bits

c)

A sandwich

d)

a computer term

52.

A finite set of instructions that accomplish a task.

a)

comments

b)

problem

c)

algorithm

d)

variable

53.

A process for reducing the number of bits needed to represent something without losing any information.

a)

data compression

b)

lossy compression

c)

lossless compression

d)

decompressing

54.

A way of representing information using only 2 options.

a)

bit

b)

sampling

c)

byte

d)

binary

55.

Online research output free of any and all restrictions on access and free of many restrictions on use, such as copyright or licenses restrictions

a)

Open Access

b)

Open Source

c)

Intellectual Property

d)

Creative ommons

56.

An agreed-upon set of rules that specify the behavior of some system

a)

bandwidth

b)

protocol

c)

redundancy

d)

IP address

57.
The equality operator is used to compare two values, and returns a Boolean (true/false). 
a)
=
b)
==
c)
<=
d)
>=<
58.
Pulling out specific differences to make one solution work for multiple problems.
a)
Algorithm
b)
Aggregation
c)
None of the above
d)
Abstraction
59.
The universally recognized raw text format that any computer can understand.
a)
ASCII
b)
API
c)
JAVA
d)
Python
60.
Used in public key encryption, it is scheme in which the key to encrypt data is different from the key to decrypt.
a)
asymmetric encryption
b)
symmetric encryption
c)
one-way encryption
d)
None of the above
61.
A contraction of "Binary Digit". It is the single unit of information in a computer, typically represented as a 0 or 1.
a)
BYTE
b)
BIT
c)
Binary
d)
BOO
62.
In programming, an expression that evaluates to True or False. 

a)
Abstraction
b)
Boolean Expression
c)
Aggregate Expression
d)
None of the above
63.
A technique for encryption that shifts the alphabet by some number of characters
a)
Caesar Cipher 
b)
Moses Cipher
c)
Morse Code
d)
AARP Code
64.
All values in a programming language have a "type" - such as a Number, Boolean, or String - that dictates how the computer will interpret it. For example 7+5 is interpreted differently from "7"+"5"
a)
Variable type
b)
Form type
c)
Function type
d)
Data type
65.
A process of encoding messages to keep them secret, so only "authorized" parties can read it.
a)
Encoding
b)
Encryption
c)
Protecting
d)
Decryption
66.
A particular kind of looping construct provided in many languages. Typically, it defines a counting variable that is checked and incremented on each iteration in order to loop a specific number of times. 
a)
now loop
b)
if loop
c)
for loop
d)
if/now loop
67.
A piece of code that you can easily call over and over again.
a)
Function
b)
File
c)
Folder
d)
Frame
68.
A variable that can be used and updated by any part of the code. Its global scope is typically derived from the variable being declared (created) outside of any function, object, or method.
a)
Global
b)
Worldy
c)
International
d)
Unlimited
69.
The common programming structure that implements "conditional statements".
a)
If-Statement
b)
Now-Statement
c)
Conditionals
d)
Variables
70.
A type of data used for graphics or pictures.
a)
Image
b)
File
c)
Form
d)
GUI
71.
To repeat in order to achieve, or get closer to, a desired goal.
a)
Iterate
b)
Reformat
c)
Format
d)
Recurse
72.
A generic term for a programming data structure that holds multiple items
a)
Folder
b)
List
c)
File
d)
Comment
73.
A variable with local scope is one that can only be seen, used and updated by code within the same scope. Typically this means the variable was declared (created) inside a function -- includes function parameter variables. 
a)
Local variable
b)
Home variable
c)
Common variable
d)
Global variable
74.
The action of doing something over and over again in programming.
a)
Loop
b)
Repeat
c)
Redo
d)
Recurse
75.
A data compression method that uses inexact approximations, discarding some data to represent the content. Most commonly seen in image formats like .jpg.
a)
Lossy Compression
b)
Lossless Compression
c)
Prefect Compression
d)
Data Compression