2020 - BCA [5th Semester] - Java Programming - Purnea University


PU5-BCA-02
B.C.A. (Vth - Semester)
End Semester Examination, December 2020
Paper - II
(Java Programming)
Time: 3 hrs                     Pass Marks: 31.5                       Maximum marks: 70

Note: Candidates are required to give their answer in their own words as far as practicable. All questions carry equal marks. Answer any five questions in which Question No. 1 is compulsory.
  1. Choose the correct answer from the following:
    (i) Which of these selection statements test only for equality?
         (a) if
         (b) switch
         (c) if and switch
         (d) none of these
    (ii) Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
         (a) do-while
         (b) while
         (c) for
         (d) none of these
    (iii) Which of these can be returned by the operator &?
         (a) Integer
         (b) Boolean
         (c) Character
         (d) Integer or Boolean
    (iv) Which of these is returned by "greater than", "less than" and "equal to" operators?
         (a) Integers
         (b) Floating point numbers
         (c) Boolean
         (d) None of these
    (v) Which of these class is superclass of every class in Java?
         (a) String class
         (b) Object class
         (c) Abstract class
         (d) Array List class
    (vi) A Class in Java is like a
         (a) Prototype
         (b) Instruction Sheet
         (c) Blueprint
         (d) All the above
    (vii) Which of these is correct way of inheriting class A by class B?
         (a) class B + class A {}
         (b) class B inherits class A {}
         (c) class B extends A {}
         (d) class B extends class A {}
    (viii) Which of these is an incorrect array declaration?
         (a) int arr[] = new int[5]
         (b) int []arr = new int[5]
         (c) int arr[] = new int[5]
         (d) int arr[] = int [5] new
    (ix) String in Java is a?
         (a) class
         (b) object
         (c) variable
         (d) character array
    (x) Which of these class object can be used to form a dynamic array?
         (a) ArrayList
         (b) Map
         (c) Vector
         (d) ArrayList & Vector
    (xi) Which of these method of Thread class is used to find out the priority given to a thread?
         (a) get()
         (b) Thread Priority()
         (c) getPriority (0)
         (d) getThreadPriority()
    (xii) Which of these method of Thread class is used to Suspend a thread for a period of time?
         (a) sleep()
         (c) suspend()
         (b) terminate()
         (d) stop()
    (xiii) Which of these functions is called to display the output of an applet?
         (a) display()
         (b) paint()
         (c) display Applet()
         (d) PrintApplet()
    (xiv) An applet is a Java class that extends the?
         (a) java. Applet class
         (b) java class
         (c) Applet class
         (d) java.applet. Applet class

  2. Java is both a programming language and a platform. Comment. Create a Java program namely JProg.java that prints JAVA IS WONDERFUL.

  3. What are iteration statements? Name the iteration statements provided by Java. Write a program to find whether the given character is a digit or a letter.

  4. How are private members different from public members of a class? Class can be used to define userdefined datatype. How?

  5. How does Java resolve variables having same names? Give code example. Write a program to implement circle class. You should be able to display the radius, area and perimeter of the circle.

  6. What do you understand by an array? Write a program in Java to find the sum of all the elements which lie on either diagonal for the given matrix.
    \begin{pmatrix}
    1 & 2 & 3 & 4 \\
    5 & 6 & 7 & 8 \\
    8 & 7 & 6 & 5 \\
    4 & 3 & 2 & 1
    \end{pmatrix}

  7. What are threads in Java? Explain with example. How many types we can create thread in Java? Comment on life cycle of a thread.

  8. What is applets in Java with example? How many types of Java applets are there? How will you create an executable applet and add it to HTML file?

  9. Discuss the steps involved in designing the first web application in Java. What do you mean by applet tag? How do you pass user input in Java?

  10. Write short notes on any two of the following:
    a. Constants and variables in Java
    b. Constructor
    c. Hiding class
    d. Thread exceptions
    e. Applets life cycle.
***