Page 110 - ComputerScience_Class_11
P. 110

3.  Write a short note on the history of the Java.
                  4.  What are the main features of BlueJ?
                  5.  What is a logical error? Identify the logical errors in the following program and suggest the corrections.

                    class logical_error
                    {
                        void natural()
                        {
                            int i, s = 1;
                            for(i=1; i<10; i++)
                            {
                                s = s+i;
                            }
                            System.out.println("Sum "+s);
                        }
                    }
                  6.  What is inheritance in object-oriented programming? Explain it with a real-life example.
                  7.  What are the drawbacks of procedure-oriented programming languages? Explain briefly.
                  8.  Explain some features of the Java language.

              D.  Higher Order Thinking Skills (HOTS)
                  1.  Suppose you are designing a transport management system with a base class Vehicle and derived classes Car and Bike. Explain
                    how inheritance will reduce code duplication and improve reusability in this system.
                  2.  A company wants to develop a Java application that runs on different operating systems like Windows and Linux. Based on Java’s
                    features discussed in the chapter, explain how Java fulfills this requirement.
              E.  Case study-based questions.
                    Aman is developing a simple Java program using BlueJ. He creates a class named Employee that contains data members like name
                  and salary along with a method to display employee details. He ensures that the data is accessed only through methods.
                    While compiling his program, he forgets to put a semicolon after a statement. The compiler shows an error and stops execution.
                  After correcting the mistake, the program compiles successfully. Aman also learns that Java uses both a compiler and an interpreter
                  and follows the principle of "Write Once, Run Anywhere."
                  Based on the given case, answer the following questions:
                  1.  Combining data members and methods inside a class is known as:
                    a.  Inheritance                                 b.  Encapsulation
                    c.  Polymorphism                                d.  Abstraction
                  2.  Missing a semicolon in Java results in:
                    a.  Logical error                               b.  Runtime error
                    c.  Syntax error                                d.  No error
                  3.  Java follows which principle?
                    a.  Write Twice, Run Anywhere                   b.  Write Once, Run Once
                    c.  Write Once, Run Anywhere                    d.  Write Anywhere, Run Once
                  4.  Java uses:
                    a.  Only compiler                               b.  Only interpreter
                    c.  Both compiler and interpreter               d.  None of these

















                  108  Touchpad Computer Science (Ver. 3.0)-XI
   105   106   107   108   109   110   111   112   113   114   115