INTRODUCTION TO JAVA PROGRAMMING LANGUAGE - B.Tech 5th Semester Exam., 2017

2017Semester 2Civil-CAEnd Semester
Bihar Engineering University, Patna
B.Tech 5th Semester Exam., 2017

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE

Time: 3 hoursCode: 051529Full Marks: 70

Instructions:

  1. The marks are indicated in the right-hand margin.
  2. There are NINE questions in this paper.
  3. Attempt FIVE questions in all.
  4. Question No. 1 is compulsory.
Q.1 Choose the correct answer of any seven of the following:[2x7=14]
  1. Size (in bytes) of float and double in Java is:

    1. 4 and 8
    2. 8 and 8
    3. 4 and 4
    4. 8 and 4
  2. Which of the following operators is used to allocate memory to array variable in Java?

    1. malloc
    2. alloc
    3. new
    4. new malloc
  3. Which of the following is an incorrect array declaration?

    1. int arr[] = new int[5]
    2. int [] arr = new int[5]
    3. int arr[] = int[5] new
    4. None of the above
  4. Which of the following is used as default for a member of a class if no access specifier is used for it?

    1. private
    2. public
    3. protected
    4. None of the above (default/package-private)
  5. Which of the following methods of string class is used to obtain character at specified index?

    1. char()
    2. Charat()
    3. charat()
    4. charAt()
  6. What does AWT stand for?

    1. All Window Tools
    2. All Writing Tools
    3. Abstract Window Toolkit
    4. Abstract Writing Toolkit
  7. Which of the following keywords is used to prevent the content of a variable from being modified?

    1. final
    2. last
    3. constant
    4. static
  8. Which of the following functions is used to perform some actions when the object is to be destroyed?

    1. finalize()
    2. delete()
    3. main()
    4. None of the above
  9. What is the order of precedence (highest to lowest) of the following operators?
    1. &&
    2. ==
    3. ?:

    1. 1 -> 2 -> 3
    2. 2 -> 1 -> 3
    3. 3 -> 2 -> 1
    4. 2 -> 3 -> 1
  10. Which of the following classes is related to all the exceptions that can be caught by using catch?

    1. Error
    2. Exception
    3. RuntimeException
    4. All of the above
Q.2 Solve both questions :[14]
  1. What are the various access specifiers for JAVA classes? Discuss the various types of inheritance supported by JAVA.

  2. Discuss the different types of operators in JAVA along with their precedence relationship.

Q.3 Solve both questions :[14]
  1. What is JDBC connection? Explain the types of JAVA drivers available for database connectivity. List the advantages and disadvantages of each of the mentioned JAVA drivers.

  2. What is the difference between final, finally and finalize in JAVA? Compare and contrast between 'throw' and 'throws'.

Q.4 Solve both questions :[14]
  1. What is a thread? Explain the different states in which a thread can exist. Why does a dead thread occur? What are the actions that can occur when a thread enters blocked state?

  2. Explain the various OOPs concepts in JAVA.

Q.5 Solve both questions :[14]
  1. What is an immutable class? How to create an immutable class?

  2. What is an abstract class? Explain with example. Differentiate between abstract class and interfaces. What are the advantages of interfaces over abstract classes?

Q.6 Solve both questions :[14]
  1. What are applets? Which package contains the applet class? Explain the applet life cycle methods.

  2. What is the difference between swing and applet? How is a frame created and closed in an applet?

Q.7 Solve both questions :[14]
  1. How can we restrict inheritance for a class? Does JAVA support multiple inheritance? Justify your answer.

  2. Write a program to insert an element at the last index of an array in JAVA.

Q.8 Solve both questions :[14]
  1. Explain the concept of static methods with suitable examples.

  2. What is event handling? What are the steps involved in event handling?