Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Y12 CS PC1

Total questions: 104

Worksheet time: 1hrs 3mins

Name
Class
Date
1.

How do I import the pygame library?

a)

import pygame

b)

pygame.init()

c)

surface = pygame.display.set_mode((400,300))

d)

pygame.display.flip()

2.

How do I initialize the pygame?

a)

import pygame

b)

pygame.init()

c)

surface = pygame.display.set_mode((400,300))

d)

pygame.display.flip()

3.

How do I initialize the surface?

a)

import pygame

b)

pygame.init()

c)

surface = pygame.display.set_mode((400,300))

d)

pygame.display.flip()

4.

How do I update the screen?

a)

import pygame

b)

pygame.init()

c)

surface = pygame.display.set_mode((400,300))

d)

pygame.display.flip()

5.

What does display.flip() do?

a)

will update the contents of the entire display

b)

allows to update a portion of the screen, instead of the entire area of the screen

6.

What does display.update() do?

a)

will update the contents of the entire display

b)

allows to update a portion of the screen, instead of the entire area of the screen

7.

How can I check for an event if a user has pushed any event in the queue?

a)

run = False

for event in pygame.event.get():

if event.type == pygame.QUIT:

running = True

b)

run = True

for event in pygame.event.get():

if event.type == pygame.QUIT:

 running = False

c)

for event in pygame.event.pos():

8.

Draw a Rectangle

a)

surface = pygame.display.set_mode((400,300))

b)

pygame.draw.rect(surface, color, [30, 30, 60, 60])

c)

pygame.draw.line(surface, color, [20, 50], [180, 50], 3)

d)

pygame.draw.circle(surface, color, [300, 300], 200, 3)

9.

Draw a Circle

a)

pygame.draw.arc(surface, color, [50, 50, 200, 200], 0, pi, 2)

b)

pygame.draw.rect(surface, color, [30, 30, 60, 60])

c)

pygame.draw.circle(surface, color, [20, 50], [180, 50], 3)

d)

pygame.draw.circle(surface, color, [300, 300], 200, 3)

10.

Draw a Polygon

a)

pygame.draw.arc(surface, color, [50, 50, 200, 200], 0, pi, 2)

b)

pygame.draw.rect(surface, color, [30, 30, 60, 60])

c)

pygame.draw.polygon(surface, color, [[300, 100], [100,500], [500,500]], width = 3)

d)

pygame.draw.polygon(surface, color, [300, 300], 200, 3)

11.

What does the following code do?

screen.blit(surface1, (0,0))

a)

place the surface on the screen

b)

create a surface

c)

update the screen

d)

check whether the circle pos. reached at the end

12.

What does the following code do?

surface1 = pygame.Surface((300, 500))

a)

place the surface on the screen

b)

create a surface

c)

update the screen

d)

check whether the circle pos. reached at the end

13.

What does the following code do?

if x >= 500: x = 0

        x += 3

    surface.fill((255, 255, 255))

      circle = pygame.draw.circle(surface, (0, 0, 255), (x, y), 15)

    pygame.display.update()

a)

move the circle to right

b)

create a surface

c)

set initial position of the circle

d)

check whether the circle pos. reached at the end

14.

What does the following code do?

color = (random.randint(0,255), random.randint(0,255), random.randint(0,255))

a)

choose a random color

b)

fill the surface with random color

c)

change the background color according to the key pressed

15.

What does the following code do?

clock = pygame.time.Clock()

a)

set framerate

b)

check whether the circle pos. reached at the end

c)

create a clock to track the amount time

16.

Set image background

a)

bg1 = pygame.image.load("back1.jpg")

surface.blit(bg1, (0, 0))

b)

bg1 = pygame.image.load("back1.jpg")

surface = pygame.display.set_mode((800,500))

c)

bg1 = pygame.image.load("back1.jpg")

pygame.display.set_caption("Animation")

17.

Mouse events

a)

MOUSEBUTTONDOWN

b)

MOUSEBUTTONUP

c)

MOUSEMOTION

d)

MOUSEEVENT

18.

What is this function following the code?

event.button = 3

a)

pressing the left button

b)

pressing the right button

c)

scrolling forward

d)

scrolling back

19.

What is this function following the code?

event.button = 4

a)

pressing the left button

b)

pressing the right button

c)

scrolling forward

d)

scrolling back

20.

Allows you to get a tuple of two coordinates of the cursor location (x, y).

a)

event.pos

b)

event.button

c)

event.get

d)

event.type

21.

left, middle, right = pygame.mouse.get_pressed()

if left:

    print("Left Mouse Key is being pressed")

a)

The above code, as long as the mouse is being held down, it will keep printing

b)

Returns the coordinates of the mouse cursor on the screen

c)

The above code changes the type of cursor that appears on the screen

22.

Draw how ready you are to write a SAU.

23.

What is a class (in python)?

a)

A user-defined prototype for an object that defines a set of attributes that characterize any object of this. The attributes are data members and methods, accessed via dot notation.

b)

A special kind of function that is defined in a class definition.

c)

The assignment of more than one behavior to a particular function. The operation performed varies by the types of objects or arguments involved.

d)

the system of ordering a society in which people are divided into sets based on perceived social or economic status.

24.

What does function overloading mean (in python)?

a)

An individual object of a certain class. An object obj that belongs to a class Circle, for example, is an instance of the class Circle.

b)

A user-defined prototype for an object that defines a set of attributes that characterize any object of the class. The attributes are data members (class variables and instance variables) and methods, accessed via dot notation.

c)

the function overloads and kills the computer

d)

The assignment of more than one behavior to a particular function. The operation performed varies by the types of objects or arguments involved.

25.

What does inheritance mean in python?

a)

The transfer of the characteristics of a class to other classes that are derived from it.

b)

A variable that is defined inside a method and belongs only to the current instance of a class

c)

The creation of an instance of a class.

d)

It is what you sometimes get when a relative passes away

26.

What is an instance in python?

a)

A special kind of function that is defined in a class definition.

b)

The creation of an instance of a class.

c)

An individual object of a certain class. An object obj that belongs to a class Circle, for example, is an instance of the class Circle.

d)

A moment in time

27.

What is instantiation in python?

a)

The creation of an instance of a class.

b)

The transfer of the characteristics of a class to other classes that are derived from it.

c)

A variable that is defined inside a method and belongs only to the current instance of a class.

d)

A unique instance of a data structure that's defined by its class. An object comprises both data members (class variables and instance variables) and methods.

28.

What is a method in python?

a)

a way of doing something

b)

a special kind of function that is defined in a class definition

c)

the creation of an instance of a class

d)

orderliness of thought or behavior; systematic planning or action

29.

What is an object in python?

a)

A unique instance of a data structure that's defined by its class. An object comprises both data members (class variables and instance variables) and methods.

b)

A special kind of function that is defined in a class definition.

c)

The assignment of more than one function to a particular operator.

d)

An individual object of a certain class. An object obj that belongs to a class Circle, for example, is an instance of the class Circle.

30.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
31.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
32.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
33.
What will print?
a)
nothing
b)
7
c)
z
d)
12
34.

What term is used to describe data passed into a function?

a)

Variable

b)

Loop

c)

Constant

d)

Parameter

35.
How many times will Boo print?
a)
none
b)
4
c)
5
d)
1
36.
What is a data structure?
a)
A method of arranging data
b)
A way of keeping data without an order?
c)
A "stack" only
d)
There is no formal definition for "Data Structure"
37.
What kind of Data structure would you expect to find utilised to store operations in a CPU?
a)
Stack
b)
Queue
c)
List
d)
Tree
38.
 In computing, What is FILO?
a)
First In First Out
b)
First In Last out
c)
Last Out Lowest Order
d)
A very thin unleavened dough used for making pastries such as baklava and börek in Middle Eastern and Balkan cuisines.
39.
Which of these data structures is FIFO? 
a)
Stack
b)
Queue
c)
Binary Tree
d)
Double linked list
40.
A stack overflow is an undesirable condition in which a particular computer program tries to use more memory space than the called stack has available.
a)
True
b)
False
41.
What would 'leaving' a queue be called?
a)
"Dequeue"
b)
"Enqueue"
c)
"Leave queue"
d)
"Delete 'system 32' folder"
42.
In this tree, where would the new value "7" be placed?
a)
On the left "leaf" of "4"
b)
On the right "leaf" of "6"
c)
On the left "leaf" of "15"
d)
Over the top of the current number "5"
43.
What would a dynamic data structure entail?
a)
Memory is allocated to the data structure as the program executes.
b)
Memory is allocated to the data structure at compile time.
c)
The size of the structure is fixed
d)
The data structure can also double as TNT
44.
Which of these sorting methods uses "divide and conquer"?
a)
Bubble Sort
b)
Quick Sort
c)
Cocktail Sort
d)
Selection Sort
45.
A strength of Linear searches is that they can be performed without sorting the list before hand... 
a)
True
b)
False
46.
A Binary search requires the data it is searching to be ordered in some way...
a)
True
b)
False
47.
Which of these describes the operation of a bubble sort?
a)
The lowest valued un-ordered item will move quickest during a bubble sort
b)
The Highest valued un-ordered item will move quickest during a bubble sort 
c)
The list will be divided again and again, then re-build in to the correct order
d)
The list will be divided by a pivot, then ordered in smaller groups
48.
For a ordered list of 11 items, how many comparisons will a linear search need before it knows that a value in NOT in the list?
a)
12
b)
11
c)
6
d)
4
49.
For a ordered list of 11 items, how many comparisons will a Binary search need before it knows that a value in NOT in the list?
a)
12
b)
11
c)
6
d)
4
50.
For a linked list, what meta-data will need to be stored with each data entry?
a)
The Name of the list
b)
The address of the current data entry
c)
The address of the next data entry in the list
d)
The meaning of life
51.

How many parent nodes are there?

a)

4

b)

5

c)

6

d)

7

52.

How many leaf nodes are there?

a)

4

b)

5

c)

6

d)

7

53.

Which of the following is TRUE about this tree?

a)

This tree is a binary tree only

b)

This tree is a binary search tree

c)

This is a non-binary tree

54.

What traversal gives out the letters in alphabetical order?

a)

In-order traversal

b)

Pre-order traversal

c)

Post-order traversal

55.

What is the order of nodes traversed in a pre-order traversal of this tree?

a)

A, B, C, D, E, F, G, H, I, J

b)

E, B, A, C, D, G, F, I, H, J

c)

A, D, C, B, F, H, J, I, G, E

d)

B, A, C, D, G, F, I, H, J, E

56.

What is the order of nodes traversed in a post-order traversal of this tree?

a)

A, B, C, D, E, F, G, H, I, J

b)

E, B, A, C, D, G, F, I, H, J

c)

A, D, C, B, F, H, J, I, G, E

d)

B, A, C, D, G, F, I, H, J, E

57.

Traversing this tree, the arithmetic expression obtained is a×b + c÷d.

What type of traversal was performed?

a)

In-order

b)

Pre-order

c)

Post-order

58.

Traversing this tree, the arithmetic expression obtained is + ×ab ÷ cd. What type of traversal was performed?

a)

In-order

b)

Pre-order

c)

Post-order

59.

Which of the following statements is true?

a)

A graph is also a tree.

b)

A tree can have both directed and undirected edges.

c)

A tree can have a connection between two child nodes.

d)

A tree is a special case of a connected graph with only undirected edges and no cycles.

60.

Which of the following is TRUE about a binary search tree?


(Select All That Apply)

a)

Each parent node has a maximum of two child nodes.

b)

The value in a left child node is less than the value in the parent node.

c)

The value in the right child node is greater than the value in the parent node.

61.

Which of following data structure is more appropriate for

implementing quick sort iteratively?

a)

Deque

b)

Priority queue

c)

Stack

d)

Queue

62.

Which of the following data structure is linear type?

a)

Binary Tree

b)

Stack

c)

Graph

d)

Trees

63.

The complexity of Binary search algorithm is

a)

O(n)

b)

O(n log n)

c)

O(n2)

d)

O(log n)

64.

The complexity of Bubble sort algorithm is

a)

O(n2)

b)

O(n)

c)

O(log n)

d)

O(n log n)

65.

What will the output of the following code snippet?

void solve() {

int a[] = {1, 2, 3, 4, 5};

int sum = 0;

for(int i = 0; i < 5; i++) {

if(i % 2 == 0) {

sum += *(a + i);

}

else {

sum -= *(a + i);

}

}

cout << sum << endl;

}

a)

15

b)

syntax error

c)

3

d)

2

66.

What are the components of a node in a linked list?

a)

Only data

b)

Data and a pointer

c)

Only a pointer

d)

Data and an index

67.

What is a linked list?

a)

A static data structure using only arrays

b)

A type of function in computer programming

c)

A dynamic abstract data structure implemented as an array and pointers

d)

A basic variable type in programming

68.

What does the 'start' pointer in a linked list do?

a)

Points to the middle node of the list

b)

Identifies the first node in the list

c)

Shows the last node in the list

d)

Indicates the size of the list

69.

What happens to the memory location when an item is deleted from a dynamic list?

a)

It is duplicated

b)

It is freed up and returned to the heap

c)

It is permanently deleted

d)

It is archived for future use

70.

Which operation is not typically supported efficiently by linked lists?

a)

Adding an element at the beginning of the list.

b)

Accessing an element at a specific position.

c)

Removing an element from the end of the list.

d)

Traversing the elements in the list.

71.

Which list operation is used to remove and return the last item in the list?

a)

pop()

b)

remove(item)

c)

len()

d)

index(item)

72.

What is the purpose of the "count(item)" operation in a list?

a)

Add a new item at position pos

b)

Return the position of item

c)

Return the number of occurrences of item in list

d)

Test for empty list

73.

How does the "isEmpty()" function operate on a list?

a)

Removes an item from a specific position

b)

Tests if the list has no items

c)

Adds an item to the list

d)

Returns the total number of items in the list

74.

Is a function like 'isFull' necessary when implementing a queue using a list?

a)

Yes, to prevent adding more items than the list can handle.

b)

No, because the list can dynamically expand.

c)

Yes, but only in fixed-size data structures.

d)

No, 'isFull' is irrelevant in dynamic structures like lists.

75.

What does the function "isFull()" return?

a)

True if the queue is empty.

b)

False if the queue is not full.

c)

True if the queue has reached its maximum size.

d)

False if the queue has items.

76.

What does the function "isEmpty()" check in the context of the queue?

a)

If the queue has reached its maximum size.

b)

If the queue has no items.

c)

If the queue can accept more items.

d)

If the queue is being processed.

77.

What is the primary purpose of the insertion sort algorithm?

a)

To quickly sort large data sets

b)

To insert each item into its correct position in a data set one at a time

c)

To create a new list from an existing one

d)

To compare each item with all other items

78.

At what index does the outer for loop start in the insertion sort algorithm?

a)

1

b)

0

c)

2

d)

-1

79.

What happens if the items are out of order in the insertion sort?

a)

The items are moved up one space

b)

The items are swapped

c)

The algorithm stops

d)

The algorithm restarts

80.

What is stored in the 'current' variable in the insertion sort algorithm?

a)

The initial unsorted list

b)

The index of the next item

c)

The value of the item being sorted

d)

The final sorted list

81.

What condition must be met to enter the inner while loop in the insertion sort?

a)

There are no more items to sort

b)

The list is fully sorted

c)

Index is greater than zero and the previous item is greater than the current item

d)

The current item is the smallest

82.

What is the role of 'index 2' in the insertion sort algorithm?

a)

It holds the value of the current item

b)

It tracks the current position in the list

c)

It determines when to exit the inner while loop

d)

It stores the length of the list

83.

What type of data structure is initially used to store the items in the insertion sort example?

a)

Queue

b)

Stack

c)

Array

d)

Linked list

84.

What is a major inefficiency of the insertion sort when dealing with large data sets?

a)

The need for recursive calls

b)

Having to update pointers

c)

Requiring additional memory space

d)

Having to move all items to insert a single item

85.

What alternative data structure could potentially improve the efficiency of insertion sort?

a)

Array

b)

Linked list

c)

Binary tree

d)

Graph

86.

What does the final step of the outer for loop in the insertion sort do?

a)

It shuffles the items randomly

b)

It resets the loop counter

c)

It checks if the list is sorted

d)

It places the current item into its final location

87.

What is the primary function of a bubble sort algorithm?

a)

To reduce the size of a data set

b)

To merge two sorted lists into one

c)

To find the maximum value in a list

d)

To order an unordered list of items by comparing and swapping them if necessary

88.

Which of the following best describes the efficiency of the bubble sort algorithm?

a)

Least efficient sorting algorithm

b)

Efficient for data sets that are already partially sorted

c)

Efficient only for large data sets

d)

Most efficient sorting algorithm

89.

What condition must be met for the bubble sort's main while loop to continue executing?

a)

The list is empty

b)

All items are already sorted

c)

At least one swap has occurred

d)

No swaps are needed

90.

In bubble sort, what happens when two items are out of order?

a)

They are left as is

b)

They are immediately moved to the correct position

c)

They are swapped

d)

A new list is created

91.

What is the purpose of the 'swapped' boolean variable in the bubble sort algorithm?

a)

To track the number of iterations

b)

To count the number of swaps

c)

To indicate whether a swap has occurred

d)

To stop the algorithm

92.

How does the bubble sort algorithm determine when the sorting process is complete?

a)

When the list has been iterated through once

b)

When the list is in ascending order

c)

When no more swaps can be made

d)

When all elements are equal

93.

What is the initial setting of the 'swapped' variable at the start of the bubble sort algorithm?

a)

Undefined

b)

Null

c)

True

d)

False

94.

Which of the following is NOT a step in the bubble sort algorithm?

a)

Swapping items if they are out of order

b)

Repeating the process until no swaps are needed

c)

Comparing each item with the next one

d)

Selecting the smallest item and moving it to the start

95.

What does the bubble sort algorithm do each time through the while loop?

a)

Leaves 'n' unchanged

b)

Decreases the value of 'n' by one

c)

Increases the value of 'n' by one

d)

Resets 'n' to the length of the list

96.

Which of the following is a correct statement about the bubble sort algorithm?

a)

It is ideal for very large data sets due to its efficiency

b)

It is often used because it is easy to implement and understand

c)

It does not require any comparisons between list items

d)

It sorts items in random order to increase unpredictability

97.

What is meant by the term 'Computational Thinking'?

a)

Steps that can be taken to find the best solution to a complex problem

b)

Behaving like a robot

c)

Thinking in binary

d)

A logical way of getting from the problem to a solution

98.

What is meant by the term 'Abstraction'?

a)

Picking out important bits of information and ignoring the bits that don't matter

b)

Dealing with something as a concept rather than a physical entity

c)

Painting

d)

Breaking a complex problem down into smaller problems

99.

What is meant by the term 'Decomposition'?

a)

Picking out important bits of information and ignoring the bits that don't matter

b)

The process of an organism breaking down over time

c)

A logical way of getting from the problem to the solution

d)

Breaking a complex problem down into smaller problems

100.

What is meant by the term 'Algorithmic Thinking'?

a)

Picking out important bits of information and ignoring the bits that don't matter

b)

Thinking in hexadecimal

c)

A logical way of getting from the problem to the solution

d)

Instructions are used to solve a problem

101.

What is meant by the term 'Algorithm'?

a)

Breaking a complex problem down into smaller problems

b)

It is a type of programming language

c)

A logical way of getting from the problem to the solution

d)

A set of instructions used to solve a problem

102.

Select the 2 most important pieces of information a software developer should know when writing a console-based application for a company

a)

The purpose of the application

b)

How much time the developer gets for lunch

c)

What programming language/framework should be used

d)

Which graphics card the client devices will use

103.

What are the 3 key techniques for Computational Thinking?

a)

Decomposition

b)

Abstraction

c)

Algorithmic Thinking

d)

Programming

104.

Which of the following is an example of computational thinking?

a)

Writing in binary

b)

Programming

c)

Compiling a list of instructions to solve a complex task

d)

Creating new hardware