ICT2612 EXAM PACK
2024
QUESTIONS AND
ANSWERS
FOR ASSISTANCE CONTACT
EMAIL:
, lOMoARcPSD|31863004
Lab Exercises
Object Oriented Programming with Java
Lab Exercise
Lab Unit – 1 (2 Hrs actual Time)
1.1 Write a program to display any message:
1.2 Write a Java program to display default value of all primitive data types of
Java.
1.3 Write a program check two strings are equal or not.
Lab Unit – 2 (2 Hrs actual
Time)
2.1 Write a program to give the examples of operators.
2.1.1 Increment and decrement operators.
2.1.2 Bitwise Complement Operator.
2.1.3 Arithmetic operator.
2.1.4 Relational Operator
2.1.5 Bitwise operator.
2.1.6 Conditional Operator.
2.2 Write a program to give the example of control statements.
2.2.1 If statements.
2.2.2 Switch Statements.
2.2.3 For loop.
2.2.4 While Statements.
2.2.5 Do statements
2.3 Write a program to calculate the following
2.3.1 Find the length of array.
2.3.2 Demonstrate a one-dimensional array.
2.3.3 Demonstrate a two-dimensional array.
2.3.4 Demonstrate a multi-dimensional array.
2.4 Write a program give example for command line arguments.
Centre for Information Technology and Engineering, Manonmaniam Sundaranar University 1
, lOMoARcPSD|31863004
Object Oriented Programming with Java
2.4.1 To find the sum of command line arguments and count the
invalid integers entered.
2.4.2 To get the name using command line.
2.5 Write a program to print the following triangle of binary digits.
2.5.1 1 2.5.2 5
101 45
10001 345
1000001 2345
100000001 12345
012345
2.5.3 1
12
123
1234
12345
2.6. Write a program to the find the following
2.6.1 Prime number checking
2.6.2 Sum of digit
2.7 Write a program to arrange the numbers in ascending order.
2.8 Write a program to calculate the roots of Quadratic equations.
2.9 Write a program for calculating Matrix Operations.
2.9.1 Addition.
2.9.2 Multiplication.
Lab Unit – 3 (2 Hrs Real Time)
3.1 Write a program to create a room class, the attributes of this class is
roomno, roomtype, roomarea and ACmachine. In this class the member
functions are setdata and displaydata.
2 Centre for Information Technology and Engineering, Manonmaniam Sundaranar University
Downloaded by Gabriel Musyoka ()
, lOMoARcPSD|31863004
Lab Exercises
3.2 Write a program create a class ‘simpleobject‘. Using constructor display
the message.
3.3 Write a program for the following
1. Example for call by value.
2. Example for call by reference.
3.4 Write a program to give the example for ‘this’ operator. And also use the
‘this’ keyword as return statement.
Lab – 4 (2 Hrs Real Time)
4.1 Write a program to demonstrate static variables, methods, and blocks.
4.2 Write a program for reuse class. For this program use the above ‘room
class’ program.
4.3 Create class named as ‘a’ and create a sub class ‘b’. Which is extends from
class ‘a’. And use these classes in ‘inherit’ class.
4.4 Write a program to give the example for method overriding concepts.
4.5 Write a program to give the example for ‘super’ keyword.
Lab – 5 (2 Hrs Real Time)
5.1 Write a program to create a class named shape. In this class we have three
sub classes circle, triangle and square each class has two member function
named draw () and erase (). Create these using polymorphism concepts.
5.2 Write a program to give a simple example for abstract class.
5.3 Write a program suppose, it is required to build a project consisting of a
number of classes, possibly using a large number of programmers. It is
necessary to make sure that every class from which all other classes in the
project will be inherited. Since any new classes in the project must inherit
from the base class, programmers are not free to create a different
interface. Therefore, it can be guaranteed that all the classes in the project
will respond to the same debugging commands.
Centre for Information Technology and Engineering, Manonmaniam Sundaranar University 3
Downloaded by Gabriel Musyoka ()
2024
QUESTIONS AND
ANSWERS
FOR ASSISTANCE CONTACT
EMAIL:
, lOMoARcPSD|31863004
Lab Exercises
Object Oriented Programming with Java
Lab Exercise
Lab Unit – 1 (2 Hrs actual Time)
1.1 Write a program to display any message:
1.2 Write a Java program to display default value of all primitive data types of
Java.
1.3 Write a program check two strings are equal or not.
Lab Unit – 2 (2 Hrs actual
Time)
2.1 Write a program to give the examples of operators.
2.1.1 Increment and decrement operators.
2.1.2 Bitwise Complement Operator.
2.1.3 Arithmetic operator.
2.1.4 Relational Operator
2.1.5 Bitwise operator.
2.1.6 Conditional Operator.
2.2 Write a program to give the example of control statements.
2.2.1 If statements.
2.2.2 Switch Statements.
2.2.3 For loop.
2.2.4 While Statements.
2.2.5 Do statements
2.3 Write a program to calculate the following
2.3.1 Find the length of array.
2.3.2 Demonstrate a one-dimensional array.
2.3.3 Demonstrate a two-dimensional array.
2.3.4 Demonstrate a multi-dimensional array.
2.4 Write a program give example for command line arguments.
Centre for Information Technology and Engineering, Manonmaniam Sundaranar University 1
, lOMoARcPSD|31863004
Object Oriented Programming with Java
2.4.1 To find the sum of command line arguments and count the
invalid integers entered.
2.4.2 To get the name using command line.
2.5 Write a program to print the following triangle of binary digits.
2.5.1 1 2.5.2 5
101 45
10001 345
1000001 2345
100000001 12345
012345
2.5.3 1
12
123
1234
12345
2.6. Write a program to the find the following
2.6.1 Prime number checking
2.6.2 Sum of digit
2.7 Write a program to arrange the numbers in ascending order.
2.8 Write a program to calculate the roots of Quadratic equations.
2.9 Write a program for calculating Matrix Operations.
2.9.1 Addition.
2.9.2 Multiplication.
Lab Unit – 3 (2 Hrs Real Time)
3.1 Write a program to create a room class, the attributes of this class is
roomno, roomtype, roomarea and ACmachine. In this class the member
functions are setdata and displaydata.
2 Centre for Information Technology and Engineering, Manonmaniam Sundaranar University
Downloaded by Gabriel Musyoka ()
, lOMoARcPSD|31863004
Lab Exercises
3.2 Write a program create a class ‘simpleobject‘. Using constructor display
the message.
3.3 Write a program for the following
1. Example for call by value.
2. Example for call by reference.
3.4 Write a program to give the example for ‘this’ operator. And also use the
‘this’ keyword as return statement.
Lab – 4 (2 Hrs Real Time)
4.1 Write a program to demonstrate static variables, methods, and blocks.
4.2 Write a program for reuse class. For this program use the above ‘room
class’ program.
4.3 Create class named as ‘a’ and create a sub class ‘b’. Which is extends from
class ‘a’. And use these classes in ‘inherit’ class.
4.4 Write a program to give the example for method overriding concepts.
4.5 Write a program to give the example for ‘super’ keyword.
Lab – 5 (2 Hrs Real Time)
5.1 Write a program to create a class named shape. In this class we have three
sub classes circle, triangle and square each class has two member function
named draw () and erase (). Create these using polymorphism concepts.
5.2 Write a program to give a simple example for abstract class.
5.3 Write a program suppose, it is required to build a project consisting of a
number of classes, possibly using a large number of programmers. It is
necessary to make sure that every class from which all other classes in the
project will be inherited. Since any new classes in the project must inherit
from the base class, programmers are not free to create a different
interface. Therefore, it can be guaranteed that all the classes in the project
will respond to the same debugging commands.
Centre for Information Technology and Engineering, Manonmaniam Sundaranar University 3
Downloaded by Gabriel Musyoka ()