Java_Practice_Exam
Java_Practice_Exam
Time:60 min
1. Consider two different objects one boy and one girl. The boy has some properties like
hairColor = “black”, eyeColor = “black”, skinColor = “Fair”, height = “5.10 inch”, weight = “65
kg” and actions are read(), play(), sleep(), walk().A girl has some properties like hairColor =
“brown”, eyeColor = “brown”, skinColor = “milky white”, height = “5.4 inch”, weight = “50
kg” and actions are read(), play(), sleep(), walk(). Here, the type of both boy and girl is the same.
Type is “Person”. So, the class name is “Person”. (6 Marks).
2. Write a program to print the area of a rectangle by creating a class named 'Area' taking
the values of its length and breadth as parameters of its constructor and having a method
named 'returnArea' which returns the area of the rectangle. Length and breadth of
rectangle are entered through keyboard. (6 Marks)
3. Draw and Explain JVM Architecture with all its components. (6 Marks)
4. Write a program to print the area and perimeter of a triangle having sides of 3, 4 and 5
units by creating a class named 'Triangle' with constructor having the three sides as its
parameters. (6 Marks).
5. What is Class, explain different types of classes with example of each class also explain
which type of variables, methods and block is possible in each class. (6 Marks)