1/9
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Describe the purpose of a user-defined data type.
To create a new data type (from existing data types)
To allow data types not available in a programming language to be constructed // To extend the flexibility of the programming language
Explain how an interpreter executes a program without producing a complete translated version.
An interpreter examines source code one statement at a time
Check each statement for errors
If no error is found the statement is executed
If an error is found this is reported and the interpreter halts
Explain why Reverse Polish Notation (RPN) is used to evaluate expressions.
Reverse Polish Notation provides an unambiguous method of representing an expression
Reading from left to right
Without the need to use brackets
With no need for rules of precedence / BODMAS
Identify a data structure used to evaluate an expression in RPN, with a reason.
A:
Structure: stack
Reason: The operands are popped from the stack in the reverse order to how they were pushed
Explain the use of graphs to aid Artificial Intelligence (AI).
Artificial Neural Networks can be represented using graphs
Graphs provide structures for relationships
AI problems can be defined as finding a path in a graph
Used in machine learning
Give two benefits and two drawbacks of packet switching.
Benefits:
Accuracy – Ensures accurate delivery of the message
Completeness – Missing packets can be easily detected and a re-send request sent so the message arrives complete
Resilience – if a network changes the router can detect this and send the data another way to ensure it arrives
Drawbacks:
Time delays to correct errors // Network problems may introduce errors in packets
Requires complex protocols for delivery
Unsuitable for real time transmission applications
State two factors that may affect the performance of a sorting algorithm.
The initial order of the data
The number of data items to be sorted
The efficiency of the sorting algorithm
Describe what is meant by an imperative (procedural) programming language
Imperative languages use variables
Which are changed using (assignment) statements
They rely on a method of repetition
Describe what is meant by a declarative programming language.
Instructs a program on what needs to be done instead of how to do it
Using facts and rules
Using queries to satisfy goals
Can be logical or functional
Identify the programming paradigms for each of the following program code examples.
male(john).
→
FOR Counter = 1 TO 20
→
LDD Counter …
→
public class Vehicle …
→
male(john).
→ Declarative
FOR Counter = 1 TO 20
→ Procedural / imperative
LDD Counter …
→ Low-level / assembly
public class Vehicle …
→ Object oriented / (OOP)