Page 452 - ComputerScience_Class_11
P. 452

F.  Case study-based questions.

                  Student Data Management System
                  A school plans to develop a simple Python-based student data management system to organise and maintain student records
                  efficiently. For each student, the system needs to store a roll number, student name, marks obtained in five different subjects and a
                  pass or fail status. The roll number must be unique for every student so that records can be easily identified. The marks of students
                  may change later due to revaluation or improvement exams, so the data structure used should allow modification.
                  The pass or fail status depends on logical conditions, such as whether the student has scored the minimum required marks. The
                  system should also allow quick access to student details using the roll number.
                  Based on the given case, answer the following questions:
                  1.  What kind of data should be stored for each student in the system?
                Ans.  For each student, the system should store the roll number, student name, marks obtained in five subjects and a pass or fail status.
                  2.  Which data type would be suitable to store the roll number and why should it be unique?
                Ans.  The roll number should be stored as an integer (int). It must be unique so that each student’s record can be easily identified and
                    accessed without confusion.
                  3.  Which data type should be used to store the student name?
                Ans.  The student name should be stored as a string (str), since names are textual data.

                  4.  How can the system determine the pass or fail status of a student?
                Ans.  The system can determine the pass or fail status using logical conditions based on the marks in each subject.

              G.  Identify the error in the given codes and rewrite the correct code:
                  1.  Values = (10 20 30 40)
                    print("Tuple elements are:" t)
                Ans.  Values = (10, 20, 30, 40)
                    print("Tuple elements are:", Values)
                  2.  t = ("Apple", "Banana", "Mango", "Orange")
                    # Display the first element of the tuple
                    print("First element:", t[2])
                    # Display the last element of the tuple
                    print("Second element:", t[-1])
                Ans.  t = ("Apple", "Banana", "Mango", "Orange")
                    # Display the first element of the tuple
                    print("First element:", t[0])
                    # Display the last element of the tuple
                    print("Second element:", t[1])
                  3.  x = none   # Assign None (no value) to variable x
                    y = 0      # Assign 0 to variable y
                    print(x)   # Display the value of x
                    print("x == y")   # Compare x and y and display the result (True or False)
                Ans.  x = None   # Assign None (no value) to variable x
                    y = 0      # Assign 0 to variable y
                    print(x)   # Display the value of x
                    print(x == y)   # Compare x and y and display the result (True or False)






                  450  Touchpad Computer Science (Ver. 3.0)-XI
   447   448   449   450   451   452   453   454   455   456   457