wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming Fundamentals Part 2

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of these is the string returned by this code?

phrase = "Character"

phrase.subString(0,4)

a)

"hara"

b)

"cter"

c)

"Cha"

d)

"Char"

2.

What would be the result of the following query on the this database table?

SELECT Name FROM Students WHERE House = "King" AND Year = "9"

a)

["Ted","King",9,"D"]

b)

"Ted"

c)

"Poppy"

d)

"Sam"

3.

What would be the result of this SQL query on the database table shown?

SELECT * FROM Students WHERE Grade = "C" AND House= "Curie"

a)

"Cher"

b)

["Poppy","King",8,"C"]

c)

"Sam"

d)

["Sam","Curie",7,"C"]

4.

Which data structure would be suitable for storing a single list of values such as the wind speeds measured over a week?

a)

Table

b)

2-dimensional array

c)

1-dimensional array

d)

Record

5.

Which SQL command is used to view or query a database?

a)

CHOOSE

b)

FIND

c)

SELECT

6.

To add data to an open file from variables or data structures in memory is what file operation?

a)

Close

b)

Write

c)

Open

d)

Read

7.

What file operation would this command initiate?

myFile = open("sample.txt")

a)

Open

b)

Read

c)

Close

d)

Write

e)

Append

8.

What name do we give to code that is used to query a database, it stands for Structured Query Language and includes SELECT, FROM, WHERE?

a)

SQL

b)

LQS

c)

QLS

d)

QSL

9.

Python does not provide an array data structure, but what can we use instead?

a)

List

b)

Function

c)

File

d)

Record

10.

What is the name for a collection of related data items called fields, often stored as a row in a database, it represents something in the real world like a person or product?

a)

Array

b)

Record

c)

Field

d)

Database

11.

This code iterates over a 1-dimensional array called arr. What would be the output of this code?

total = 0

arr = [3,4,1]

for col = 0 to 2

total = total + arr[col]

next col

print(total)

a)

7

b)

9

c)

3

d)

2

e)

8

12.

What file operation does this code initiate?

myFile.writeLine("Add new line")

a)

Write

b)

Read

c)

Close

d)

Open

13.

The file operation that loads data from an open file into a variable or data structure in memory, is called what?

a)

Close

b)

Write

c)

Open

d)

Read

14.

Which of these shows the Exam Reference Language (ERL) code to return the contents of row 0 column 0 of a 2D array called gameboard?

a)

gameboard(row,col) where row=0, col=0

b)

return(gameboard, 0, 0)

c)

gameboard(row=0, col=0)

d)

gameboard[0, 0]

15.

What do we call a data structure that stores many data items of the same data type, can be 1D, 2D or more?

a)

Linked List

b)

Array

c)

Record

d)

Database

16.

Joining two strings together, usually uses the + operator, for example fullname = firstname + lastname, is called what?

a)

Attaching

b)

Merging

c)

Concatenating

d)

Adjoining

17.

What is the name for a collection of related data saved on secondary storage, it can be plain text, CSV or a database?

a)

Float

b)

File

c)

Field

d)

Folder

18.

What file operation connects to a file and prepares it for read or write?

a)

Write

b)

Open

c)

Close

d)

Append

19.

What is one data item in a record, often shown as a column in a database, for example "Name" or "Age", having a single data type?

a)

Field

b)

Database

c)

Record

d)

Table

20.

Which of these is a function in Exam Reference Language (ERL) that returns part of a string when we pass it a starting position and length?

a)

Stringslice

b)

Stringpart

c)

Substring

d)

Slice