Paper Time [90 minutes]
CS636 – Formal Methods
CS636 (Final Exam Sample Paper)
MCQs
Take an assessment.
1- What is the primary purpose of formal methods in software engineering?
a. Code optimization
b. Enhancing user experience
c. Rigorous reasoning and verification
d. Prototyping
2- Formal methods are used for:
a. Informal reasoning
b. Rigorous reasoning
c. Trial and error
d. Random testing
3- Which of the following is a key benefit of using formal methods?
a. Faster development speed
b. Improved code aesthetics
c. Increased likelihood of error detection
d. Reduced need for documentation
4- Verification in software engineering is concerned with:
a. Code execution speed
b. Confirming that a system meets its specifications
c. User interface design
d. Network security
5- Which mathematical model is commonly used for specifying software requirements?
a. UML
b. DFD
c. Finite State Machines
d. Petri Nets
6- The primary goal of software specification is to:
a. Enhance code readability
b. Describe how the software will be implemented
c. Provide a clear and unambiguous description of the system's behavior
d. Increase development speed
7- What characterizes a concurrent system?
a. A system that runs on a single processor
b. A system with multiple independent processes
c. A system without any processes
d. A system with real-time capabilities
8- Well-formedness in concurrent systems refers to:
a. The absence of errors
b. The efficient use of resources
c. Compliance with defined rules or syntax
d. Rapid execution speed
9- In the context of concurrent systems, what does deadlock refer to?
a. Efficient resource utilization
b. A state where processes are unable to proceed
c. Smooth system execution
d. Dynamic process allocation
10- Propositional logic deals with:
a. Objects and relationships between them
b. Statements that are either true or false
c. Mathematical operations
d. Natural language semantics
11- What is a proposition in logic?
a. A statement that can be proven
b. A statement that is always false
c. A statement that is either true or false
d. A statement that is difficult to understand
12- Predicate logic extends propositional logic by introducing:
a. Variables and quantifiers
b. Conditional statements
c. Logical operators
d. Propositions
13- VDM-SL stands for:
a. Visual Design Model - Specification Language
b. Virtual Development Method - Specification Logic
c. Vienna Development Method - Specification Language
d. Verification and Design Model - System Language
14- VDM-SL is primarily used for:
a. Database management
b. Software specification and verification
c. Real-time operating systems
d. Web development
15- In VDM-SL, what does the specification define?
a. The appearance of the user interface
b. The internal workings of algorithms
c. The system's requirements and behavior
d. The system's deployment architecture
16- In set theory, the union of two sets A and B contains:
a. Elements common to both sets
b. Elements only in set A
c. Elements only in set B
d. All elements from both sets
17- What does the cardinality of a set represent?
a. The number of elements in the set
b. The order of elements in the set
c. The sum of elements in the set
d. The product of elements in the set
18- The intersection of two sets A and B contains:
a. Elements common to both sets
b. Elements only in set A
c. Elements only in set B
d. All elements from both sets
19- A sequence is an ordered list of:
a. Random elements
b. Unique elements
c. Indexed elements
d. Unordered elements
20- The length of a sequence is also known as:
a. Width
b. Depth
c. Cardinality
d. Order
21- In the context of sequences, what does indexing refer to?
a. Reordering the elements
b. Assigning a unique position to each element
c. Combining two sequences
d. Grouping elements based on a common attribute
22- What defines composite objects in formal methods?
a. Objects with complex data structures
b. Objects with simple data structures
c. Objects with high-level abstraction
d. Objects with low-level abstraction
23- Composition in composite objects involves:
a. Combining multiple objects to create a new one
b. Splitting an object into multiple parts
c. Changing the properties of an object
d. Deleting elements from an object
24- In formal methods, what is the purpose of abstraction in composite objects?
a. Simplifying complex objects for better understanding
b. Introducing unnecessary details for clarity
c. Increasing the size of composite objects
d. Reducing the efficiency of operations on objects
25- In formal methods, a map is a relation between:
a. Two sets
b. Three sets
c. Multiple sets
d. No sets
26- What is a bijective map?
a. Every element in the domain is paired with exactly one element in the codomain
b. Some elements in the domain have multiple pairs in the codomain
c. Multiple elements in the domain are paired with one element in the codomain
d. No elements are paired between the domain and the codomain
27- In the context of maps, what does the codomain represent?
a. The set of all possible inputs
b. The set of all possible outputs
c. The relationship between inputs and outputs
d. The intersection of input and output sets
28- Z in formal methods is used for:
a. Set theory
b. Specification and verification
c. Concurrent programming
d. Database management
29- In Z notation, what does the schema represent?
a. A set of operations
b. A set of axioms
c. A set of assertions
d. A set of variables and their relationships
30- In Z notation, what is an invariant?
a. A statement that must always be true during the execution of a system
b. A statement that is true only in specific cases
c. A statement that is false during the execution of a system
d. A statement that is not relevant to the system's behavior
31- Well-formedness in formal methods ensures:
a. Efficient program execution
b. Compliance with defined rules or syntax
c. High-level abstraction
d. Low-level abstraction
32- What is the significance of well-formed methods in software development?
a. Improved debugging
b. Enhanced program performance
c. Increased code readability
d. Reduced software maintenance costs
33- Which of the following is a common consequence of violating well-formedness rules?
a. Improved system reliability
b. Code optimization
c. Run-time errors
d. Increased development speed
34- What is the primary advantage of formal methods over informal methods in software engineering?
a. Faster development speed
b. Improved communication among team members
c. Rigorous reasoning for correctness
d. Better aesthetics of the code
35- In the context of formal methods, what is the purpose of model checking?
a. Optimizing code for performance
b. Verifying that a model satisfies specified properties
c. Conducting user acceptance testing
d. Improving software documentation
36- How does a race condition occur in concurrent systems?
a. When multiple processes are synchronized perfectly
b. When multiple processes compete for shared resources
c. When processes are independent of each other
d. When processes run sequentially
37- In set theory, what does the power set of a set A represent?
a. The set of all elements in A
b. The set of all subsets of A, including the empty set
c. The set of all prime numbers in A
d. The set of all even numbers in A
38- What distinguishes a sequence from a set in formal methods?
a. Sequences have an order, while sets do not.
b. Sequences cannot have duplicate elements.
c. Sequences are always finite.
d. Sets can only contain numerical elements.
39- In composite objects, what does encapsulation refer to?
a. Combining multiple objects to form a new one
b. Restricting access to the internal details of an object
c. Breaking an object into its constituent parts
d. Modifying the properties of an object dynamically
40- What is the purpose of a schema in Z notation?
a. Defining a set of variables and their relationships
b. Describing the internal implementation details of a system
c. Enumerating all possible outcomes of a system
d. Specifying the user interface of a software application
Subjective Questions (3 Marks)
1- Describe the key objectives of introducing formal methods in software engineering and how they differ
from informal methods.
2- Explain the role of mathematical models in software specification and verification, emphasizing their
significance in ensuring correctness and reliability.
3- Discuss the concept of well-formedness in the context of concurrent systems. How does adhering to
well-formedness principles contribute to the effective design of concurrent software?
4- Elaborate on the differences between propositional and predicate logic, providing examples of
scenarios where each is particularly useful in software specification.
5- Detail the key features and purposes of VDM-SL (Vienna Development Method - Specification
Language) in the context of software development. How does VDM-SL facilitate effective specification?
6- Define sets in the context of formal methods and provide examples of how sets are employed in
software specification and design. How does the concept of sets contribute to clear and concise problem
representation?
Subjective Questions (5 Marks)
1- Explain the process of using mathematical models for software specification and verification. Discuss
the advantages and challenges associated with this approach, providing examples of real-world
applications where mathematical models have proven beneficial.
2- In the context of concurrent systems, elaborate on the concept of well-formedness. Discuss how the
principles of well-formedness contribute to the design and implementation of concurrent software
systems. Provide examples and explore potential pitfalls in neglecting well-formedness.
3- Compare and contrast the concepts of sets and sequences in formal methods. Illustrate how these
mathematical structures are employed in software specification. Provide examples to demonstrate how
sets and sequences contribute to the clarity and precision of specifications.
4- Explore the role of maps and Z notation in formal methods. Discuss how maps are used to establish
relationships between sets and how Z notation facilitates specification and verification. Provide a detailed
explanation of how Z notation enhances the expressiveness and precision of formal specifications,
highlighting its application in real-world scenarios.