0% found this document useful (0 votes)
2 views8 pages

Java End Semester Lab Questions

The document outlines various programming tasks, primarily in Java, including creating user interfaces for integer division, calculating factorials, handling file operations, implementing multithreading, and simulating traffic lights. Each task specifies the requirements for the program, such as exception handling and user interaction. Additionally, it includes grading criteria for the programs based on aims, algorithms, execution, and results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Java End Semester Lab Questions

The document outlines various programming tasks, primarily in Java, including creating user interfaces for integer division, calculating factorials, handling file operations, implementing multithreading, and simulating traffic lights. Each task specifies the requirements for the program, such as exception handling and user interaction. Additionally, it includes grading criteria for the programs based on aims, algorithms, execution, and results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

1. Write a program that creates a user interface to perform integer divisions.

The user enters two numbers in the text fields, Num1 and Num2. The Viva Total
division of Num1 and Num2 is displayed in the Result field when the Divide 10
button is clicked. If Num1 or Num2 were not an integer, the program would
throw a NumberFormatException. If Num2 were Zero, the program would
throw an Arithmetic Exception Display the exception in a message dialog
box
2. Develop an Applet that receives an integer in one text field & compute its
factorial value & returns it in another text filed when the button “Compute” is
clicked
Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1. Write a Java program that reads a file name from the user, and then
displays information about whether the file exists, whether the file is readable, Viva Total
whether the file is writable, the type of file and the length of the file in bytes. 10

2. Write a java program to develop multithreaded producer-consumer


application.
Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1. Write a program that creates a user interface to perform integer divisions.


The user enters two numbers in the text fields, Num1 and Num2. The division Total
of Num1 and Num2 is displayed in the Result field when the Divide button is
clicked. If Num1 or Num2 were not an integer, the program would throw a
NumberFormatException. If Num2 were Zero, the program would throw an
Arithmetic Exception Display the exception in a message dialog box
2. Write a java program that implements a multi-thread application that has
three threads. First thread generates random integer every 1 second and if the
value is even, second thread computes the square of the number and prints. If
the value is odd, the third thread will print the value of cube of the number.

Program1 Program 2 Viva


10
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1.Write a Java Program to create an abstract class named Shape that contains
two integers and an empty method named print Area(). Provide three classes Total
named Rectangle, Triangle and Circle such that each one of the classes Viva
10
extends the class Shape. Each one of the classes contains only the method
print Area () that prints the area of the given shape.

2.Write a java program that simulates a traffic light. The program lets the user
select one of three lights: red, yellow, or green with radio buttons. On
selecting a button, an appropriate message with “stop” or “ready” or “go”
should appear above the buttons in a selected color. Initially there is no
message shown.

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1. Write a program that creates a user interface to perform integer divisions.


The user enters two numbers in the text fields, Num1 and Num2. The division Total
of Num1 and Num2 is displayed in the Result field when the Divide button is Viva
clicked. If Num1 or Num2 were not an integer, the program would throw a 10
NumberFormatException. If Num2 were Zero, the program would throw an
Arithmetic Exception Display the exception in a message dialog box
2. Write a java applet program to draw a house.

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1.Write a java program to create an abstract class named Shape that contains
two integers and an empty method named printArea(). Provide three classes Total
named Rectangle, Triangle and Circle such that each one of the classes Viva
10
extends the class Shape. Each one of the classes contain only the method
printArea( ) that prints the area of the given shape.
2.Write a java program to implement stack ADT.

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

Write a Java Program to create an abstract class named Shape that contains
two integers and an empty method named print Area(). Provide three classes Total
named Rectangle, Triangle and Circle such that each one of the classes Viva
extends the class Shape. Each one of the classes contains only the method 10
print Area () that prints the area of the given shape.

2. Write a Java program that works as a simple calculator. Use a grid layout to
arrange buttons for the digits and for the +, -,*, % operations. Add a text field
to display the result. Handle any possible exceptions like divide by zero. .

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1.Write a Java Program to create an abstract class named Shape that contains
two integers and an empty method named print Area(). Provide three classes Total
named Rectangle, Triangle and Circle such that each one of the classes Viva
10
extends the class Shape. Each one of the classes contains only the method
print Area () that prints the area of the given shape.

2.Write a Java program that handles all mouse events and shows the event
name at the center of the window when a mouse event is fired. (Use adapter
classes).

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL
1. Write a program that creates a user interface to perform integer divisions.
The user enters two numbers in the textfields, Num1 and Num2. The division Total
of Num1 and Num2 is displayed in the Result field when the Divide button is Viva
10
clicked. If Num1 or Num2 were not an integer, the program would throw
NumberFormatException. If Num2 were Zero, the program would throw an
ArithmeticException.Display The exception in a message dialog box

2. Write a Java program that works as a simple calculator. Use a grid layout to
arrange buttons for the digits and for the +, -,*, % operations. Add a text field
to display the result. Handle any possible exceptions like divide by zero.

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1. Write a Java Program to load data from CSV file


Total
2. Write a java program that simulates a traffic light. The program lets the Viva
user select one of three lights: red, yellow, or green with radio buttons. On 10
selecting a button, an appropriate message with “stop” or “ready” or “go”
should appear above the buttons in a selected color. Initially there is no
message shown.

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

Write a Java program that handles all mouse events 40-42 and shows the event
name at the center of the window when a mouse event is fired. (Use adapter Total
classes). Viva
Write a Java program that works as a simple calculator. Use a grid layout to arrange 10
buttons for the digits and for the +, -,*, % operations. Add a text field to display the
result. Handle any possible exceptions like divide by zero.

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

Write a Java program that handles all mouse events and shows the event name
at the center of the window when a mouse event is fired. (Use adapter Total
classes). Viva
Write a java applet program to perform basic arithmetic calculations 10

Program1 Program 2
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1. Write a java program to implement stack ADT.


2. Write a java program to create an abstract class named Shape that contains Total
two integers and an empty method named printArea(). Provide three classes Viva
10
named Rectangle, Triangle and Circle such that each one of the classes
extends the class Shape. Each one of the classes contain only the method
printArea( ) that prints the area of the given shape.

Program1 Program 2 10
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)
TOTAL

1. Write a java program to implement stack ADT.


2. Write a java program that simulates a traffic light. The program lets the Total
user select one of three lights: red, yellow, or green with radio buttons. On Viva
selecting a button, an appropriate message with “stop” or “ready” or “go” 10
should appear above the buttons in a selected color. Initially there is no
message shown.

Program1 Program 2
10
Aim & Programs(25) Execution & Aim & Programs(25) Execution &
Algorithms(10) Result (10) Algorithms(10) Result (10)

TOTAL

1. Write a java program that implements a multi-thread application that has


three threads. First thread generates random integer every 1 second and if the Viva Total
value is even, second thread computes the square of the number and prints. If 10
the value is odd, the third thread will print the value of cube of the number
2. Write a java program that simulates a traffic light. The program lets the
user select one of three lights: red, yellow, or green with radio buttons. On
selecting a button, an appropriate message with “stop” or “ready” or “go”
should appear above the buttons in a selected color. Initially there is no
message shown.

Program1 Program 2

10
Aim & Programs Execution Aim & Programs Execution
Algorithms (25) & Result Algorithms (25) & Result
(10) (10) (10) (10)
TOTAL

You might also like