OOPs through Java - R23 - Model paper - 3
MODEL QUESTION PAPER – 3
SECTION – I (10 × 5 = 50 Marks)
Answer ALL questions. Each has (a) and (b) parts.
Unit I
-
(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 afor
loop. (5M)
-
(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
-
(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)
(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
-
(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)
-
(a) What is dynamic method dispatch? Explain with an example. (5M)
(b) Write a program to demonstrate the use of thesuper
keyword to access the parent class constructor and methods. (5M)
Unit IV
-
(a) Explain the use of the
Scanner
class and theFormatter
class with examples. (5M)
(b) Write a program to generate 5 random integers and display the maximum and minimum values. (5M)
-
(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
-
(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)
-
(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.
-
What is the difference between
++i
andi++
? -
Write the syntax of an
if-else
statement. -
What is method nesting?
-
Can a constructor be overloaded? (Yes/No, justify)
-
Write the syntax for declaring a two-dimensional array.
-
Define abstract class.
-
What is the difference between
final
,finally
, andfinalize()
? -
Name any two classes in the
java.util
package. -
What is the difference between
StringBuffer
andStringBuilder
? -
List two advantages of multithreading.
Comments
Post a Comment