wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Book Borrow quiz

Total questions: 15

Worksheet time: 3600secs

Name
Class
Date
1.

Manal is trying to find a book in the library by its title. She wrote a function to search for the book, but she suspects there are some errors in her code. Provide the line number and the number of missing or wrong code as follows (without blanks and in line order):

(1,2),(4,1): line 1 contains two errors and line 4 contains one error.

(a)  

2.

Assume that Book is a pointer to struct. You are trying to insert a new book into the library system. Complete the missing code.

a)

  1. (*L).Tail
    (*L).Tail = new_book; previous_book
    ass_adr_book(previous_book(temp),new_book);

b)

  1. L.Tail
    L.Tail = new_book; next_book
    ass_adr_book(previous_book(temp),new_book);

c)

  1. (*L).Tail
    (*L).Tail = new_book; next_book
    ass_adr_book(previous_book(temp),new_book);

d)

  1. L->Tail
    L->Tail = new_book; previous_book
    ass_adr_book(previous_book(temp),new_book);

3.

Amina writes a function to enqueue a loan. She struggles doing this, can you complete her code? (Loan is a pointer to a structure). Write the answers separated by commas without blanks.

(a)  

4.

What is missing in the previous function?

a)

Nothing

b)

The case where the queue is full

c)

The case where the queue is empty

q.Head = adr;

q.Tail = adr;

d)

The case where the queue is empty

(*q).Head = adr;

(*q).Tail = adr;

5.

Copy paste the following steps and reorder them :
create_loan,search_book,search_borrower,assign_loan,enqueue_request,dequeue_request

(a)  

6.

How to check if a loan is active according to a provided date?

a)

The book has not been returned

b)

The loan is not attributed

c)

The borrow window includes the provided date

d)

The loan is successful just after the request

7.

Download the full dataset available on classroom (📢 Quiz Announcement – Preparation Required). Choose the one that suits your implementation (borrow priority or borrower priority).

How many books are inserted in book_list?

(a)  

8.

Download the full dataset available on classroom (📢 Quiz Announcement – Preparation Required).

Assume that after 10 requests (Set MAX_TIMER to 10), one assigned loan follows.

Which book ID, Title is borrowed first?

(a)  

9.

Download the full dataset available on classroom (📢 Quiz Announcement – Preparation Required)

Execute until the end.

How many active loans are there on "2025-02-26"?

(a)  

10.

The third successfully returned book. Give the ID.

(a)  

11.

For the same dataset, set MAX_LOAN_DURATION o 15 days. How many books are overdue?

(a)  

12.

What is the total number of books borrowed on February and not returned?

(a)  

13.

How many books are no longer available?

(a)  

14.

Provide the longest overdue time in number of days.

(a)  

15.

Provide the third borrowed book ID borrower ID and book title using the following format: book_id,borrower_id,title

(a)