You are on page 1of 2

C OMSATS University Islamabad, Lahore Campus

■ Sessional-1 □ Sessional-II □ Terminal Examination – Spring 2021


Course Title: Formal Methods Course Code: CSE 356 Credit Hours: 3(3,0)
Course Instructor/s: Dr. Farooq Ahmad Programme Name: BS Software Engineering
Semester: 6th Batch: FA19-BSE Section: A, B Date:
Time Allowed: 60 Minutes Maximum Marks: 20
Student’s Name Reg. No.

Question 1:
[Marks: 2+2=4]
In a class management system, [Student] is type for the students. Further, size : N represents the size of a class.
The sets, registered, passed : ℙ Student are declared as variables. Write predicates to formalize the following
statements.
i. The number of registered students must not exceeds the size of the class.
ii. Only the registered students can be passed.

Question 2: [Marks: 1*6=6]


Given the declarations:
m,n, s: ℤ
a: Author
current: ℙ Accouts
novelists: ℙ Author
Say what the type is of each of the following terms:
(a) m+n
(b) {s, n}
(c) {{n},{s}}
(d) {current}
(e) novelists ∪ {a}
(f) {{a}} ∪ {novelists}

Question 3: [Marks: 2*5=10]

In the library management system, [Book] is type for the books owned by the library. The sets on_loan,
on_shelves, books, novels, reference: ℙ Book are declared as variables. Write predicates to formalize the
following statements using the set variables: on_loan, on_shelves, books, novels, reference.

a) The number of books which are on loan can’t exceed the number of books on shelves.
b) Every book in the library is either on loan or on the shelves.

1
c) No book can be on loan and on the shelves.
d) The number of reference books can’t exceed integer value Limit.
e) No novel can be a reference book.

You might also like