OOPs through Java - R23 - Model paper - 3

 

MODEL QUESTION PAPER – 3

Object-Oriented Programming through Java
Time: 3 Hours                                                                                                          Max Marks: 70


SECTION – I (10 × 5 = 50 Marks)

Answer ALL questions. Each has (a) and (b) parts.

Unit I

  1. (a) Explain variables, data types, and literals in Java with examples. (5M)
    (b) Write a Java program to display the multiplication table of a given number using a for loop. (5M)

(OR)
  1. (a) What are control statements in Java? Explain selection statements with examples. (5M)
    (b) Write a program to check whether a given number is even or odd using the ternary operator. (5M)


Unit II

  1. (a) Explain access specifiers in Java: public, private, protected, and default. (5M)
    (b) Write a program to demonstrate the difference between instance variables, local variables, and static variables. (5M)

(OR)
  1. (a) Explain the difference between a constructor and a method. (5M)
    (b) Write a Java program to demonstrate recursion by finding the sum of digits of a number. (5M)


Unit III

  1. (a) Differentiate between compile-time polymorphism and runtime polymorphism. (5M)
    (b) Write a Java program to reverse an array without using a second array. (5M)

(OR)
  1. (a) What is dynamic method dispatch? Explain with an example. (5M)
    (b) Write a program to demonstrate the use of the super keyword to access the parent class constructor and methods. (5M)


Unit IV

  1. (a) Explain the use of the Scanner class and the Formatter class with examples. (5M)
    (b) Write a program to generate 5 random integers and display the maximum and minimum values. (5M)

(OR)
  1. (a) Explain the role of finally block in exception handling. (5M)
    (b) Write a program to divide two numbers. Handle the case where the denominator is zero using exception handling. (5M)


Unit V

  1. (a) Differentiate between thread life cycle states in Java. (5M)
    (b) Write a program to create two threads – one to print even numbers and another to print odd numbers up to 20. (5M)

(OR)
  1. (a) Explain different types of JDBC drivers. (5M)
    (b) Write a JavaFX program that displays a simple login form with username and password fields. (5M)


SECTION – II (10 × 2 = 20 Marks)

Answer ALL questions. Each carries 2 marks.

  1. What is the difference between ++i and i++?

  2. Write the syntax of an if-else statement.

  3. What is method nesting?

  4. Can a constructor be overloaded? (Yes/No, justify)

  5. Write the syntax for declaring a two-dimensional array.

  6. Define abstract class.

  7. What is the difference between final, finally, and finalize()?

  8. Name any two classes in the java.util package.

  9. What is the difference between StringBuffer and StringBuilder?

  10. List two advantages of multithreading.

Comments

Popular posts from this blog

Artificial Intelligence - UNIT - 1 Topic - 1 : Introduction to AI (Artificial Intelligence)

Career Guide - B.Tech Students

OBJECT ORIENTED PROGRAMMING THROUGH JAVA : Unit - 3 : Topic - 1 : Arrays