Assignment Scenario: Ct111-2-3 Computing Theory
Assignment Scenario: Ct111-2-3 Computing Theory
ASSIGNMENT SCENARIO
ITERATIVE
1. Do while
2. While
3. For
RECURSIVE
1. Method that calls itself
Choose a programming language that supports at least one of the above, and specify the chosen
programming language and the chosen construct.
JAVA
Iterative construct
The tasks in the Parts A and B of this assignment relate to this given assignment scenario.
Answer the given tasks accordingly.
Learning Outcomes
Assessment Criteria
IMPORTANT: This is a group assignment. All submitted components must be the work of the
group or appropriately accredited. All members of the group MUST contribute
and gain the necessary competence in all parts of the assignment.
Referencing: If you use ideas from external sources, e.g. books / magazines / internet /
forums, then proper citation should be done using the APA Name convention
within your solution. Failure to reference design / ideas properly is considered
as plagiarism.
CT111-2-3-COMT
COMPUTING THEORY
WEIGHTAGE: 30%
INSTRUCTIONS TO CANDIDATES:
1 Submit your assignment online via the submission folder provided on Webspace.
2 Students are advised to underpin their answers with the use of references (cited using
the Harvard Name System of Referencing).
3 Late submission will be awarded zero (0) unless Extenuating Circumstances (EC) are
upheld.
6 Where the assignment should be submitted in both hardcopy and softcopy, the softcopy
of the written assignment and source code (where appropriate) should be on a CD in an
envelope / CD cover and attached to the hardcopy.
PART A: Automata
i) Design a Non-deterministic Finite Automata (NFA) for the syntax of the chosen construct.
Note that the NFA must cover the generic syntax of the construct, and not be limited to just
a specific sample code. The syntax covers all valid code for the construct, hence the NFA
must accept all valid code, whilst rejecting all invalid code.
For loop
Generic syntax:
for(initialization; condition; increment/decrement){
//statement or code to be executed
}
Sample code:
//Java Program to demonstrate the example of for loop
//which prints table of 1
public class ForExample {
public static void main(String[] args) {
//Code of Java for loop
for(int i=1;i<=10;i++){
System.out.println(i);
}
}
}
[10 Marks]
ii) Provide the corresponding quintuple and state transition table for the NFA. Reminder:
the state transition table columns represent non-overlapping components of the language
alphabet (i.e. any shortcuts/notations used to group components of the alphabet must be
done very carefully).
[10 Marks]
iii) Generate the related Regular Expression from the NFA, showing all the steps in the
conversion process.
[10 Marks]
Deliverables (Part – A)
CT111-2-3-COMT
COMPUTING THEORY
WEIGHTAGE: 20%
INSTRUCTIONS TO CANDIDATES:
1 Submit your assignment online via the submission folder provided in Webspace
2 Students are advised to underpin their answers with the use of references (cited using
the Harvard Name System of Referencing)
3 Late submission will be awarded zero (0) unless Extenuating Circumstances (EC) are
upheld
4 Cases of plagiarism will be penalized
5 The assignment should be bound in an appropriate style (comb bound or stapled).
6 Where the assignment should be submitted in both hardcopy and softcopy, the softcopy
of the written assignment and source code (where appropriate) should be on a CD in an
envelope / CD cover and attached to the hardcopy.
Computing Theory Assignment Page 6 of 6
PART B: Complexity
i) Specify a short snippet of a program code that employs the construct from Part A,
indicating the Best Case and Worst Case complexities of the code snippet. For each case,
specify the situation that gives rise to the best or worst case, the number of operations
required and the corresponding Big-O notation.
[10 Marks]
ii) Discuss the Computability of the snippet in (i), providing sufficient justification for your
explanation. Computability of the program code snippet must be discussed in terms of the
3 characteristics of computability, as discussed in the lectures. Based on those, provide the
overall conclusion to the computability of the snippet.
[10 Marks]
Deliverables
1. Cover page (include the names and TP numbers of the group members)
2. Results (Part B)
3. References