Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Internal Lab Exam for CSE-TIGERS

20 marks
1. Write a Java program that reads two floating-point numbers and tests whether they are
the same up to three decimal places.
Test Data: Input floating-point number: 32.586 and Input floating-point another
number: 32.589.
2. Write a Java program to display the pattern like a diamond.

3. Write a Java program to make such a pattern like a pyramid with a number that
repeats in the same row.

4. Write a Java program that reads an integer between 0 and 1000 and adds all the digits
in the integer.

5. Write a Java program to print an array after changing the rows and columns of a two-
dimensional array.
6. Write a Java program to create a Date object using the Calendar class.
7. Write a Java program to create a class called Shape with a method called getArea().
Create a subclass called Rectangle that overrides the getArea() method to calculate the
area of a rectangle.
8. Write a Java program that throws an exception and catch it using a try-catch.

9. Write a Java program to sort an array of given integers using the Quick sort algorithm.
Quick sort is a comparison sort, meaning it can sort items of any type for which a
"less-than" relation (formally, a total order) is defined.
10. Write a Java program to create a method that reads a file and throws an exception if
the file is not found.

You might also like