Font size
WorksheetsY11 CS P2 mmd
Total questions: 100
Worksheet time: 53mins
Define ABSTRACTION
Breaking a task into smaller tasks.
Drawing a map to show how to reach a destination.
Creating step by step instructions.
Focusing on what is important and ignoring what is unnecessary.
Define PATTERN RECOGNITION.
A sequence of instructions.
Looking for similarities and trends.
Breaking a task into smaller tasks.
Focusing on what is important and ignoring what is unnecessary.
Select the best description to explain what a binary search algorithm is.
Put the elements in order, check each item in turn.
Put the elements in order, compare with the middle value, split the list in order and repeat.
Elements do not need to be in order, check each item in turn.
Elements do not need to be in order, compare to the middle value, split the list in order and repeat
12 6 8 1 3
How many comparisons would it take to find number 1?
3 5 9 10 23
How many comparisons would it take to find number 9?
1 5 10 13 48 68 100 101
How many comparisons would it take to find number 101?
Linear sort
Binary sort
Linear Sort
4 5 9 6 2 7
4 5 6 2 7 9
4 5 2 6 7 9
Linear Sort
4 8 6 2 5 7
4 8 6 2 5 7
4 6 8 2 5 7
Linear Sort
4 8 3 9 2 6
2 8 3 9 4 6
2 3 8 9 4 6
Merge Sort
1 4 2 9 3 8 5
What does the list look like after one pass of the bubble sort algorithm.
1 4 2 9 3 8 5
1 4 2 9 3 8 5
What does the list look like after one pass of the selection sort algorithm.
Don't know
1 4 2 9 3 8 5
What does the list look like after one pass of the insertion sort algorithm.
Don't know
What does a sorting algorithm do?
Finds an item of data in a list
Puts a list of items into order
Saves a set of data
Separates a list of data
Linear
The following two lists are to be merged, which element will be in position 5 in the new merged list?
List 1
2 4 7 9
List 2
1 6 8 12
8
7
6
4
For which of the problems would the bubble sort algorithm provide an appropriate solution. Choose all that apply.
Arranging a deck of cards from the lowest to the highest value cards.
Looking up a name in the phone book.
Sorting a stack of paper money into denominations -- i.e., £5, £10, £20 etc.
Sorting a basket of laundry into socks, shirts, shorts, and sheets.
Arranging books on a bookshelf by author's last name.
For what purpose would a merge sort algorithm be used?
To list items alphabetically.
To reorder a single list.
To combine identical lists together.
To reorder multiple lists into a singular ordered list.
The following is not true about variable names
They must be descriptive
They must be in capital letters
They can’t start with numbers or contain spaces
They point to memory locations
Consider the following expression: a = b. This means
a will always be equal to b
b is being renamed into a
The value of memory location a gets copied into memory location b
The value of memory location b gets copied into memory location a
Quotation marks around a variable’s identifier imply
It is an integer
It is a string
It is a Boolean
It is a real
The multiplication table is best displayed using this data type
Boolean
Character
Integer
Real
This variable type can only have True or False values
Boolean
Integer
String
Character
Casting refers to:
Boolean algebra
Rounding of reals
Converting between variable data types
Printing out of the program’s results
A type of control structure in flowchart that statements are placed one after the other and the execution takes place starting from up to down
Selection
Repetition
Sequence
A type of control structures in flowchart that allows a statement(s) to be executed repeatedly based on certain loop condition.
Repetition
Selection
Sequence
Variable
Python does not provide an array data structure, but what can we use instead?
List
Function
File
Record
The file operation that loads data from an open file into a variable or data structure in memory, is called what?
Close
Write
Open
Read
What is the operator used to calculate the remainder after a division ?
DIV
MOD
/
//
What is the main difference between procedures and functions ?
Procedures are usually longer and have more instructions
Functions use parameter passing, while procedures don’t
Functions are more difficult to debug
Functions return values, while procedures don’t
Write the output of the following code
30
-10
10
-30
What is pseudocode?
Simplified programming language, that is not a specific language
Complicated programming language
Simple programming language, which is linked to a specific language
A type of cheese
What will be the output?
name = "Dave"
print (name)
Dave
name
"Dave"
(name)
The correct way to convert user input is:
birth_year = number(input())
birth_year = int(input())
birth_year = (input(int))
birth_year = int(input)
To display the following on screen Hello World! the following command should be used:
print(Hello World!)
print("Hello World" + !)
print("Hello World!")
print"(Hello World!)"
You assign a value to a variable with which symbol
@
==
=
*
The code you use to receive and input from the keyboard
enter()
add()
receive()
input()
print(Hello world!)
guess=input()
guess=input()
guess=input()
guess=input()
Which word completes this sentence: "Iteration makes code more ___________"
Complex
Efficient
Simple
Straightforward
Which of these would work as a piece of code in Python?
IF answer == "Yes":
if answer == "Yes"
if answer == "Yes":
if answer = "yes":
If you want multiple options for your code, what should you use (after if)?
elif
else
if
select case
How many variables are there in this program?
2
3
4
5
What operator is being used in this program?
less than
greater than
less than or equal to
greater than or equal to
What would be the output of this program if the user entered "yes" then "what"?
Enjoy your day
it is too windy for an umbrella
Take an umbrella
Error
What would be the output of this program if the user entered "Alien"
Alienway
wayAlien
lienAay
ayAlien
How many errors are there in this code?
1
2
3
4
How many errors are there in this piece of code?
0
1
2
3
Which decision statement will be triggered if the variable x is less than 20?
if x > 20:
if x <> 20:
if x == 20:
if x < 20:
Which of these tests whether the variable x is the same as 'Hello'?
x = "Hello"
x != "Hello"
x == "Hello"
x <> "Hello"
What is the output of the following program?
Yes
No
Error
No output
What would the output of this code be if the user entered the value 70?
Pass
Fail
Merit
Distinction
What is the output of the following program?
1 to 10 numbers
1 to 5 numbers
1
5
Defensive design is about ...
Stopping other countries attacking your code
Writing boring programs
programs not breaking or doing "the wrong thing"
stopping other people stealing your code
The best idea for testing is to
write the whole program and test it at the end
test a simple version and keep testing as you develop
test the different parts of your program
get an alpha version out ASAP and let the users loose
Comments help
your code run better
slow down your code
make your code more maintainable
the computer to understand your code
Which of these can help maintenance (CHOOSE ALL)
indentation
commenting
compiling
blacklisting
What are the features of 'Well-Maintained Code'?
Comments and global variables.
No indentation.
Comments, indentation and suitably named variables.
Local variables only.
What is the main advantage of 'Well-Maintained Code'?
Easy to understand.
Fully tested.
Can be used again in the future.
Difficult to understand.
What is a syntax error?
When a program cannot link to the correct library, eg import math is missing.
When a program runs out of memory, eg print (X[3]) when there are only 3 items in a list/array.
When the rules and grammar of the programming language have not been followed, eg prnt().
When a program does something unexpected, eg X/0
What is a logic error?
When a program cannot link to the correct library, eg import math is missing.
When a program runs out of memory, eg print (X[3]) when there are only 3 items in a list/array.
When the rules and grammar of the programming language have not been followed, eg prnt().
When a program does something unexpected, eg X/0
What does IDE stand for?
Integrated Development Environment.
International Development Environment.
Integrated Documentation Envelope.
International Documentation Envelope.
When should comments be used within a program?
To help describe what code and structures are expected to do
To remind the developer if when lunch is
To include what tests must be carried out on the code
Every line, so that you know exactly what is happening
Which of the following ARE advantages of using subprograms?
(Select all that apply)
They make code easier to read
They make code easier to debug
Reduces duplicate code within a program
Allows code to be "reused" by different programmers
What term is used to describe data passed into/out of a program?
Variable
Loop
Constant
Parameter
Which of the following statements is not true?
Functions/subroutines are examples of reusable code
Functions and subroutines are always appropriate in programs
Using functions/subroutines make it easier to "deconstruct" a problem into smaller pieces
They can make programs easier to read and understand
What is this diagram called?
Truth Table
Gate Table
Output Table
Input Table
What is the boolean expression for this logic circuit?
Q = NOT (A OR B)
Q = NOT A AND B
NOT A OR B = Q
Q = (NOT A) OR B
What is the best explanation for why a computer uses boolean logic to manipulate True and False values?
It can only understand 0s and 1s
It runs instructions in a binary code
It doesn't have enough memory to store numbers above 1
It uses transistors which can only be on or off
A single logic gate is an electronic component made of transistors, which does what?
Performs calculations such as binary addition
Performs binary shifts left and right
Combines boolean inputs to produce a boolean output
Executes instructions stored in the main memory
What is the boolean expression for this logic circuit?
A OR B AND C = Q
Q = (A AND B) OR C
Q = A OR (B AND C)
Q = (A OR B) AND C
