Page 238 - ComputerScience_Class_11
P. 238

Based on the given case, answer the following questions:
                  1.  What issue did Aakash face while running his program?
                    a.  The program didn't handle boundary conditions properly.
                    b.  The program didn't assign a priority to high-priority tasks.
                    c.  The program crashed when the user entered a time above 3 hours.
                    d.  The program displayed "Low Priority" for all tasks.
                  2.  What change should Aakash make to handle boundary values correctly for time required?
                    a.  Change the condition timeRequired <= 1 to timeRequired < 1.
                    b.  Modify the else if condition to use timeRequired >= 1 && timeRequired < 3.
                    c.  Use a switch-case statement to classify tasks.
                    d.  Modify the condition to check for exact hours only (i.e., 1 hour and 3 hours).
                  3.  Which control statement did Aakash use to assign task priorities?
                    a.  if-else-if statement                        b.  for loop
                    c.  switch-case statement                       d.  while loop
                  4.  What could Aakash do to make his program more flexible if additional priority categories are added in the future?
                    a.  Use multiple if-else-if statements for each category.
                    b.  Use a switch-case statement to handle different categories dynamically.
                    c.  Use a loop to automatically assign priority.
                    d.  Use a for loop to check for different time ranges.
              F.  Write the Java program for the following:
                  1.  Write a program to compute the amount that customer pays for the taxi that he hires based on following conditions:
                     Distance Rate
                     Up to 5 km: `75
                     For the next 10 km: `15/km
                     For the next 20 km: `10/km
                     More than 25 km: `5/km
                  2.  Write a program to display the following pattern using switch case.
                     i. 1
                        1 0
                        1 0 1
                        1 0 1 0
                        1 0 1 0 1
                     ii. 1 2 3 4 5
                         2 2 3 4 5
                         3 3 3 4 5
                         4 4 4 4 5
                         5 5 5 5 5
                  3.  Write a program in Java to display all the prime Fibonacci series numbers upto n.
                     E.g., 2, 3, 5, 13, 233, etc.
              G.  Find the output of the following programs:
                  1.  class Main {
                        public static void main(String[] args) {
                            for(int i=1; i<=10; i=i*2){
                                System.out.println(i);
                            }
                        }
                    }


                  236  Touchpad Computer Science (Ver. 3.0)-XI
   233   234   235   236   237   238   239   240   241   242   243