Page 512 - ComputerScience_Class_11
P. 512

F.  Case study-based questions.
                     A school library decided to maintain records of books issued to students using a simple computer program. The librarian enters
                    the student's name, the book title and the date of issue into the system. The computer then stores the information and displays
                    a confirmation message that the book has been issued successfully. In this situation, the instructions of the program are executed
                    one after another in a fixed order. First, the librarian enters the required details, then the system records the information and
                    finally it shows the confirmation message. This process follows sequential flow of control, where each instruction is executed
                    step-by-step in the same sequence in which it is written. There are no decisions or repetitions involved; the program simply
                    performs each task in order. Sequential flow is commonly used in programs where tasks need to be completed in a straightforward
                    manner.
                     Based on the given case, answer the following questions:
                  1.  What is displayed at the end of the process?
                Ans.  Confirmation message that the book has been issued successfully is displayed.
                  1.  What would happen if one step in the sequence is skipped?
                Ans.  The process may not work correctly because each step depends on the previous one.
              G.  Identify the errors in the given codes and rewrite the correct code:
                  1.  age = 18

                    if age >= 18:
                    print("Eligible to vote")
                    else
                    print("Not eligible to vote")
                Ans.  age = 18
                    if age >= 18:
                        print("Eligible to vote")
                    else:
                        print("Not eligible to vote")
                  2.  for i in range(1, 6):
                        if i == 2:
                            continue
                        print(I)
                Ans.  for i in range(1, 6):
                        if i == 2:
                            continue
                    print(i)
                  3.  num == 10

                    if num > 5:
                        PASS
                    print("Program continues")
                Ans.  num = 10
                    if num > 5:
                        pass
                    print("Program continues")


                   Unsolved Questions


              A.  Tick ( ) the correct option.
                  1.  Which statement checks multiple conditions after an if statement?
                    a.  else                                        b.  elif
                    c.  for                                         d.  break



                  510  Touchpad Computer Science (Ver. 3.0)-XI
   507   508   509   510   511   512   513   514   515   516   517