0% found this document useful (0 votes)
10 views

Tutorial Questions

Tutorial Questions

Uploaded by

Owoeye Adenike
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Tutorial Questions

Tutorial Questions

Uploaded by

Owoeye Adenike
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

UNIVERSITY OF ILORIN, ILORIN,

FACULTY OF COMMUNICATION AND INFORMATION SCIENCES,


DEPARTMENT OF COMPUTER SCIENCE
PROGRAMME: B.Sc. (Hons) COMPUTER SCIENCE
Course :
CSC 423; Course title: Formal Methods and Software Development
Credit unit: 2; Course status: C
Lecturer’s Data:
Name of Lecturer: Dr. D. R. Aremu
Qualifications Obtained: B. Sc. Maths., M. Sc. (Maths, Computer Science
Option), Ph. D. (Computer Science)
Department: Computer Science.
E-mail: [email protected] or [email protected]
Office Location: Office No. 31
Consultation Hours: Thursday, 10.00am. – 2.00pm
Course content
Simultaneous development and verification of correct programs; program state; state predicate
and program specification; Establish program correctness; axioms/deduction rules for proofs of
program. Semantics; Actual examples of program development.

TUTORIAL QUESTIONS
SECTION A:
1. What is the primary purpose of formal methods in software development?
a. Enhancing code readability b. Accelerating software delivery c. Improving software aesthetics
d. Ensuring correctness and reliability
2. Which of the following is a key advantage of using formal methods?
a. Faster development without testing b. Improved software aesthetics c. Reduced need for
documentation d. Rigorous verification of correctness
3. What is a formal specification in software development?
a. A detailed user manual b. A set of code comments c. A precise and unambiguous description of
software behavior d. An informal description of software requirements
4. In formal methods, what does the term “model checking” involve?
a. Checking code readability b. Verifying correctness against a formal specification c. Inspecting
the software aesthetics d. Evaluating software performance
5. Which formal method involves using mathematical logic to express properties of a system?
a. Model Checking b. Finite State Machines (FSM) c. Hoare Logic d. Z notation
6. What does the term “formal verification” mean in the context of software development?
a. Manual code review by developers b. Automatic testing of software c. Rigorous mathematical
proof of correctness d. Optimizing code for performance
7. Which of the following is a limitation of formal methods in software development?
a. Difficulty in learning and using formal notations b. Lack of attention to software aesthetics c.
Emphasis on rapid development without testing d. Inability to handle concurrent systems
8. In a Hoare Triple {𝑷}𝑪{𝑸}, 𝒘𝒉𝒂𝒕 𝒅𝒐𝒆𝒔 𝑷 𝒓𝒆𝒑𝒓𝒆𝒔𝒆𝒏𝒕?
a. Postcondition b. Precondition c. Command d. Consequence
9. What is the purpose of the Hoare Triple notation?
a. To represent the syntax of programming languages b. To define algorithms c. To specify
correctness conditions for programs d. To describe runtime behavior
10. In the Hoare Triple {𝑷}𝑪{𝑸}, 𝒘𝒉𝒂𝒕 𝒅𝒐𝒆𝒔 𝑸 𝒓𝒆𝒑𝒓𝒆𝒔𝒆𝒏𝒕?
a. Precondition b. Postcondition c. Command d. Consequence
11. Which statement is correct regarding the meaning of {𝑷}𝑪{𝑸}?
a. If P is true, then executing C will make Q true. b. If Q is true, then executing C will make P
true. c. P and Q are both true before and after executing C. d. The triple is invalid and cannot be
satisfied.
12. What does the command C in {𝑷}𝑪{𝑸} typically represent?
a. The precondition b. The postcondition c. The consequence d. The program or code segment
13. What is Z in the context of formal specification?
a. A programming language b. A specification language c. A testing framework d. A project
management tool
14. Question: If A = {1, 2, 3} and B = {2, 3, 4}, what is A ∩ B?
a. {1, 2, 3, 4} ; b. {2, 3}; c. {1, 4}; d. {}.
15. What does the union of sets A and B represent?
a. All elements that are common to both sets A and B; b. All elements that are not in either set A
or set B; c. All elements that are in either set A or set B or in both; d. The intersection of sets A
and B
16. What is the cardinality of the power set of a set with n elements?
a. n; b. 2 n; c. n!; d. 2n.
17. What is the primary role of a formal specification language in software development?
a. To define the syntax of programming languages; b. To specify user interface design; c. To
describe software requirements precisely; d. To optimize code performance
18. What is the primary role of a formal specification language in software development?
a. To define the syntax of programming languages b. To specify user interface design c. To
describe software requirements precisely d. To optimize code performance
19. What is the goal of formal methods in the software development life cycle?
a. To eliminate the need for software documentation; b. To prioritize software aesthetics over
correctness; c. To ensure the fastest possible software delivery; d. To increase the reliability and
correctness of software.
20. Which of the following is a benefit of using formal specifications?
a. Reducing software development costs; b. Eliminating the need for testing; c. Ensuring quick
software delivery; d. Enhancing software aesthetics.
21. Which formal method is commonly used for specifying and verifying concurrent systems?
a. Finite State Machines (FSM); b. Z notation; c. Communicating Sequential Processes (CSP); d.
Unified Modeling Language (UML).
22. In Hoare logic, what does the assignment axiom specify?
a. How to define preconditions; b. How to define postconditions; c. How to reason about
assignment statements; d. How to execute loops.
23. What is the role of the consequence rule in Hoare logic?
a. It defines the meaning of assignments; b. It specifies how to reason about loops; c. It allows
strengthening the precondition and weakening the postcondition; d. It is used to define the syntax
of programming languages.
24. Which of the following statements is true regarding partial correctness?
a. It guarantees both termination and correctness of a program; b. It guarantees correctness but
not termination of a program; c. It guarantees termination but not correctness of a program; d. It
is only concerned with the syntax of a program.
25. In the Hoare Triple {𝑷}𝑪{𝑸}, what is the role of the command C?
a. To specify the precondition; b. To specify the postcondition; c. To represent the consequence;
d. To represent the program or code.
26. What is the primary goal of using Hoare logic in program verification?
• a. To prove the termination of programs • b. To prove the correctness of programs • c. To
optimize the runtime performance of programs • d. To define the syntax of programming
languages.
27. What is the primary purpose of formal specification in software development?
a. Enhancing user interface design • b. Improving code readability • c. Describing software
requirements precisely • d. Managing software project timelines
28. Which of the following is a characteristic of a good formal specification?
• a. Ambiguity • b. Subjectivity • c. Precision • d. Redundancy
29. Question: What does a state-based formal specification primarily focus on? • a. Sequences of
actions • b. Data transformations • c. System states and transitions • d. User interface design
30. In formal methods, what is refinement?
• a. The process of making specifications less detailed • b. The process of making specifications
more abstract • c. The process of developing more detailed specifications from abstract ones • d.
The process of omitting certain requirements
31. Which of the following is an example of a formal specification language used for concurrent
systems? • a. Java • b. Python • c. CSP (Communicating Sequential Processes) • d. HTML
32. What is the purpose of a pre-condition in a formal specification? • a. Describing the expected
post-conditions • b. Describing the system's initial state assumptions • c. Defining the order of
operations • d. Identifying user interface requirements
33. Which of the following is a limitation of formal specification languages? • a. Lack of
precision • b. Inability to represent complex systems • c. Difficulty in learning and using • d.
Incompatibility with modern programming languages.
34. What is a post-condition in the context of formal specification?
• a. Describing the system's initial state assumptions • b. Describing the expected outcomes after
an operation • c. Defining the order of operations • d. Identifying user interface requirements
35. In set theory, what is the universal set? • a. The set of all elements in the universe • b. The
empty set • c. The set with only one element • d. The set containing integers only
36. What does the complement of a set A represent?
• a. All elements that are not in set A • b. All elements in set A • c. The intersection of sets A and
B • d. The union of sets A and B •
37. If |𝐴| = 3 𝑎𝑛𝑑 |𝐵| = 4, 𝑤ℎ𝑎𝑡 𝑖𝑠 𝑡ℎ𝑒 𝑝𝑜𝑠𝑠𝑖𝑏𝑙𝑒 𝑐𝑎𝑟𝑑𝑖𝑛𝑎𝑙𝑖𝑡𝑦 𝑜𝑓 𝐴 ∪ 𝐵?
• a. 3 • b. 4 • c. 7 • d. 12 •
38. If 𝑨 ⊆ 𝑩, what does this notation indicate? • a. A is a proper subset of B • b. A is not a
subset of B • c. A is a superset of B • d. A is a subset or equal to B

39. What is the intersection of the sets A, B, and C represented as 𝑨 ∩ 𝑩 ∩ 𝑪?


• a. Elements common to A, B, and C • b. Elements that are in A or B or C • c. Empty set • d. All
elements in A, B, and C
40. In set theory, what is the difference between a set and a tuple?
• a. Sets are ordered, tuples are unordered • b. Sets can have repeated elements, tuples cannot • c.
Tuples can have repeated elements, sets cannot • d. There is no difference; the terms are
interchangeable
41. What is the Cartesian product of sets A and B represented as 𝑨 × 𝑩
• a. The union of sets A and B • b. The set of all possible ordered pairs (a, b) where a is in A and
b is in B • c. The intersection of sets A and B • d. The complement of set A with respect to set B

SECTION B:
Question One
a. Define what a Hoare Triple is in the context of formal verification. [3 Marks]
b. Explain the components of a Hoare Triple (precondition, program, postcondition).
[7 Marks]
c. Discuss the significance of the Hoare Triple in the context of program correctness and
verification, and prove that the program segment:
t = x;
x = y; y = t;
Is correct with respect to precondition:
x = 7, y = 5 and
postcondition:
x = 5, y = 7 [10 Marks]

Question Two
a. Explain the concept of formal methods in software development and discuss their
significance in ensuring software correctness and reliability. [3 Marks]
b. Compare and contrast formal methods with traditional software development
approaches in terms of their benefits and limitations. [7 Marks]
c. What are the main stages of the formal methods lifecycle? Discuss each stage and its
purpose in the software development process. [9 Marks]

Question Three
a. Describe the role of formal specifications in software development and discuss how
they help in ensuring software correctness. [3 Marks]
b. Explain the process of formal verification and how it is used to verify the correctness
of software systems. [7 Marks]
c. Discuss the strengths and weaknesses of formal methods in terms of their scalability
and applicability to large-scale software projects. [10 Marks]

Question Four
a. Explain the concept of model checking and how it can be used to verify properties of
software systems. [7 Marks]
b. Describe the role of formal proof techniques, such as theorem proving, in software
development and discuss their advantages and limitations. [3 Marks]
c. Discuss the challenges and limitations of using formal methods in software
development, including the complexity of formal notations and the need for formal
training. [10 Marks]

Question Five

a. Define the Z specification language. [3 Marks]


b. What are the primary objectives of using Z in software specification? [7 Marks]
c. Explain the role of Z schemas in the Z specification language. Provide an example of a
simple schema. [10 Marks]

You might also like